REGRESSION: A problem with Voiceover and finding links
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2011 20:27:48 +0000 (20:27 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jan 2011 20:27:48 +0000 (20:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=52324

Reviewed by Darin Adler.

Source/WebCore:

Fallout from recent change to make WebCore return its own scroll view.
   1) There were two scroll views in the hierarchy, one which no needed to be ignored.
   2) Hit tests for sub frames needed to be offset.
   3) The check for whether an attachment is ignored must happen earlier than using
      the helpText to determine if an element should be ignored.

Test: platform/mac/accessibility/iframe-with-title-correct-hierarchy.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::elementAccessibilityHitTest):
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
* accessibility/mac/AccessibilityObjectWrapper.mm:
(-[AccessibilityObjectWrapper scrollViewParent]):

Source/WebKit/mac:

* WebView/WebDynamicScrollBarsView.mm:
(-[WebDynamicScrollBarsView accessibilityIsIgnored]):

LayoutTests:

* platform/mac/accessibility/iframe-with-title-correct-hierarchy-expected.txt: Added.
* platform/mac/accessibility/iframe-with-title-correct-hierarchy.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76044 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/platform/mac/accessibility/iframe-with-title-correct-hierarchy-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/accessibility/iframe-with-title-correct-hierarchy.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityObject.cpp
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/accessibility/mac/AccessibilityObjectWrapper.mm
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm

index ca1361efe6991b2d6562c77bf444000ab172b4d3..4f906be6827df0537e67dfe3a984f86a290daac0 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-18  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: A problem with Voiceover and finding links
+        https://bugs.webkit.org/show_bug.cgi?id=52324
+
+        * platform/mac/accessibility/iframe-with-title-correct-hierarchy-expected.txt: Added.
+        * platform/mac/accessibility/iframe-with-title-correct-hierarchy.html: Added.
+
 2011-01-18  Martin Robinson  <mrobinson@igalia.com>
 
         Reviewed by Eric Seidel.
diff --git a/LayoutTests/platform/mac/accessibility/iframe-with-title-correct-hierarchy-expected.txt b/LayoutTests/platform/mac/accessibility/iframe-with-title-correct-hierarchy-expected.txt
new file mode 100644 (file)
index 0000000..7d65863
--- /dev/null
@@ -0,0 +1,17 @@
+test
+
+This makes sure that if an iframe has a title attribute, it will still show up in the hierarchy correctly.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS iframeScroll.role is 'AXRole: AXScrollArea'
+PASS iframeScroll.parentElement().role is 'AXRole: AXGroup'
+PASS iframeScroll.parentElement().parentElement().role is 'AXRole: AXWebArea'
+PASS iframeScroll.parentElement().parentElement().isEqual(bodyElement) is true
+PASS iframeWeb.parentElement().isEqual(iframeScroll) is true
+PASS hitTest.isEqual(iframeWeb) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/platform/mac/accessibility/iframe-with-title-correct-hierarchy.html b/LayoutTests/platform/mac/accessibility/iframe-with-title-correct-hierarchy.html
new file mode 100644 (file)
index 0000000..845128f
--- /dev/null
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../../../fast/js/resources/js-test-style.css">
+<script>
+    var successfullyParsed = false;
+</script>
+<script src="../../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body id="body">
+
+<div role="button">test</div>
+<div style="position: relative; left: 100px">
+<iframe id="frame" scrolling=YES  width=100 height=100 border=1 title="iframe" src="resources/cake.png"></iframe>
+</div>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+    description("This makes sure that if an iframe has a title attribute, it will still show up in the hierarchy correctly.");
+
+    if (window.accessibilityController) {
+       document.getElementById("body").focus();
+       var bodyElement = accessibilityController.focusedElement;
+       document.getElementById("frame").focus();
+
+       // scroll area -> web area -> group -> iframe (scroll area)
+       var iframeScroll = accessibilityController.rootElement.childAtIndex(0).childAtIndex(1).childAtIndex(0);
+       shouldBe("iframeScroll.role", "'AXRole: AXScrollArea'");
+       shouldBe("iframeScroll.parentElement().role", "'AXRole: AXGroup'");
+       shouldBe("iframeScroll.parentElement().parentElement().role", "'AXRole: AXWebArea'");
+       shouldBeTrue("iframeScroll.parentElement().parentElement().isEqual(bodyElement)");
+
+       // web area (of scroll area)
+       var iframeWeb = iframeScroll.childAtIndex(0);
+       shouldBeTrue("iframeWeb.parentElement().isEqual(iframeScroll)");
+       var x = iframeWeb.x + 5;
+       var y = iframeWeb.y + 5;
+
+       var hitTest = accessibilityController.elementAtPoint(x, y);
+       shouldBeTrue("hitTest.isEqual(iframeWeb)");
+    }
+
+    successfullyParsed = true;
+</script>
+
+<script src="../../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
+
index c2745459954034c8db0de7fde812630551c83c3b..10cafb9e268386963d03ab73bf7972f86b7d9745 100644 (file)
@@ -1,3 +1,25 @@
+2011-01-18  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: A problem with Voiceover and finding links
+        https://bugs.webkit.org/show_bug.cgi?id=52324
+
+        Fallout from recent change to make WebCore return its own scroll view.
+           1) There were two scroll views in the hierarchy, one which no needed to be ignored.
+           2) Hit tests for sub frames needed to be offset.
+           3) The check for whether an attachment is ignored must happen earlier than using
+              the helpText to determine if an element should be ignored.
+
+        Test: platform/mac/accessibility/iframe-with-title-correct-hierarchy.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::elementAccessibilityHitTest):
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::accessibilityIsIgnored):
+        * accessibility/mac/AccessibilityObjectWrapper.mm:
+        (-[AccessibilityObjectWrapper scrollViewParent]):
+
 2011-01-18  Adam Roben  <aroben@apple.com>
 
         Call alternate CFHTTPCookie functions if available
