| 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());
|
| }
|
|
|