Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1201)

Unified Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 23314002: drawSystemFocusRing should take canvas transformations into account. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Test canvas element instead of role when walking up parents Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/accessibility/draw-custom-focus-ring-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e7f3a93e108ad23d0994acf8117a5efe0c14f8fe 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());
+ 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->node() != canvas()) {
+ obj->setElementRect(elementRect);
+ obj = obj->parentObject();
+ }
}
}
}
« no previous file with comments | « LayoutTests/accessibility/draw-custom-focus-ring-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698