From fa5868ceaa45ff4765d1046c4a9048ca6ee1abc4 Mon Sep 17 00:00:00 2001 From: Alexander Surkov Date: Wed, 5 Oct 2011 15:24:44 +0900 Subject: [PATCH] Bug 627718 - Map used for grouping is not accessible under certain circumstances, r=marcoz --- .../src/base/nsAccessibilityService.cpp | 18 ++-- accessible/tests/mochitest/tree/Makefile.in | 1 + accessible/tests/mochitest/tree/test_map.html | 83 +++++++++++++++++++ 3 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 accessible/tests/mochitest/tree/test_map.html diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index 20b89315e70..570147028ca 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -70,6 +70,7 @@ #include "nsImageFrame.h" #include "nsILink.h" #include "nsIObserverService.h" +#include "nsLayoutUtils.h" #include "nsNPAPIPluginInstance.h" #include "nsISupportsUtils.h" #include "nsObjectFrame.h" @@ -1012,15 +1013,14 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, if (isHTML && content->Tag() == nsGkAtoms::map) { // Create hyper text accessible for HTML map if it is used to group links // (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML - // map doesn't have 'name' attribute (or has empty name attribute) then we - // suppose it is used for links grouping. Otherwise we think it is used in - // conjuction with HTML image element and in this case we don't create any - // accessible for it and don't walk into it. The accessibles for HTML area - // (nsHTMLAreaAccessible) the map contains are attached as children of the - // appropriate accessible for HTML image (nsHTMLImageAccessible). - nsAutoString name; - content->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name); - if (!name.IsEmpty()) { + // map rect is empty then it is used for links grouping. Otherwise it should + // be used in conjunction with HTML image element and in this case we don't + // create any accessible for it and don't walk into it. The accessibles for + // HTML area (nsHTMLAreaAccessible) the map contains are attached as + // children of the appropriate accessible for HTML image + // (nsHTMLImageAccessible). + if (nsLayoutUtils::GetAllInFlowRectsUnion(weakFrame, + weakFrame->GetParent()).IsEmpty()) { if (aIsSubtreeHidden) *aIsSubtreeHidden = true; diff --git a/accessible/tests/mochitest/tree/Makefile.in b/accessible/tests/mochitest/tree/Makefile.in index ddb386614bc..9b767a27a1f 100644 --- a/accessible/tests/mochitest/tree/Makefile.in +++ b/accessible/tests/mochitest/tree/Makefile.in @@ -65,6 +65,7 @@ _TEST_FILES =\ test_img.html \ test_invalidationlist.html \ test_list.html \ + test_map.html \ test_media.html \ test_select.html \ test_tabbox.xul \ diff --git a/accessible/tests/mochitest/tree/test_map.html b/accessible/tests/mochitest/tree/test_map.html new file mode 100644 index 00000000000..39f5baf2189 --- /dev/null +++ b/accessible/tests/mochitest/tree/test_map.html @@ -0,0 +1,83 @@ + + + + HTML map accessible tree tests + + + + + + + + + + + + + Mozilla Bug 627718 + +

+ +
+  
+ +
+ + b + a + +
+ + + + +

+ [Bypass navigation bar] + [Home] +

+
+ + +