From 32deb51be9b944013457cd305bc178e7e3860170 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 25 Jun 2014 10:36:13 +0200 Subject: [PATCH] Bug 1026450 - Don't let clipped animated transforms trigger layerization of elements outside the clip. r=roc --HG-- extra : rebase_source : 2e260272a4d6aa4271d4e3231d7da3dd224b838c --- layout/base/FrameLayerBuilder.cpp | 18 ++++-- .../clipped-animated-transform-1.html | 62 +++++++++++++++++++ layout/reftests/invalidation/reftest.list | 1 + 3 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 layout/reftests/invalidation/clipped-animated-transform-1.html diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index f2c9ea36a88e..e6b93dbb750e 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2573,14 +2573,24 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, ThebesLayerData* data = GetTopThebesLayerData(); if (data) { // Prerendered transform items can be updated without layer building - // (async animations or an empty transaction), so we treat all other - // content as being above this so that the transformed layer can correctly - // move behind other content. + // (async animations or an empty transaction), so we need to put items + // that the transform item can potentially move under into a layer + // above this item. if (item->GetType() == nsDisplayItem::TYPE_TRANSFORM && nsDisplayTransform::ShouldPrerenderTransformedContent(mBuilder, item->Frame(), false)) { - data->SetAllDrawingAbove(); + if (!itemClip.HasClip()) { + // The transform item can move anywhere, treat all other content + // as being above this item. + data->SetAllDrawingAbove(); + } else { + // The transform can't escape from the clip rect, and the clip + // rect can't change without new layer building. Treat all content + // that intersects the clip rect as being above this item. + data->AddVisibleAboveRegion(clipRect); + data->AddDrawAboveRegion(clipRect); + } } else { data->AddVisibleAboveRegion(itemVisibleRect); diff --git a/layout/reftests/invalidation/clipped-animated-transform-1.html b/layout/reftests/invalidation/clipped-animated-transform-1.html new file mode 100644 index 000000000000..a2faea28905f --- /dev/null +++ b/layout/reftests/invalidation/clipped-animated-transform-1.html @@ -0,0 +1,62 @@ + + + +The green box shouldn't be invalidated when the blue box starts to move. + + + +
+
+
+ +
+ + diff --git a/layout/reftests/invalidation/reftest.list b/layout/reftests/invalidation/reftest.list index 215a0c933b2d..6784498969b7 100644 --- a/layout/reftests/invalidation/reftest.list +++ b/layout/reftests/invalidation/reftest.list @@ -46,3 +46,4 @@ pref(layout.animated-image-layers.enabled,true) == test-animated-image-layers-ba != transform-floating-point-invalidation.html?reverse about:blank != nudge-to-integer-invalidation.html about:blank != nudge-to-integer-invalidation.html?reverse about:blank +!= clipped-animated-transform-1.html about:blank