Commit f2c84846 authored by cfleizach@apple.com's avatar cfleizach@apple.com
Browse files

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@129254 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 04e047f0
2012-09-21 Chris Fleizach <cfleizach@apple.com>
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 <bpoulain@apple.com> 2012-09-21 Benjamin Poulain <bpoulain@apple.com>
   
[WK2] Add basic testing support for Geolocation [WK2] Add basic testing support for Geolocation
<!DOCTYPE HTML>
<html>
<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">
<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="resources/cake.ong" />
</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="../fast/js/resources/js-test-post.js"></script>
</body>
</html>
...@@ -1393,6 +1393,7 @@ crbug.com/10322 accessibility/th-as-title-ui.html [ Skip ] ...@@ -1393,6 +1393,7 @@ crbug.com/10322 accessibility/th-as-title-ui.html [ Skip ]
crbug.com/10322 accessibility/transformed-element.html [ Skip ] crbug.com/10322 accessibility/transformed-element.html [ Skip ]
crbug.com/10322 accessibility/visible-elements.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-text.html [ Skip ]
webkit.org/b/73912 accessibility/aria-checkbox-sends-notification.html [ Failure Pass ] webkit.org/b/73912 accessibility/aria-checkbox-sends-notification.html [ Failure Pass ]
......
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
2012-09-21 Chris Fleizach <cfleizach@apple.com>
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 <liachen@rim.com> 2012-09-21 Lianghui Chen <liachen@rim.com>
   
[BlackBerry] Really fix bug 95488 that user can get the authentication challenge dialog while the other tab has focus. [BlackBerry] Really fix bug 95488 that user can get the authentication challenge dialog while the other tab has focus.
...@@ -724,7 +724,7 @@ public: ...@@ -724,7 +724,7 @@ public:
// Build an array of quads in absolute coords for line boxes // Build an array of quads in absolute coords for line boxes
virtual void absoluteQuads(Vector<FloatQuad>&, bool* /*wasFixed*/ = 0) const { } virtual void absoluteQuads(Vector<FloatQuad>&, bool* /*wasFixed*/ = 0) const { }
void absoluteFocusRingQuads(Vector<FloatQuad>&); virtual void absoluteFocusRingQuads(Vector<FloatQuad>&);
static FloatRect absoluteBoundingBoxRectForRange(const Range*); static FloatRect absoluteBoundingBoxRectForRange(const Range*);
......
...@@ -164,6 +164,13 @@ static bool isGraphicsElement(RenderObject* renderer) ...@@ -164,6 +164,13 @@ static bool isGraphicsElement(RenderObject* renderer)
return renderer->isSVGShape() || renderer->isSVGText() || renderer->isSVGImage() || renderer->node()->hasTagName(SVGNames::useTag); 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) bool RenderSVGModelObject::checkIntersection(RenderObject* renderer, const FloatRect& rect)
{ {
if (!renderer || renderer->style()->pointerEvents() == PE_NONE) if (!renderer || renderer->style()->pointerEvents() == PE_NONE)
......
...@@ -72,6 +72,7 @@ protected: ...@@ -72,6 +72,7 @@ protected:
private: private:
// This method should never be called, SVG uses a different nodeAtPoint method // 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; bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
virtual void absoluteFocusRingQuads(Vector<FloatQuad>&);
}; };
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment