Title: [129254] trunk
Revision
129254
Author
[email protected]
Date
2012-09-21 14:27:22 -0700 (Fri, 21 Sep 2012)

Log Message

Source/WebCore: AX: WebKit exposes incorrect bounds for embedded SVG in HTML
https://bugs.webkit.org/show_bug.cgi?id=96168

Reviewed by Eric Seidel.

Override absoluteFocusRingQuads() for SVG objects because the default
implementation relies on addFocusRingRects(). In addFocusRingRects(), SVG 
objects adds local positions for its rects instead of absolute positions.

Test: accessibility/svg-bounds.html

* rendering/RenderObject.h:
(RenderObject):
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore):
(WebCore::RenderSVGModelObject::absoluteFocusRingQuads):
* rendering/svg/RenderSVGModelObject.h:
(RenderSVGModelObject):

LayoutTests: WebKit exposes incorrect bounds for embedded SVG in HTML
https://bugs.webkit.org/show_bug.cgi?id=96168

Reviewed by Eric Seidel.

* accessibility/svg-bounds.html: Added.
* platform/chromium/TestExpectations:
* platform/mac/accessibility/svg-bounds-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (129253 => 129254)


--- trunk/LayoutTests/ChangeLog	2012-09-21 21:24:17 UTC (rev 129253)
+++ trunk/LayoutTests/ChangeLog	2012-09-21 21:27:22 UTC (rev 129254)
@@ -1,3 +1,14 @@
+2012-09-21  Chris Fleizach  <[email protected]>
+
+        WebKit exposes incorrect bounds for embedded SVG in HTML
+        https://bugs.webkit.org/show_bug.cgi?id=96168
+
+        Reviewed by Eric Seidel.
+
+        * accessibility/svg-bounds.html: Added.
+        * platform/chromium/TestExpectations:
+        * platform/mac/accessibility/svg-bounds-expected.txt: Added.
+
 2012-09-21  Benjamin Poulain  <[email protected]>
 
         [WK2] Add basic testing support for Geolocation

Added: trunk/LayoutTests/accessibility/svg-bounds.html (0 => 129254)


--- trunk/LayoutTests/accessibility/svg-bounds.html	                        (rev 0)
+++ trunk/LayoutTests/accessibility/svg-bounds.html	2012-09-21 21:27:22 UTC (rev 129254)
@@ -0,0 +1,93 @@
+<!DOCTYPE HTML>
+<html>
+<body>
+<script src=""
+
+<div id="container" style="position: relative; top: 1000px; left: 1000px; width:400px; height: 400px;" role="group" tabindex="0">
+
+<svg>
+
+  <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="" />
+
+</svg>
+</div>
+
+
+<div id="console"></div>
+<script>
+
+description("This test ensures the accessibility bounds of embedded SVG objects are correct.")
+
+// 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
+function pageX(element) {
+    return element.clickPointX - element.width/2;
+}
+
+function pageY(element) {
+    return element.clickPointY - element.height/2;
+}
+
+if (window.testRunner && window.accessibilityController) {
+    window.testRunner.dumpAsText();
+ 
+    var container = accessibilityController.rootElement.childAtIndex(0).childAtIndex(0);
+
+    var x = pageX(container) - 1;
+    var y = pageY(container) - 1;
+
+    debug("container location: (" + x + ", " + y + ")");
+
+    var face = container.childAtIndex(0);
+    debug('Face role: ' + face.role);
+    debug('Face label: ' + face.description);
+    debug('FaceX: ' + (pageX(face) - x));
+    debug('FaceY: ' + Math.abs(pageY(face) - y));
+    debug('<br>');
+
+    var eye = container.childAtIndex(1);
+    debug('Eye role: ' + eye.role);
+    debug('Eye label: ' + eye.description);
+    debug('EyeX: ' + (pageX(eye) - x));
+    debug('EyeY: ' + Math.abs(pageY(eye) - y));
+    debug('<br>');
+
+    var nose = container.childAtIndex(3);
+    debug('Nose role: ' + nose.role);
+    debug('Nose label: ' + nose.description);
+    debug('NoseX: ' + (pageX(nose) - x));
+    debug('NoseY: ' + Math.abs(pageY(nose) - y));
+    debug('<br>');
+
+    var mouth = container.childAtIndex(4);
+    debug('Mouth role: ' + mouth.role);
+    debug('Mouth label: ' + mouth.description);
+    debug('MouthX: ' + (pageX(mouth) - x));
+    debug('MouthY: ' + Math.abs(pageY(mouth) - y));
+    debug('<br>');
+
+    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('<br>');
+
+    var image = container.childAtIndex(6);
+    debug('Image role: ' + image.role);
+    debug('Image label: ' + image.description);
+    debug('ImageX: ' + (pageX(image) - x));
+    debug('ImageY: ' + Math.abs(pageY(image) - y));
+}
+
+</script>
+
+<script src=""
+</body>
+</html>
+

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (129253 => 129254)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-21 21:24:17 UTC (rev 129253)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-21 21:27:22 UTC (rev 129254)
@@ -1393,6 +1393,7 @@
 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/73912 accessibility/aria-checkbox-text.html [ Skip ]
 
 webkit.org/b/73912 accessibility/aria-checkbox-sends-notification.html [ Failure Pass ]

