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

Issue 548963002: Generalize scroll parent work in CalculateDrawProperties

Created:
6 years, 3 months ago by Ian Vollick
Modified:
6 years, 2 months ago
Reviewers:
danakj
CC:
cc-bugs_chromium.org, chromium-reviews
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Generalize scroll parent work in CalculateDrawProperties Previously, CDP would fail if the scroll child wasn't the immediate descendant of the lowest common ancestor of the scroll parent and child. With this patch I've fixed up two things so that CDP can handle these cases. 1. Dumber sorting. I've made sorting simpler by removing assumptions about the tree topology. Instead, I assigned "sort weights" to the layers in PreCalculateMetaInformation. The approach is pretty naive. As I walk the tree I assign a monotonically increasing weight. If I ever hit a scroll child before its parent, I jump up to the lowest common ancestor and make sure that the child of the LCA is assigned the smallest weight in the tree so far (the negative of the next monotonically increasing weight). This ensures that the scroll parent will be visited first. Here's a picture of a layer tree and the weights that would be assigned. lca(0) + filler(1) | + scroll child(2) + more-filler(-3) + scroll parent(4) It would be a huge bummer if we had to sort all the time, though, so I've taken care to flag the LCA if I ever have to assign a negative weight so that we only sort in that case. Here's my argument for the correctness of the algorithm. Clearly, we force correct ordering of a particular scroll child/parent pair, but the worry is that by setting a negative weight, we'll force an illegal ordering (i.e., we'll "undo" an ordering we've forced earlier in the algorithm). Here's a diagram. lca + subtree with scroll parent #1 + subtree with scroll child #1 and scroll_parent #2 + subtree with scroll child #2. Now, say we're processing scroll child #2. We want to be sure that we don't go reordering subtrees and mess up the relative ordering of scroll child #1 and scroll parent #1's subtrees. But we know that this is impossible. Since we've already visited the subtree with scroll child #1, scroll child #2 will necessarily get a higher sort weight, so we'll never need to force any reordering in this case; we won't assign any negative weights here. Say the ordering were changed such that when processing scroll child #2, we haven't seen scroll child #1's subtree. We're also fine in this case because we will do any ordering fixups required when we do eventually visit scroll child #1. The only case where we get into trouble is when we have a cycle. For example, lca + scroll parent 1 | + scroll child 2 + scroll parent 2 + scroll child 1 No ordering could satisfy a situation with a cycle, but this is an impossible situation as CSS stacking defines a well defined, non circular order. 2. Proper clip transformations. We sometimes need to put the scroll parent's clip into the space of the scroll child's immediate parent. This needs to go through the LCA. Previously, we'd assumed that the LCA was going to be the scroll child's immediate parent, but we no longer make that assumption. We made a similar assumption for clip children that we also had to generalize BUG=403866, 424064 > Was previously landed but reverted. NB - it was reverted because it > exposed an unrelated bug, the bug was not with the patch itself. > Committed: https://crrev.com/7faedca87705b714845842e595bca262c4090fa4 > Cr-Commit-Position: refs/heads/master@{#294521}

Patch Set 1 #

Patch Set 2 : Updated logic and added a test. #

Patch Set 3 : Updated comments. #

Total comments: 22

Patch Set 4 : . #

Total comments: 12

Patch Set 5 : . #

Total comments: 2

Patch Set 6 : Fix unit tests #

Patch Set 7 : Generalizes clip transforms for clip children #

Patch Set 8 : . #

Patch Set 9 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+874 lines, -141 lines) Patch
M cc/layers/draw_properties.h View 1 2 3 4 5 6 4 chunks +30 lines, -13 lines 0 comments Download
M cc/trees/layer_tree_host.h View 1 2 3 4 5 6 1 chunk +4 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host.cc View 1 2 3 4 5 6 3 chunks +4 lines, -6 lines 0 comments Download
M cc/trees/layer_tree_host_common.h View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M cc/trees/layer_tree_host_common.cc View 1 2 3 4 5 6 7 8 13 chunks +287 lines, -116 lines 0 comments Download
M cc/trees/layer_tree_host_common_unittest.cc View 1 2 3 4 5 6 7 6 chunks +547 lines, -4 lines 0 comments Download

