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

Issue 14863002: Only update composited-scrolling state once after layout. (Closed)

Created:
7 years, 7 months ago by Ian Vollick
Modified:
7 years, 6 months ago
CC:
blink-reviews, jchaffraix+rendering, jamesr
Visibility:
Public.

Description

Only update composited-scrolling state once after layout. Before this patch, we would noisily update needs-composited-scrolling and related state. This allowed for complex sequences of dirtying/cleaning and guaranteeing correctness became difficult. With this patch, we update state in only one spot: after layout (and before RLC::updateCompositingLayers). We used to have a member, m_hasOutOfFlowPositionedDescendant, which, despite its name, was only true if we had an out of flow positioned descendant whose containing block was an ancestor of ours (and therefore does not respect our clip). This was confusing. We now maintain m_hasUnclippedDescendant to capture this concept. That said, it turns out that we *do* still need m_hasOutOfFlowPositionedDescendant, but we need it to mean exactly what it says: the layer has an out of flow descendant anywhere in its subtree, regardless of where the descendant's containing block is. I apologize for the confusion this will cause when reviewing this patch, but I think the new names make a lot more sense. Consolidating the composited scrolling updates has a nice side effect: we no longer need to check for 'unclipped' descendants as part of computing the descendant dependent flags, greatly simplifying updateDescendantDependent flags. Instead, we compute m_hasUnclippedDescendant dynamically in RenderLayerCompositor::updateCompositingRequirementsState. At this point, we should talk about the complexity of the updates performed by the RLC. It needs to update m_hasUnclippedDescendant, m_descendantsAreContiguousInStackingOrder and m_needsCompositedScrolling, and we've done our best to minimize the work done to accomplish these updates. To update m_hasUnclippedDescendant, we march up from every out-of-flow positioned layer towards its containing block marking every layer along the way as having an unclipped descendant. In the worst case (every leaf is out-of-flow positioned and has the root as its containing block and the tree is linear), this is O(n^2) in the size of the tree, but in practice, we do much better; layers are typically close to their containing blocks and we rarely traverse the same RenderLayers twice. We only care about updating m_needsCompositedScrolling and m_descendantsAreContiguousInStackingOrder for scrollable layers, so we simply iterate over the FrameView's collection of scrollable areas and call updateNeedsCompositedScrolling, which in turn updates the contiguity state if necessary. This is O(s) where s is the sum of the sizes of the stacking contexts inhabited by the scrollable layers. Again, this can be quite large, but in practice tends to be reasonable. You should really look at the next patch for accurate timing numbers as we intend to replace our contiguity check: https://codereview.chromium.org/13427009/ But for interest's sake, here are some performance numbers gathered on alex. 1. g+ photos. I scrolled down continuously for 46.9s letting the infinite scroll kick in. - We spent 118.2ms doing our updates (On average, 0.24ms per layout). 2. gmail. I loaded the page and scrolled. - We spent 18ms doing our updates (On average, 0.2ms per layout). 3. squished presidents: loaded page. - We spent 43.6ms doing our updates. - Note we only did two updates, but each of these was immediately followed by a commensurately longer computeCompositingRequirements. This is part of a larger plan to finish the opt-in checks. Here's the aggregate patch (it's getting stale, so YMMV): https://codereview.chromium.org/14741004/. Also, this is the second patch in the series. This patch depends on https://codereview.chromium.org/14858004/ R=jchaffraix@chromium.org BUG= Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=151497

Patch Set 1 #

Patch Set 2 : Adding TRACE_EVENTs to track the cost of the comp-scroll updates. #

Patch Set 3 : Added early out of comp-scroll update when the setting isn't enabled. #

Patch Set 4 : Optimized. #

Total comments: 11

Patch Set 5 : Address reviewer comments. #

Total comments: 10

Patch Set 6 : Rebase. #

Patch Set 7 : . #

Total comments: 9

Patch Set 8 : subtreeHasOutOfFlowPositionedDescendant -> subtreeContainsOutOfFlowPositionedLayer #

Total comments: 4

Patch Set 9 : . #

Patch Set 10 : rebase #

