Commit d091cc20 authored by dmazzoni's avatar dmazzoni Committed by Commit bot

Bypass cached element rects in AXLayoutObject.

AXLayoutObject has code to cache the computed bounding box of an element
because the computation can be expensive. However, it has a bug in that
the cache doesn't get properly invalidated when an object's position changes
due to only a CSS transformation.

This is resulting in a serious user issue on Android (b/28988142) so
this patch just temporarily removes the element rect caching. This will
unfortunately impact performance, some pages will load more slowly when
accessibility is enabled.

I've been working on a better longer-term fix for many months - storing
relative bounding boxes and transformation matrixes instead. It's much
faster to compute those and doesn't require any caching to be fast.
Unfortuantely it looks like we need to trade performance for correctness
in the short term because there isn't a trivial fix to make the cache
work.

BUG=629439

Review-Url: https://codereview.chromium.org/2168663002
Cr-Commit-Position: refs/heads/master@{#406663}
parent 4ca26c82
...@@ -201,21 +201,10 @@ LayoutRect AXLayoutObject::elementRect() const ...@@ -201,21 +201,10 @@ LayoutRect AXLayoutObject::elementRect() const
{ {
if (!m_explicitElementRect.isEmpty()) if (!m_explicitElementRect.isEmpty())
return m_explicitElementRect; return m_explicitElementRect;
if (!m_layoutObject)
return LayoutRect();
if (!m_layoutObject->isBox())
return computeElementRect();
for (const AXObject* obj = this; obj; obj = obj->parentObject()) {
if (obj->isAXLayoutObject())
toAXLayoutObject(obj)->checkCachedElementRect();
}
for (const AXObject* obj = this; obj; obj = obj->parentObject()) {
if (obj->isAXLayoutObject())
toAXLayoutObject(obj)->updateCachedElementRect();
}
return m_cachedElementRect; // FIXME(dmazzoni): use relative bounds instead since this is a bottleneck.
// http://crbug.com/618120
return computeElementRect();
} }
SkMatrix44 AXLayoutObject::transformFromLocalParentFrame() const SkMatrix44 AXLayoutObject::transformFromLocalParentFrame() const
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment