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

Unified Diff: Source/core/accessibility/AXNodeObject.cpp

Issue 300223009: Implement basic parts of hit regions on canvas2d. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add isClipMode() and check bounding box Created 6 years, 6 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 | « Source/bindings/v8/Dictionary.cpp ('k') | Source/core/accessibility/AXObjectCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/accessibility/AXNodeObject.cpp
diff --git a/Source/core/accessibility/AXNodeObject.cpp b/Source/core/accessibility/AXNodeObject.cpp
index 6410e9cafdbb12241ee581154b6f6e2862e2affa..4493e97f5df1d84d8ac9050dbf84c97448617444 100644
--- a/Source/core/accessibility/AXNodeObject.cpp
+++ b/Source/core/accessibility/AXNodeObject.cpp
@@ -1247,7 +1247,27 @@ LayoutRect AXNodeObject::elementRect() const
if (!m_explicitElementRect.isEmpty())
return m_explicitElementRect;
- // AXNodeObjects have no mechanism yet to return a size or position.
+ // FIXME: If there are a lot of elements in the canvas, it will be inefficient.
+ // We can avoid the inefficient calculations by using AXComputedObjectAttributeCache.
+ if (node()->parentElement()->isInCanvasSubtree()) {
+ LayoutRect rect;
+
+ for (Node* child = node()->firstChild(); child; child = child->nextSibling()) {
+ if (child->isHTMLElement()) {
+ if (AXObject* obj = axObjectCache()->get(child)) {
+ if (rect.isEmpty())
+ rect = obj->elementRect();
+ else
+ rect.unite(obj->elementRect());
+ }
+ }
+ }
+
+ if (!rect.isEmpty())
+ return rect;
+ }
+
+ // If this object doesn't have an explicit element rect or computable from its children,
// For now, let's return the position of the ancestor that does have a position,
dmazzoni 2014/06/10 15:43:02 nit: lowercase 'f' since this is continuing the se
zino 2014/06/12 07:50:14 Done.
// and make it the width of that parent, and about the height of a line of text, so that it's clear the object is a child of the parent.
« no previous file with comments | « Source/bindings/v8/Dictionary.cpp ('k') | Source/core/accessibility/AXObjectCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698