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
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=226219
Review URL: https://codereview.chromium.org/
23536049
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227519 0039d316-1c4b-4281-b951-d872f2087c98