index 511bd3f84d239b5971560aca09eeae0a6e39364d..f2a2d7d18595afe090f93ba1f5fdf66a4966e38a 100644 (file)
@@ -1013,8 +1013,9 @@ AccessibilityObject* AccessibilityObject::elementAccessibilityHitTest(const IntP
     // Send the hit test back into the sub-frame if necessary.
     if (isAttachment()) {
         Widget* widget = widgetForAttachmentView();
+        // Normalize the point for the widget's bounds.
         if (widget && widget->isFrameView())
-            return axObjectCache()->getOrCreate(static_cast<ScrollView*>(widget))->accessibilityHitTest(point);
+            return axObjectCache()->getOrCreate(widget)->accessibilityHitTest(IntPoint(point - widget->frameRect().location()));
     }
 
     return const_cast<AccessibilityObject*>(this); 
index 8b0c5ca2693a500e5b7fd7bf12700b2ab6c05b29..ca8d4a745863321f9aeb3214d92400436a7c7e52 100644 (file)
@@ -1772,6 +1772,10 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const
     if (!isAllowedChildOfTree())
         return true;
 
+    // Allow the platform to decide if the attachment is ignored or not.
+    if (isAttachment())
+        return accessibilityIgnoreAttachment();
+    
     // ignore popup menu items because AppKit does
     for (RenderObject* parent = m_renderer->parent(); parent; parent = parent->parent()) {
         if (parent->isBoxModelObject() && toRenderBoxModelObject(parent)->isMenuList())
@@ -1817,9 +1821,6 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const
     if (ariaRoleAttribute() != UnknownRole)
         return false;
 
-    if (!helpText().isEmpty())
-        return false;
-    
     // don't ignore labels, because they serve as TitleUIElements
     Node* node = m_renderer->node();
     if (node && node->hasTagName(labelTag))
@@ -1877,11 +1878,17 @@ bool AccessibilityRenderObject::accessibilityIsIgnored() const
         return false;
     }
     
-    // make a platform-specific decision
-    if (isAttachment())
-        return accessibilityIgnoreAttachment();
+    if (isWebArea() || m_renderer->isListMarker())
+        return false;
+    
+    // Using the help text to decide an element's visibility is not as definitive
+    // as previous checks, so this should remain as one of the last.
+    if (!helpText().isEmpty())
+        return false;
     
-    return !m_renderer->isListMarker() && !isWebArea();
+    // By default, objects should be ignored so that the AX hierarchy is not 
+    // filled with unnecessary items.
+    return true;
 }
 
 bool AccessibilityRenderObject::isLoaded() const
index f3b388b2cced91318d45589db94f9989a4aac1be..c2e3724ed0e9451e9241c911371011e63507b725 100644 (file)
@@ -1455,7 +1455,7 @@ static NSString* roleValueToNSString(AccessibilityRole value)
         return nil;
     
     if (scroll->platformWidget())
-        return scroll->platformWidget();
+        return NSAccessibilityUnignoredAncestor(scroll->platformWidget());
 
     return [self remoteAccessibilityParentObject];
 }
index fcd7edb2fad066b75b8f2be1f6392d042a5c4316..c07253726112684fee84c1a8aed10f2ce9c52047 100644 (file)
@@ -1,3 +1,13 @@
+2011-01-18  Chris Fleizach  <cfleizach@apple.com>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION: A problem with Voiceover and finding links
+        https://bugs.webkit.org/show_bug.cgi?id=52324
+
+        * WebView/WebDynamicScrollBarsView.mm:
+        (-[WebDynamicScrollBarsView accessibilityIsIgnored]):
+
 2011-01-17  David Kilzer  <ddkilzer@apple.com>
 
         <http://webkit.org/b/52596> Add missing DOMDocument/DOMDocumentFragment headers to Xcode project
index 79c3067bab514ed6c5364b0314bf6797b8de24ae..b8edef8b0c98882d98ab0e1f6769d4e6a05236ac 100644 (file)
@@ -565,11 +565,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
 
 - (BOOL)accessibilityIsIgnored 
 {
-    id docView = [self documentView];
-    if ([docView isKindOfClass:[WebFrameView class]] && ![(WebFrameView *)docView allowsScrolling])
-        return YES;
-    
-    return [super accessibilityIsIgnored];
+    return YES;
 }
 
 - (void)setScrollOrigin:(NSPoint)scrollOrigin updatePosition:(BOOL)updatePosition