Allow clipping by scroll parents.
commite10af6c375360fbb3de4af5722801df96ce95a76
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Sat, 28 Sep 2013 18:35:06 +0000 (28 18:35 +0000)
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Sat, 28 Sep 2013 18:35:06 +0000 (28 18:35 +0000)
tree71f140b4dcf88cbc8e2e15701bb15d176b0f08ba
parent890637216afe663dc7fa509894fe519216c79147
Allow clipping by scroll parents.

Previously, we had required that we inherit our clip from our direct ancestor or
our clip parent (which has to be an ancestor). This CL loosens that restriction
and allows clipping by our scroll parent, which will not be our ancestor.

In order for this to work, we must ensure that the scroll parent's clip is
computed before we compute the clip children's. This is accomplished by changing
the order in which we recur through the layer tree and sorting layer lists
afterward to ensure that we ultimately stack correctly.

NB: I have taken care to only sort the newly added layers, and to only sort when
the child order has actually changed, which should happen rarely.

Tests:
 1. LayerTreeHostCommonTest.ClippedByScrollParent
   - Checks that the simple case (where the scroll parent is naturally processed
     before the scroll child) results in the correct clips.
 2. LayerTreeHostCommonTest.ClippedByOutOfOrderScrollParent
   - Identical to (1) but checks that clips are still correct when the scroll
     parent needs to be visited out of order.
 3. LayerTreeHostCommonTest.ClippedByOutOfOrderScrollGrandparent
   - Similar to (2), but also checks that clips are set up correctly if the
     scroll parent has yet another scroll parent (sorting for recursion is a bit
     tougher in this case).
   - Also checks that despite visiting layers out of order, that the layer list
     ends up in paint order.
 4. LayerTreeHostCommonTest.OutOfOrderClippingRequiresRSLLSorting
   - Similar to (3), but includes several render surfaces in the tree and checks
     that the resulting render surface layer list is ordered correctly.
5. LayerTreeHostCommonTest.DoNotClobberSorting
   - Ensures that if we have to reorder layer list contributions that we do not break 3d sorting.

BUG=291413
R=danakj@chromium.org, enne@chromium.org, hartmanng@chromium.org

Review URL: https://codereview.chromium.org/23536049

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225858 0039d316-1c4b-4281-b951-d872f2087c98
cc/layers/draw_properties.h
cc/trees/layer_tree_host_common.cc
cc/trees/layer_tree_host_common_unittest.cc