From dd08577b50d9b5573912ce88dcf8f47b3fc87034 Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Tue, 11 Jul 2006 22:14:09 +0000 Subject: [PATCH] Bug 342035. Create accessibles for all block level elements so that ATs can determine line spacing. r=ginn.chen, sr=neil, sr=roc git-svn-id: svn://10.0.0.236/trunk@201907 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsBlockFrame.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 2d5806ce8ee..d89a0e00292 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -83,6 +83,7 @@ #include "nsIServiceManager.h" #include "nsIScrollableFrame.h" #ifdef ACCESSIBILITY +#include "nsIDOMHTMLDocument.h" #include "nsIAccessibilityService.h" #endif #include "nsLayoutUtils.h" @@ -6553,16 +6554,36 @@ NS_IMETHODIMP nsBlockFrame::GetAccessible(nsIAccessible** aAccessible) do_GetService("@mozilla.org/accessibilityService;1"); NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE); - // treat
as block element instead of inline. + // block frame may be for
if (mContent->Tag() == nsHTMLAtoms::hr) { return accService->CreateHTMLHRAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible); } nsPresContext *aPresContext = GetPresContext(); if (!mBullet || !aPresContext) { - return NS_ERROR_FAILURE; + if (!mContent || !mContent->GetParent()) { + // Don't create accessible objects for the root content node, they are redundant with + // the nsDocAccessible object created with the document node + return NS_ERROR_FAILURE; + } + + nsCOMPtr htmlDoc = + do_QueryInterface(mContent->GetDocument()); + if (htmlDoc) { + nsCOMPtr body; + htmlDoc->GetBody(getter_AddRefs(body)); + if (SameCOMIdentity(body, mContent)) { + // Don't create accessible objects for the body, they are redundant with + // the nsDocAccessible object created with the document node + return NS_ERROR_FAILURE; + } + } + + // Not a bullet, treat as normal HTML container + return accService->CreateHyperTextAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible); } + // Create special list bullet accessible const nsStyleList* myList = GetStyleList(); nsAutoString bulletText; if (myList->mListStyleImage || myList->mListStyleType == NS_STYLE_LIST_STYLE_DISC ||