Added: trunk/LayoutTests/platform/mac/accessibility/svg-bounds-expected.txt (0 => 129254)


--- trunk/LayoutTests/platform/mac/accessibility/svg-bounds-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/svg-bounds-expected.txt	2012-09-21 21:27:22 UTC (rev 129254)
@@ -0,0 +1,44 @@
+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: 274.5
+
+
+Text role: AXRole: AXStaticText
+TextX: 0.5
+TextY: 2
+
+
+Image role: AXRole: AXImage
+Image label: AXDescription: Test Image
+ImageX: 21
+ImageY: 21
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/Source/WebCore/ChangeLog (129253 => 129254)


--- trunk/Source/WebCore/ChangeLog	2012-09-21 21:24:17 UTC (rev 129253)
+++ trunk/Source/WebCore/ChangeLog	2012-09-21 21:27:22 UTC (rev 129254)
@@ -1,3 +1,24 @@
+2012-09-21  Chris Fleizach  <[email protected]>
+
+        AX: WebKit exposes incorrect bounds for embedded SVG in HTML
+        https://bugs.webkit.org/show_bug.cgi?id=96168
+
+        Reviewed by Eric Seidel.
+
+        Override absoluteFocusRingQuads() for SVG objects because the default
+        implementation relies on addFocusRingRects(). In addFocusRingRects(), SVG 
+        objects adds local positions for its rects instead of absolute positions.
+
+        Test: accessibility/svg-bounds.html
+
+        * rendering/RenderObject.h:
+        (RenderObject):
+        * rendering/svg/RenderSVGModelObject.cpp:
+        (WebCore):
+        (WebCore::RenderSVGModelObject::absoluteFocusRingQuads):
+        * rendering/svg/RenderSVGModelObject.h:
+        (RenderSVGModelObject):
+
 2012-09-21  Lianghui Chen  <[email protected]>
 
         [BlackBerry] Really fix bug 95488 that user can get the authentication challenge dialog while the other tab has focus.

Modified: trunk/Source/WebCore/rendering/RenderObject.h (129253 => 129254)


--- trunk/Source/WebCore/rendering/RenderObject.h	2012-09-21 21:24:17 UTC (rev 129253)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2012-09-21 21:27:22 UTC (rev 129254)
@@ -724,7 +724,7 @@
     // Build an array of quads in absolute coords for line boxes
     virtual void absoluteQuads(Vector<FloatQuad>&, bool* /*wasFixed*/ = 0) const { }
 
-    void absoluteFocusRingQuads(Vector<FloatQuad>&);
+    virtual void absoluteFocusRingQuads(Vector<FloatQuad>&);
 
     static FloatRect absoluteBoundingBoxRectForRange(const Range*);
 

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp (129253 => 129254)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2012-09-21 21:24:17 UTC (rev 129253)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.cpp	2012-09-21 21:27:22 UTC (rev 129254)
@@ -164,6 +164,13 @@
     return renderer->isSVGShape() || renderer->isSVGText() || renderer->isSVGImage() || renderer->node()->hasTagName(SVGNames::useTag);
 }
 
+// The SVG addFocusRingRects() method adds rects in local coordinates so the default absoluteFocusRingQuads
+// returns incorrect values for SVG objects. Overriding this method provides access to the absolute bounds.
+void RenderSVGModelObject::absoluteFocusRingQuads(Vector<FloatQuad>& quads)
+{
+    quads.append(localToAbsoluteQuad(FloatQuad(repaintRectInLocalCoordinates())));
+}
+    
 bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const FloatRect& rect)
 {
     if (!renderer || renderer->style()->pointerEvents() == PE_NONE)

Modified: trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h (129253 => 129254)


--- trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h	2012-09-21 21:24:17 UTC (rev 129253)
+++ trunk/Source/WebCore/rendering/svg/RenderSVGModelObject.h	2012-09-21 21:27:22 UTC (rev 129254)
@@ -72,6 +72,7 @@
 private:
     // This method should never be called, SVG uses a different nodeAtPoint method
     bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
+    virtual void absoluteFocusRingQuads(Vector<FloatQuad>&);
 };
 
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to