Index: Source/web/WebAXObject.cpp |
diff --git a/Source/web/WebAXObject.cpp b/Source/web/WebAXObject.cpp |
index 76cfc642e7fb191ec2815693a7eaf17ce7106b69..9dcc582237e9d7e12fdb4ce0bed8e73377f3b95d 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()); |
esprehn
2014/05/19 22:13:19
This isn't correct, InPreLayout is >= StyleClean,
dmazzoni
2014/05/20 18:33:52
Done: == StyleClean works.
|
+} |
+#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()); |
} |