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

Unified Diff: Source/web/WebAXObject.cpp

Issue 286143008: Make AX update layout on all frames (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More strict assert 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
« no previous file with comments | « Source/core/accessibility/AXObject.cpp ('k') | public/web/WebAXObject.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebAXObject.cpp
diff --git a/Source/web/WebAXObject.cpp b/Source/web/WebAXObject.cpp
index 76cfc642e7fb191ec2815693a7eaf17ce7106b69..e5d0e54774c41012a0fcdd8b1f8cd822b916cb7e 100644
--- a/Source/web/WebAXObject.cpp
+++ b/Source/web/WebAXObject.cpp
@@ -107,13 +107,24 @@ int WebAXObject::axID() const
return m_private->axObjectID();
}
-bool WebAXObject::updateBackingStoreAndCheckValidity()
+bool WebAXObject::updateLayoutAndCheckValidity()
{
- if (!isDetached())
- m_private->updateBackingStore();
+ if (!isDetached()) {
+ Document* document = m_private->document();
+ if (!document || !document->topDocument().view())
+ return false;
+ document->topDocument().view()->updateLayoutAndStyleIfNeededRecursive();
+ }
+
+ // Doing a layout can cause this object to be invalid, so check again.
return !isDetached();
}
+bool WebAXObject::updateBackingStoreAndCheckValidity()
+{
+ return updateLayoutAndCheckValidity();
+}
+
WebString WebAXObject::accessibilityDescription() const
{
if (isDetached())
@@ -533,14 +544,24 @@ bool WebAXObject::ariaOwns(WebVector<WebAXObject>& ownsElements) const
return true;
}
+#if ASSERT_ENABLED
+static bool isLayoutClean(Document* document)
+{
+ if (!document || !document->view())
+ return false;
+ return document->lifecycle().state() >= DocumentLifecycle::LayoutClean
+ || (document->lifecycle().state() == DocumentLifecycle::StyleClean && !document->view()->needsLayout());
+}
+#endif
+
WebRect WebAXObject::boundingBoxRect() const
{
if (isDetached())
return WebRect();
// It's not safe to call boundingBoxRect if a layout is pending.
- // Clients should call updateBackingStoreAndCheckValidity first.
- ASSERT(m_private->document() && m_private->document()->lifecycle().state() >= DocumentLifecycle::LayoutClean);
+ // Clients should call updateLayoutAndCheckValidity first.
+ ASSERT(isLayoutClean(m_private->document()));
return pixelSnappedIntRect(m_private->elementRect());
}
« no previous file with comments | « Source/core/accessibility/AXObject.cpp ('k') | public/web/WebAXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698