Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
index 176cb57349aa0181a3f4a62484fc8f7442b70e05..4bb85cfd2a22ae2dc249cde5f998767c37c6943e 100644 |
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
@@ -2385,10 +2385,24 @@ void CanvasRenderingContext2D::updateFocusRingAccessibility(const Path& path, El |
// location before it gets focus. |
if (AXObjectCache* axObjectCache = element->document()->existingAXObjectCache()) { |
if (AccessibilityObject* obj = axObjectCache->getOrCreate(element)) { |
+ // Get the bounding rect and apply transformations. |
+ FloatRect bounds = m_path.boundingRect(); |
+ AffineTransform ctm = state().m_transform; |
+ FloatRect transformedBounds = ctm.mapRect(bounds); |
+ LayoutRect elementRect = LayoutRect(transformedBounds); |
+ |
+ // Offset by the canvas rect and set the bounds of the accessible element. |
IntRect canvasRect = canvas()->renderer()->absoluteBoundingBoxRect(); |
- LayoutRect rect = LayoutRect(path.boundingRect()); |
- rect.moveBy(canvasRect.location()); |
- obj->setElementRect(rect); |
+ elementRect.moveBy(canvasRect.location()); |
Stephen White
2013/08/19 18:08:04
Not new to this patch, but I wonder if this handle
dmazzoni
2013/08/20 06:01:32
I wasn't sure, so I checked with a simple transfor
|
+ obj->setElementRect(elementRect); |
+ |
+ // Set the bounds of any ancestor accessible elements, up to the canvas element, |
+ // otherwise this element will appear to not be within its parent element. |
+ obj = obj->parentObject(); |
+ while (obj && !obj->isCanvas()) { |
Stephen White
2013/08/19 18:08:04
Shouldn't we actually compare against this canvas
dmazzoni
2013/08/20 06:01:32
Agreed, I wasn't thinking about those corner cases
|
+ obj->setElementRect(elementRect); |
+ obj = obj->parentObject(); |
+ } |
} |
} |
} |