Allow clipping by scroll parents.
commit6a0f48686003b2e94ad83828d5297494675facf8
authorvollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Tue, 1 Oct 2013 13:20:38 +0000 (1 13:20 +0000)
committervollick@chromium.org <vollick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Tue, 1 Oct 2013 13:20:38 +0000 (1 13:20 +0000)
tree2337077dc40e1513365efc7f032b08e34ca6d867
parent51c1aecfce41d8dafca6ad39742b4d027b86c8cf
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

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=225858

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226219 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