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

Issue 14740025: Simplify and add caching for accessible bounding box calculation. (Closed)

Created:
7 years, 7 months ago by dmazzoni
Modified:
7 years, 7 months ago
CC:
blink-reviews, dmazzoni, aboxhall
Visibility:
Public.

Description

Simplify and add caching for accessible bounding box calculation. There were several mostly-redundant methods to compute the bounding box rect of an accessible object. Simplified those all to just one, elementRect(), which returns the absolute-coordinate bounding box of the object in frame coordinates. Adds a system to cache the rect so that the computation of the absolute coordinates is really fast when it hasn't moved. Relies on the fact that a RenderBox has a frameRect in local coordinates that can be accessed directly; no computation is needed. Each AccessibleRenderObject caches its element rect and frame rect lazily, along with a flag indicating if they're dirty. If the frame rect changes, it invalidates all of its children (marks them as dirty). When querying the (global) element rect, it checks all of its parents - if none of them are dirty, it can use the cached element rect. I believe that the runtime to recompute the bounding rect of every element in the tree is O(n * d), where d is the depth. This is fine, lots of other accessibility code also requires a quick walk up the parent chain; there's no easy way around this. Perhaps we should rename elementRect and frameRect while we're at it? How about elementRect -> absoluteRect and frameRect -> localRect? BUG=222636 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=149754 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=149848

Patch Set 1 #

Total comments: 2

Patch Set 2 : Update comment #

Total comments: 6

Patch Set 3 : const -> mutable, fix broken scrollview test #

Patch Set 4 : Re-landing with null check fix #

Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -79 lines) Patch
M Source/WebKit/chromium/src/WebAccessibilityObject.cpp View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/accessibility/AccessibilityListBox.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/core/accessibility/AccessibilityListBoxOption.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M Source/core/accessibility/AccessibilityNodeObject.h View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M Source/core/accessibility/AccessibilityNodeObject.cpp View 1 2 2 chunks +1 line, -6 lines 0 comments Download
M Source/core/accessibility/AccessibilityObject.h View 1 2 2 chunks +6 lines, -8 lines 0 comments Download
M Source/core/accessibility/AccessibilityObject.cpp View 1 2 4 chunks +9 lines, -3 lines 0 comments Download
M Source/core/accessibility/AccessibilityRenderObject.h View 1 2 5 chunks +11 lines, -5 lines 0 comments Download
M Source/core/accessibility/AccessibilityRenderObject.cpp View 1 2 3 7 chunks +118 lines, -51 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
dmazzoni
aboxhall: primary review for accessibility code Julien: owners approval, and please double-check the logic for ...
7 years, 7 months ago (2013-05-02 20:34:54 UTC) #1
aboxhall
lgtm I did look over this more thoroughly than my single comment suggests... https://codereview.chromium.org/14740025/diff/1/Source/core/accessibility/AccessibilityRenderObject.h File ...
7 years, 7 months ago (2013-05-02 23:05:56 UTC) #2
dmazzoni
Thanks! https://codereview.chromium.org/14740025/diff/1/Source/core/accessibility/AccessibilityRenderObject.h File Source/core/accessibility/AccessibilityRenderObject.h (right): https://codereview.chromium.org/14740025/diff/1/Source/core/accessibility/AccessibilityRenderObject.h#newcode176 Source/core/accessibility/AccessibilityRenderObject.h:176: // Position and size. On 2013/05/02 23:05:56, aboxhall ...
7 years, 7 months ago (2013-05-02 23:13:56 UTC) #3
Julien - ping for review
LGTM but let's try to keep the constness though! https://codereview.chromium.org/14740025/diff/5001/Source/core/accessibility/AccessibilityRenderObject.cpp File Source/core/accessibility/AccessibilityRenderObject.cpp (right): https://codereview.chromium.org/14740025/diff/5001/Source/core/accessibility/AccessibilityRenderObject.cpp#newcode1546 Source/core/accessibility/AccessibilityRenderObject.cpp:1546: ...
7 years, 7 months ago (2013-05-03 20:54:20 UTC) #4
dmazzoni
+abarth for OWNERS review of Source/WebKit/chromium/src
7 years, 7 months ago (2013-05-06 04:57:05 UTC) #5
dmazzoni
https://codereview.chromium.org/14740025/diff/5001/Source/core/accessibility/AccessibilityRenderObject.cpp File Source/core/accessibility/AccessibilityRenderObject.cpp (right): https://codereview.chromium.org/14740025/diff/5001/Source/core/accessibility/AccessibilityRenderObject.cpp#newcode1546 Source/core/accessibility/AccessibilityRenderObject.cpp:1546: if (!m_cachedElementRectDirty) { On 2013/05/03 20:54:20, Julien Chaffraix wrote: ...
7 years, 7 months ago (2013-05-06 04:58:01 UTC) #6
abarth-chromium
chromium/src changes LGTM
7 years, 7 months ago (2013-05-06 17:14:03 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dmazzoni@chromium.org/14740025/17001
7 years, 7 months ago (2013-05-06 17:14:39 UTC) #8
commit-bot: I haz the power
Change committed as 149754
7 years, 7 months ago (2013-05-06 17:48:30 UTC) #9
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dmazzoni@chromium.org/14740025/28001
7 years, 7 months ago (2013-05-07 03:42:46 UTC) #10
commit-bot: I haz the power
7 years, 7 months ago (2013-05-07 04:35:53 UTC) #11
Message was sent while issue was closed.
Change committed as 149848

Powered by Google App Engine
This is Rietveld 408576698