AX: support clickPoint in DRT for chromium
authordmazzoni@google.com <dmazzoni@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2012 17:29:34 +0000 (17:29 +0000)
committerdmazzoni@google.com <dmazzoni@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Dec 2012 17:29:34 +0000 (17:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=97359

Reviewed by Chris Fleizach.

Source/WebCore:

When computing the accessible bounding box of an
SVG root, be sure to call a method that uses transforms,
otherwise an assertion fails.

Newly unskipped tests: accessibility/svg-bounds.html and
accessibility/svg-remote-element.html

* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::boundingBoxRect):

Source/WebKit/chromium:

Exposes the clickPoint accessibility method in WebAccessibilityObject.

* public/WebAccessibilityObject.h:
(WebAccessibilityObject):
* src/WebAccessibilityObject.cpp:
(WebKit::WebAccessibilityObject::clickPoint):
(WebKit):

Tools:

Implement clickPointX, clickPointY, and elementAtPoint for Chromium, so that
several more tests can pass.

* DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp:
(WebTestRunner::AccessibilityUIElement::AccessibilityUIElement):
(WebTestRunner::AccessibilityUIElement::clickPointXGetterCallback):
(WebTestRunner):
(WebTestRunner::AccessibilityUIElement::clickPointYGetterCallback):
(WebTestRunner::AccessibilityUIElement::elementAtPointCallback):
* DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h:
(AccessibilityUIElement):

LayoutTests:

Enable four more tests now that clickPointX, clickPointY,
and elementAtPoint are implemented for Chromium.

Minor fixes to two tests to make them more robust
across platfoms and when run in parallel.

* accessibility/svg-bounds.html: Updated
* accessibility/svg-bounds-expected.txt: Added (made cross-platform
* accessibility/svg-remote-element.html: Updated
* accessibility/svg-remote-element-expected.txt: Added (made cross-platform)
* platform/mac/accessibility/svg-bounds-expected.txt: Deleted
* platform/mac/accessibility/svg-remote-element-expected.txt: Deleted
* platform/chromium/TestExpectations: Updated

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

16 files changed:
LayoutTests/ChangeLog
LayoutTests/accessibility/svg-bounds-expected.txt [moved from LayoutTests/platform/chromium/accessibility/svg-bounds-expected.txt with 90% similarity]
LayoutTests/accessibility/svg-bounds.html
LayoutTests/accessibility/svg-remote-element-expected.txt
LayoutTests/accessibility/svg-remote-element.html
LayoutTests/platform/chromium/TestExpectations
LayoutTests/platform/mac/accessibility/svg-bounds-expected.txt [deleted file]
LayoutTests/platform/mac/accessibility/svg-remote-element-expected.txt [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebAccessibilityObject.h
Source/WebKit/chromium/src/WebAccessibilityObject.cpp
Tools/ChangeLog
Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp
Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h

index dfd0a6b..35f819e 100644 (file)
@@ -1,3 +1,24 @@
+2012-12-20  Dominic Mazzoni  <dmazzoni@google.com>
+
+        AX: support clickPoint in DRT for chromium
+        https://bugs.webkit.org/show_bug.cgi?id=97359
+
+        Reviewed by Chris Fleizach.
+
+        Enable four more tests now that clickPointX, clickPointY,
+        and elementAtPoint are implemented for Chromium.
+
+        Minor fixes to two tests to make them more robust
+        across platfoms and when run in parallel.
+
+        * accessibility/svg-bounds.html: Updated
+        * accessibility/svg-bounds-expected.txt: Added (made cross-platform
+        * accessibility/svg-remote-element.html: Updated
+        * accessibility/svg-remote-element-expected.txt: Added (made cross-platform)
+        * platform/mac/accessibility/svg-bounds-expected.txt: Deleted
+        * platform/mac/accessibility/svg-remote-element-expected.txt: Deleted
+        * platform/chromium/TestExpectations: Updated
+
 2012-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [Qt]REGRESSION(r138222): It made fast/forms/number/number-spinbutton-click-in-iframe.html crash
@@ -4,7 +4,7 @@ This test ensures the accessibility bounds of embedded SVG objects are correct.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-container location: (1007, 1007)
+container location: (607, 107)
 Face role: AXRole: AXButton
 Face label: AXDescription: face
 FaceX: 0
@@ -26,12 +26,12 @@ NoseY: 206
 Mouth role: AXRole: AXButton
 Mouth label: AXDescription: smile
 MouthX: 115
-MouthY: 274.5
+MouthY: 275
 
 
 Text role: AXRole: AXStaticText
-TextX: 0.5
-TextY: 2
+TextX/10: 15
+TextY/10: 11
 
 
 Image role: AXRole: AXImage
index feeb19d..f18b05d 100644 (file)
@@ -3,17 +3,17 @@
 <body>
 <script src="../fast/js/resources/js-test-pre.js"></script>
 
-<div id="container" style="position: relative; top: 1000px; left: 1000px; width:400px; height: 400px;" role="group" tabindex="0">
+<div id="container" style="position: relative; top: 100px; left: 600px; width:400px; height: 400px;" role="group" tabindex="0">
 
-<svg>
+<svg role="group" id="svgroot">
 
   <circle role="button" aria-label="face" id="face" r="200" cx="200" cy="200" stroke="red" stroke-width="1" fill="yellow" />
   <ellipse role="button" aria-label="left-eye" id="left-eye" cx="120" cy="180" rx="18" ry="33" fill="black"/>
   <ellipse role="button" aria-label="right-eye" id="right-eye" cx="280" cy="120" rx="18" ry="33" fill="black"/>
   <ellipse role="button" aria-label="nose" id="nose" cx="200" cy="220" rx="8" ry="15" fill="black"/>
   <path role="button" aria-label="smile" id="smile" stroke-width="10" stroke="black" fill="none" stroke-linecap="round" d="M120,280 Q200,330 290,280"/>
-  <text x="0" y="15" fill="red">Test</text>  
-  <image x="20" y="20" width="300" height="80" aria-label="Test Image" xlink:href="resources/cake.ong" />
+  <text x="150" y="130" fill="red">Test</text>  
+  <image x="20" y="20" width="300" height="80" aria-label="Test Image" xlink:href="resources/cake.png" />
 
 </svg>
 </div>
@@ -37,7 +37,7 @@ function pageY(element) {
 if (window.testRunner && window.accessibilityController) {
     window.testRunner.dumpAsText();
  
-    var container = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
+    var container = accessibilityController.accessibleElementById("svgroot");
 
     var x = pageX(container) - 1;
     var y = pageY(container) - 1;
@@ -69,13 +69,15 @@ if (window.testRunner && window.accessibilityController) {
     debug('Mouth role: ' + mouth.role);
     debug('Mouth label: ' + mouth.description);
     debug('MouthX: ' + (pageX(mouth) - x));
-    debug('MouthY: ' + Math.abs(pageY(mouth) - y));
+    debug('MouthY: ' + Math.floor(Math.abs(pageY(mouth) - y)));
     debug('<br>');
 
+    // Text varies by about 1 - 2 pixels depending on the platform,
+    // so just print the text coordinates divided by 10.
     var text = container.childAtIndex(5).childAtIndex(0);
     debug('Text role: ' + text.role);
-    debug('TextX: ' + (pageX(text) - x));
-    debug('TextY: ' + Math.abs(pageY(text) - y));
+    debug('TextX/10: ' + Math.floor((pageX(text) - x) / 10));
+    debug('TextY/10: ' + Math.floor(Math.abs(pageY(text) - y) / 10));
     debug('<br>');
 
     var image = container.childAtIndex(6);
index 2b955c1..53f4d88 100644 (file)
@@ -1,15 +1,10 @@
 
-
-
 This test ensures that accessibility elements can be created out of what a remote SVG image defines.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS successfullyParsed is true
-
-TEST COMPLETE
-container location: (7, 43)
+container location: (7, 7)
 Face role: AXRole: AXButton
 Face label: AXDescription: face
 FaceX: 0
@@ -31,7 +26,10 @@ NoseY: 206
 Mouth role: AXRole: AXButton
 Mouth label: AXDescription: smile
 MouthX: 115
-MouthY: 274.5
+MouthY: 275
+
 
+PASS successfullyParsed is true
 
+TEST COMPLETE
 
index 1a2d4c9..316f104 100644 (file)
@@ -3,14 +3,13 @@
 <body>
 <script src="../fast/js/resources/js-test-pre.js"></script>
 
-<br><br>
-
 <img tabindex="0" id="svg-image" src="resources/svg-face.svg" alt="interactive SVG" >
 
 <div id="console"></div>
 <script>
 
 description("This test ensures that accessibility elements can be created out of what a remote SVG image defines.")
+window.jsTestIsAsync = true;
 
 // Return the page's relative coordinates. If we rely on the x() or y() of the accessibility object, then
 // accessibility transforms are applied that fail because there is no window available
@@ -23,7 +22,6 @@ function pageY(element) {
 }
 
 if (window.accessibilityController) {
-    window.testRunner.waitUntilDone();
     document.getElementById("svg-image").addEventListener("load", runAXTest);
 }
 
@@ -60,10 +58,10 @@ function runAXTest() {
     debug('Mouth role: ' + mouth.role);
     debug('Mouth label: ' + mouth.description);
     debug('MouthX: ' + (pageX(mouth) - x));
-    debug('MouthY: ' + Math.abs(pageY(mouth) - y));
+    debug('MouthY: ' + Math.floor(Math.abs(pageY(mouth) - y)));
     debug('<br>');
 
-    window.testRunner.notifyDone();
+    finishJSTest();
 }
 
 </script>
index d0e4d31..f2e8ee8 100644 (file)
@@ -1434,7 +1434,6 @@ crbug.com/10322 accessibility/aria-combobox.html [ Skip ]
 crbug.com/10322 accessibility/aria-invalid.html [ Skip ]
 crbug.com/10322 accessibility/aria-menubar-menuitems.html [ Skip ]
 crbug.com/10322 accessibility/aria-tables.html [ Skip ]
-crbug.com/10322 accessibility/aria-text-role.html [ Skip ]
 crbug.com/10322 accessibility/aria-used-on-image-maps.html [ Skip ]
 crbug.com/10322 accessibility/deleting-iframe-destroys-axcache.html [ Skip ]
 crbug.com/10322 accessibility/document-attributes.html [ Skip ]
@@ -1442,7 +1441,6 @@ crbug.com/10322 accessibility/iframe-bastardization.html [ Skip ]
 crbug.com/10322 accessibility/image-map-update-parent-crash.html [ Skip ]
 crbug.com/10322 accessibility/image-map2.html [ Skip ]
 crbug.com/10322 accessibility/internal-link-anchors2.html [ Skip ]
-crbug.com/10322 accessibility/label-for-control-hittest.html [ Skip ]
 crbug.com/10322 accessibility/language-attribute.html [ Skip ]
 crbug.com/10322 accessibility/lists.html [ Skip ]
 crbug.com/10322 accessibility/media-element.html [ Skip ]
@@ -1460,8 +1458,6 @@ crbug.com/10322 accessibility/table-with-rules.html [ Skip ]
 crbug.com/10322 accessibility/transformed-element.html [ Skip ]
 crbug.com/10322 accessibility/visible-elements.html [ Skip ]
 
-webkit.org/b/97359 accessibility/svg-bounds.html [ Skip ]
-webkit.org/b/97359 accessibility/svg-remote-element.html [ Skip ]
 webkit.org/b/96529 accessibility/hidden-legend.html [ Skip ]
 webkit.org/b/73912 accessibility/aria-checkbox-text.html [ Skip ]
 webkit.org/b/99665 accessibility/loading-iframe-sends-notification.html [ Skip ]
diff --git a/LayoutTests/platform/mac/accessibility/svg-bounds-expected.txt b/LayoutTests/platform/mac/accessibility/svg-bounds-expected.txt
deleted file mode 100644 (file)
index 135710e..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-Test
-This test ensures the accessibility bounds of embedded SVG objects are correct.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-container location: (1007, 1007)
-Face role: AXRole: AXButton
-Face label: AXDescription: face
-FaceX: 0
-FaceY: 0
-
-
-Eye role: AXRole: AXButton
-Eye label: AXDescription: left-eye
-EyeX: 103
-EyeY: 148
-
-
-Nose role: AXRole: AXButton
-Nose label: AXDescription: nose
-NoseX: 193
-NoseY: 206
-
-
-Mouth role: AXRole: AXButton
-Mouth label: AXDescription: smile
-MouthX: 115
-MouthY: 275.5
-
-
-Text role: AXRole: AXStaticText
-TextX: 1.5
-TextY: 2
-
-
-Image role: AXRole: AXImage
-Image label: AXDescription: Test Image
-ImageX: 21
-ImageY: 21
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/LayoutTests/platform/mac/accessibility/svg-remote-element-expected.txt b/LayoutTests/platform/mac/accessibility/svg-remote-element-expected.txt
deleted file mode 100644 (file)
index 20bad0d..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-This test ensures that accessibility elements can be created out of what a remote SVG image defines.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-container location: (7, 43)
-Face role: AXRole: AXButton
-Face label: AXDescription: face
-FaceX: 0
-FaceY: 0
-
-
-Eye role: AXRole: AXButton
-Eye label: AXDescription: left-eye
-EyeX: 103
-EyeY: 148
-
-
-Nose role: AXRole: AXButton
-Nose label: AXDescription: nose
-NoseX: 193
-NoseY: 206
-
-
-Mouth role: AXRole: AXButton
-Mouth label: AXDescription: smile
-MouthX: 115
-MouthY: 275.5
-
-
-
index add4534..5aa1d5e 100644 (file)
@@ -1,3 +1,20 @@
+2012-12-20  Dominic Mazzoni  <dmazzoni@google.com>
+
+        AX: support clickPoint in DRT for chromium
+        https://bugs.webkit.org/show_bug.cgi?id=97359
+
+        Reviewed by Chris Fleizach.
+
+        When computing the accessible bounding box of an
+        SVG root, be sure to call a method that uses transforms,
+        otherwise an assertion fails.
+
+        Newly unskipped tests: accessibility/svg-bounds.html and
+        accessibility/svg-remote-element.html
+
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::boundingBoxRect):
+
 2012-12-20  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [Qt]REGRESSION(r138222): It made fast/forms/number/number-spinbutton-click-in-iframe.html crash
index 7aeab01..79307a4 100644 (file)
@@ -783,10 +783,16 @@ LayoutRect AccessibilityRenderObject::boundingBoxRect() const
     
     // absoluteFocusRingQuads will query the hierarchy below this element, which for large webpages can be very slow.
     // For a web area, which will have the most elements of any element, absoluteQuads should be used.
+    // We should also use absoluteQuads for SVG elements, otherwise transforms won't be applied.
     Vector<FloatQuad> quads;
+    bool isSVGRoot = false;
+#if ENABLE(SVG)
+    if (obj->isSVGRoot())
+        isSVGRoot = true;
+#endif
     if (obj->isText())
         toRenderText(obj)->absoluteQuads(quads, 0, RenderText::ClipToEllipsis);
-    else if (isWebArea() || isSeamlessWebArea())
+    else if (isWebArea() || isSeamlessWebArea() || isSVGRoot)
         obj->absoluteQuads(quads);
     else
         obj->absoluteFocusRingQuads(quads);
index 950da67..b9a097c 100644 (file)
@@ -1,3 +1,18 @@
+2012-12-20  Dominic Mazzoni  <dmazzoni@google.com>
+
+        AX: support clickPoint in DRT for chromium
+        https://bugs.webkit.org/show_bug.cgi?id=97359
+
+        Reviewed by Chris Fleizach.
+
+        Exposes the clickPoint accessibility method in WebAccessibilityObject.
+
+        * public/WebAccessibilityObject.h:
+        (WebAccessibilityObject):
+        * src/WebAccessibilityObject.cpp:
+        (WebKit::WebAccessibilityObject::clickPoint):
+        (WebKit):
+
 2012-12-19  Pavel Feldman  <pfeldman@chromium.org>
 
         Web Inspector: introduce Page.captureScreenshot
index 5bb5659..b77d108 100644 (file)
@@ -128,6 +128,7 @@ public:
     WEBKIT_EXPORT WebString ariaLiveRegionStatus() const;
     WEBKIT_EXPORT WebRect boundingBoxRect() const;
     WEBKIT_EXPORT bool canvasHasFallbackContent() const;
+    WEBKIT_EXPORT WebPoint clickPoint() const;
     WEBKIT_EXPORT double estimatedLoadingProgress() const;
     WEBKIT_EXPORT WebString helpText() const;
     WEBKIT_EXPORT int headingLevel() const;
index 6aaaab8..b920e4e 100644 (file)
@@ -490,6 +490,14 @@ bool WebAccessibilityObject::canvasHasFallbackContent() const
     return m_private->canvasHasFallbackContent();
 }
 
+WebPoint WebAccessibilityObject::clickPoint() const
+{
+    if (isDetached())
+        return WebPoint();
+
+    return WebPoint(m_private->clickPoint());
+}
+
 double WebAccessibilityObject::estimatedLoadingProgress() const
 {
     if (isDetached())
index 12cef6d..f2efaf5 100644 (file)
@@ -1,3 +1,22 @@
+2012-12-20  Dominic Mazzoni  <dmazzoni@google.com>
+
+        AX: support clickPoint in DRT for chromium
+        https://bugs.webkit.org/show_bug.cgi?id=97359
+
+        Reviewed by Chris Fleizach.
+
+        Implement clickPointX, clickPointY, and elementAtPoint for Chromium, so that
+        several more tests can pass.
+
+        * DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp:
+        (WebTestRunner::AccessibilityUIElement::AccessibilityUIElement):
+        (WebTestRunner::AccessibilityUIElement::clickPointXGetterCallback):
+        (WebTestRunner):
+        (WebTestRunner::AccessibilityUIElement::clickPointYGetterCallback):
+        (WebTestRunner::AccessibilityUIElement::elementAtPointCallback):
+        * DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h:
+        (AccessibilityUIElement):
+
 2012-12-20  Dan Bernstein  <mitz@apple.com>
 
         prepare-ChangeLog adds "Additional information of the change such as approach, rationale" where it doesn't make sense
index 1706481..b1a3808 100644 (file)
@@ -397,6 +397,8 @@ AccessibilityUIElement::AccessibilityUIElement(const WebAccessibilityObject& obj
     bindProperty("isValid", &AccessibilityUIElement::isValidGetterCallback);
     bindProperty("isReadOnly", &AccessibilityUIElement::isReadOnlyGetterCallback);
     bindProperty("orientation", &AccessibilityUIElement::orientationGetterCallback);
+    bindProperty("clickPointX", &AccessibilityUIElement::clickPointXGetterCallback);
+    bindProperty("clickPointY", &AccessibilityUIElement::clickPointYGetterCallback);
 
     //
     // Methods
@@ -648,6 +650,16 @@ void AccessibilityUIElement::orientationGetterCallback(CppVariant* result)
     result->set(getOrientation(accessibilityObject()));
 }
 
+void AccessibilityUIElement::clickPointXGetterCallback(CppVariant* result)
+{
+    result->set(accessibilityObject().clickPoint().x);
+}
+
+void AccessibilityUIElement::clickPointYGetterCallback(CppVariant* result)
+{
+    result->set(accessibilityObject().clickPoint().y);
+}
+
 //
 // Methods
 //
@@ -725,9 +737,21 @@ void AccessibilityUIElement::childAtIndexCallback(const CppArgumentList& argumen
     result->set(*(child->getAsCppVariant()));
 }
 
-void AccessibilityUIElement::elementAtPointCallback(const CppArgumentList&, CppVariant* result)
+void AccessibilityUIElement::elementAtPointCallback(const CppArgumentList& arguments, CppVariant* result)
 {
     result->setNull();
+
+    if (arguments.size() != 2 || !arguments[0].isNumber() || !arguments[1].isNumber())
+        return;
+
+    int x = arguments[0].toInt32();
+    int y = arguments[1].toInt32();
+    WebPoint point(x, y);
+    WebAccessibilityObject obj = accessibilityObject().hitTest(point);
+    if (obj.isNull())
+        return;
+
+    result->set(*(m_factory->getOrCreate(obj)->getAsCppVariant()));
 }
 
 void AccessibilityUIElement::attributesOfColumnHeadersCallback(const CppArgumentList&, CppVariant* result)
index 41586db..396aa70 100644 (file)
@@ -94,6 +94,8 @@ private:
     void isValidGetterCallback(CppVariant*);
     void isReadOnlyGetterCallback(CppVariant*);
     void orientationGetterCallback(CppVariant*);
+    void clickPointXGetterCallback(CppVariant*);
+    void clickPointYGetterCallback(CppVariant*);
 
     // Bound methods.
     void allAttributesCallback(const CppArgumentList&, CppVariant*);