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

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

Issue 299823003: Enable canvas.drawFocusIfNeeded() by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove test Created 6 years, 7 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
Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
index 8456aba1db2b4de549857a809bf166dec4e1618a..2e12eb2fa50f01cdf05e94a2c84fb2cd98ef08b0 100644
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp
@@ -2281,7 +2281,6 @@ void CanvasRenderingContext2D::drawFocusIfNeededInternal(const Path& path, Eleme
if (!focusRingCallIsValid(path, element))
return;
- updateFocusRingAccessibility(path, element);
// Note: we need to check document->focusedElement() rather than just calling
// element->focused(), because element->focused() isn't updated until after
// focus events fire.
@@ -2294,8 +2293,6 @@ bool CanvasRenderingContext2D::drawCustomFocusRing(Element* element)
if (!focusRingCallIsValid(m_path, element))
return false;
- updateFocusRingAccessibility(m_path, element);
-
// Return true if the application should draw the focus ring. The spec allows us to
// override this for accessibility, but currently Blink doesn't take advantage of this.
return element->focused();
@@ -2314,39 +2311,6 @@ bool CanvasRenderingContext2D::focusRingCallIsValid(const Path& path, Element* e
return true;
}
-void CanvasRenderingContext2D::updateFocusRingAccessibility(const Path& path, Element* element)
-{
- if (!canvas()->renderer())
- return;
-
- // If accessibility is already enabled in this frame, associate this path's
- // bounding box with the accessible object. Do this even if the element
- // isn't focused because assistive technology might try to explore the object's
- // location before it gets focus.
- if (AXObjectCache* axObjectCache = element->document().existingAXObjectCache()) {
- if (AXObject* obj = axObjectCache->getOrCreate(element)) {
- // Get the bounding rect and apply transformations.
- FloatRect bounds = 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();
- 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();
- }
- }
- }
-}
-
void CanvasRenderingContext2D::drawFocusRing(const Path& path)
{
GraphicsContext* c = drawingContext();
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698