Messages

Total messages: 27 (5 generated)
Ian Vollick
6 years, 3 months ago (2014-09-08 04:19:56 UTC) #2
danakj
lca + subtree with scroll child #2. + subtree with scroll child #1 and scroll_parent ...
6 years, 3 months ago (2014-09-09 19:02:31 UTC) #3
Ian Vollick
On 2014/09/09 19:02:31, danakj wrote: > lca > + subtree with scroll child #2. > ...
6 years, 3 months ago (2014-09-09 19:17:31 UTC) #4
danakj
On 2014/09/09 19:17:31, vollick wrote: > On 2014/09/09 19:02:31, danakj wrote: > > lca > ...
6 years, 3 months ago (2014-09-09 19:21:20 UTC) #5
Ian Vollick
On 2014/09/09 19:21:20, danakj wrote: > On 2014/09/09 19:17:31, vollick wrote: > > On 2014/09/09 ...
6 years, 3 months ago (2014-09-09 19:37:16 UTC) #6
danakj
https://codereview.chromium.org/548963002/diff/40001/cc/layers/draw_properties.h File cc/layers/draw_properties.h (right): https://codereview.chromium.org/548963002/diff/40001/cc/layers/draw_properties.h#newcode152 cc/layers/draw_properties.h:152: // Determines the order the layer should be processed ...
6 years, 3 months ago (2014-09-10 18:20:47 UTC) #7
danakj
> Generalize scroll parent work in CDP Please no acronyms in the patch title/description without ...
6 years, 3 months ago (2014-09-10 18:21:05 UTC) #8
Ian Vollick
Thanks for the review! https://codereview.chromium.org/548963002/diff/40001/cc/layers/draw_properties.h File cc/layers/draw_properties.h (right): https://codereview.chromium.org/548963002/diff/40001/cc/layers/draw_properties.h#newcode152 cc/layers/draw_properties.h:152: // Determines the order the ...
6 years, 3 months ago (2014-09-11 15:21:11 UTC) #12
danakj
https://codereview.chromium.org/548963002/diff/120001/cc/trees/layer_tree_host_common.cc File cc/trees/layer_tree_host_common.cc (right): https://codereview.chromium.org/548963002/diff/120001/cc/trees/layer_tree_host_common.cc#newcode1246 cc/trees/layer_tree_host_common.cc:1246: // First get the layers to the same depth. ...
6 years, 3 months ago (2014-09-11 19:22:05 UTC) #13
Ian Vollick
https://codereview.chromium.org/548963002/diff/120001/cc/trees/layer_tree_host_common.cc File cc/trees/layer_tree_host_common.cc (right): https://codereview.chromium.org/548963002/diff/120001/cc/trees/layer_tree_host_common.cc#newcode1246 cc/trees/layer_tree_host_common.cc:1246: // First get the layers to the same depth. ...
6 years, 3 months ago (2014-09-11 19:58:08 UTC) #14
danakj
https://codereview.chromium.org/548963002/diff/140001/cc/trees/layer_tree_host_common_unittest.cc File cc/trees/layer_tree_host_common_unittest.cc (left): https://codereview.chromium.org/548963002/diff/140001/cc/trees/layer_tree_host_common_unittest.cc#oldcode2853 cc/trees/layer_tree_host_common_unittest.cc:2853: SingularTransformDoesNotPreventClearingDrawProperties) { This test doesn't test anything anymore. Can ...
6 years, 3 months ago (2014-09-11 20:02:42 UTC) #15
Ian Vollick
> Zero doesn't work here. In practice, no real caller of CalcDrawProps passes > zero, ...
6 years, 3 months ago (2014-09-11 20:02:49 UTC) #16
Ian Vollick
https://codereview.chromium.org/548963002/diff/140001/cc/trees/layer_tree_host_common_unittest.cc File cc/trees/layer_tree_host_common_unittest.cc (left): https://codereview.chromium.org/548963002/diff/140001/cc/trees/layer_tree_host_common_unittest.cc#oldcode2853 cc/trees/layer_tree_host_common_unittest.cc:2853: SingularTransformDoesNotPreventClearingDrawProperties) { On 2014/09/11 20:02:42, danakj wrote: > This ...
6 years, 3 months ago (2014-09-11 20:22:53 UTC) #17
danakj
LGTM
6 years, 3 months ago (2014-09-11 20:31:13 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patchset/548963002/160001
6 years, 3 months ago (2014-09-11 20:39:40 UTC) #20
commit-bot: I haz the power
Committed patchset #6 (id:160001) as 4c5596de55b5206cae8779bd6a58d107a972a78d
6 years, 3 months ago (2014-09-12 02:02:57 UTC) #21
commit-bot: I haz the power
Patchset 6 (id:??) landed as https://crrev.com/7faedca87705b714845842e595bca262c4090fa4 Cr-Commit-Position: refs/heads/master@{#294521}
6 years, 3 months ago (2014-09-12 02:05:47 UTC) #22
Ian Vollick
A revert of this CL (patchset #6 id:160001) has been created in https://codereview.chromium.org/563313002/ by vollick@chromium.org. ...
6 years, 3 months ago (2014-09-12 17:43:52 UTC) #23
Ian Vollick
On 2014/09/12 at 17:43:52, vollick wrote: > A revert of this CL (patchset #6 id:160001) ...
6 years, 2 months ago (2014-10-17 18:49:53 UTC) #24
Ian Vollick
On 2014/10/17 at 18:49:53, vollick wrote: > On 2014/09/12 at 17:43:52, vollick wrote: > > ...
6 years, 2 months ago (2014-10-20 23:16:44 UTC) #25
danakj
On 2014/10/20 23:16:44, vollick wrote: > On 2014/10/17 at 18:49:53, vollick wrote: > > On ...
6 years, 2 months ago (2014-10-20 23:34:36 UTC) #26
Ian Vollick
6 years, 2 months ago (2014-10-23 15:31:18 UTC) #27
On 2014/10/20 at 23:34:36, danakj wrote:
> On 2014/10/20 23:16:44, vollick wrote:
> > On 2014/10/17 at 18:49:53, vollick wrote:
> > > On 2014/09/12 at 17:43:52, vollick wrote:
> > > > A revert of this CL (patchset #6 id:160001) has been created in
> > https://codereview.chromium.org/563313002/ by mailto:vollick@chromium.org.
> > > > 
> > > > The reason for reverting is: This patch seems to be exposing some bugs.
They
> > bugs appear not to be directly related to this patch, but I'm going to
revert
> > for now until I can investigate..
> > > 
> > > As of (https://codereview.chromium.org/572483002), the bug exposed by this
> > patch when it was last applied should be fixed.
> > > 
> > > I'd thought that this patch was unnecessary, though, so I'd let it sit
closed.
> > Issue 424064 shows that it's actually still required.
> > > 
> > > I've made two significant changes since this patch was last landed that
need
> > approval.
> > > 
> > > 1) It turns out that clip parents may not always be on the ancestor chain,
so
> > I've had to make it possible to transform the clip through the LCA in that
case.
> > > 2) It's possible for a scroll parent to not be axis aligned wrt to its
target,
> > so I've made it possible for clip transformation to fail in that case (and
I've
> > logged crbug.com/424684 to describe what will be needed to fix this for
real).
> > > 
> > > I've also added tests for these cases.
> > 
> > ping.
> 
> Oh sorry didn't realize this needs review.

ping.

Powered by Google App Engine
This is Rietveld 408576698