Patch Set 11 : updating expectations. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+858 lines, -148 lines) Patch
A LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html View 1 2 3 4 5 6 9 1 chunk +102 lines, -0 lines 0 comments Download
A LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors-expected.txt View 1 2 3 4 5 6 7 8 9 1 chunk +525 lines, -0 lines 0 comments Download
M LayoutTests/compositing/overflow/resources/automatically-opt-into-composited-scrolling.js View 1 2 3 4 5 2 chunks +6 lines, -0 lines 0 comments Download
M LayoutTests/compositing/overflow/resources/build-paint-order-lists.js View 1 2 3 4 5 1 chunk +3 lines, -0 lines 0 comments Download
M LayoutTests/virtual/gpu/compositedscrolling/overflow/content-gains-scrollbars-expected.txt View 1 2 3 4 5 6 7 8 9 10 3 chunks +17 lines, -5 lines 0 comments Download
M LayoutTests/virtual/gpu/compositedscrolling/overflow/overflow-scrollbar-layers-expected.txt View 1 2 3 4 5 6 7 8 9 10 3 chunks +17 lines, -5 lines 0 comments Download
M Source/core/page/FrameView.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/platform/ScrollableArea.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -0 lines 0 comments Download
M Source/core/rendering/RenderLayer.h View 1 2 3 4 5 6 7 8 9 6 chunks +21 lines, -13 lines 0 comments Download
M Source/core/rendering/RenderLayer.cpp View 1 2 3 4 5 6 7 8 9 22 chunks +118 lines, -124 lines 0 comments Download
M Source/core/rendering/RenderLayerCompositor.h View 1 2 3 4 5 6 7 8 9 4 chunks +13 lines, -1 line 0 comments Download
M Source/core/rendering/RenderLayerCompositor.cpp View 1 2 3 4 5 6 7 8 9 3 chunks +34 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
Ian Vollick
7 years, 7 months ago (2013-05-02 16:29:48 UTC) #1
Ian Vollick
I think this is ready for a review. PTAL!
7 years, 7 months ago (2013-05-03 15:42:35 UTC) #2
Julien - ping for review
Some early comments, I haven't had time to digest the change but will take another ...
7 years, 7 months ago (2013-05-03 21:15:13 UTC) #3
Ian Vollick
https://codereview.chromium.org/14863002/diff/17009/Source/core/rendering/RenderLayer.cpp File Source/core/rendering/RenderLayer.cpp (left): https://codereview.chromium.org/14863002/diff/17009/Source/core/rendering/RenderLayer.cpp#oldcode569 Source/core/rendering/RenderLayer.cpp:569: ASSERT(!m_zOrderListsDirty); On 2013/05/03 21:15:13, Julien Chaffraix wrote: > It's ...
7 years, 7 months ago (2013-05-04 03:33:00 UTC) #4
Ian Vollick
Thanks for this review! > Whoa! Yeah, it's backwards. The typo'd ASSERT was never tripped ...
7 years, 7 months ago (2013-05-04 11:36:53 UTC) #5
Julien - ping for review
https://codereview.chromium.org/14863002/diff/24001/LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html File LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html (right): https://codereview.chromium.org/14863002/diff/24001/LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html#newcode1 LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html:1: <!-- PATCH 2 --> ??? https://codereview.chromium.org/14863002/diff/24001/LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html#newcode30 LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html:30: window.testRunner.dumpAsText(); The ...
7 years, 7 months ago (2013-05-06 22:38:25 UTC) #6
esprehn
I'll review later today.
7 years, 7 months ago (2013-05-06 22:46:53 UTC) #7
Ian Vollick
Thanks again for the review. Comments have been addressed, PTAL. https://codereview.chromium.org/14863002/diff/24001/LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html File LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html (right): https://codereview.chromium.org/14863002/diff/24001/LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html#newcode1 ...
7 years, 7 months ago (2013-05-08 16:00:07 UTC) #8
esprehn
Couple nits, looks pretty good. https://codereview.chromium.org/14863002/diff/34001/Source/core/rendering/RenderLayer.cpp File Source/core/rendering/RenderLayer.cpp (right): https://codereview.chromium.org/14863002/diff/34001/Source/core/rendering/RenderLayer.cpp#newcode496 Source/core/rendering/RenderLayer.cpp:496: layer->m_hasOutOfFlowPositionedDescendantDirty = false; This ...
7 years, 7 months ago (2013-05-08 21:56:40 UTC) #9
Ian Vollick
https://codereview.chromium.org/14863002/diff/34001/Source/core/rendering/RenderLayer.cpp File Source/core/rendering/RenderLayer.cpp (right): https://codereview.chromium.org/14863002/diff/34001/Source/core/rendering/RenderLayer.cpp#newcode496 Source/core/rendering/RenderLayer.cpp:496: layer->m_hasOutOfFlowPositionedDescendantDirty = false; On 2013/05/08 21:56:40, esprehn wrote: > ...
7 years, 7 months ago (2013-05-09 01:27:42 UTC) #10
Julien - ping for review
LGTM https://codereview.chromium.org/14863002/diff/43001/LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html File LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html (right): https://codereview.chromium.org/14863002/diff/43001/LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html#newcode30 LayoutTests/compositing/overflow/out-of-flow-pos-descendants-should-affect-all-ancestors.html:30: // by which layers opt-in. Ideally this should ...
7 years, 7 months ago (2013-05-09 23:26:41 UTC) #11
esprehn
Are you still planning to try to land this?
7 years, 7 months ago (2013-05-24 02:26:40 UTC) #12
Ian Vollick
On 2013/05/24 02:26:40, esprehn wrote: > Are you still planning to try to land this? ...
7 years, 7 months ago (2013-05-24 13:35:09 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/vollick@chromium.org/14863002/66001
7 years, 6 months ago (2013-05-30 12:30:35 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/vollick@chromium.org/14863002/74001
7 years, 6 months ago (2013-05-30 13:33:29 UTC) #15
commit-bot: I haz the power
Retried try job too often on win_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_layout_rel&number=7785
7 years, 6 months ago (2013-05-30 16:29:35 UTC) #16
Ian Vollick
7 years, 6 months ago (2013-05-30 17:33:58 UTC) #17
Message was sent while issue was closed.
Committed patchset #11 manually as r151497 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698