Bug 1514653 - Use the reference frame of the first flattened effect when recycling the layer r=mattwoodrow
authorMiko Mynttinen <mikokm@gmail.com>
Mon, 21 Jan 2019 22:03:10 +0000
changeset 514762 f722c4dbd4ccc19911de8ad05423363e0b5b2da7
parent 514761 ad20edb20e58f913e922dff27005fe088903e5e9
child 514763 2195f346d368042482357dc178255030ca610265
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1514653
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1514653 - Use the reference frame of the first flattened effect when recycling the layer r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D17079
layout/painting/FrameLayerBuilder.cpp
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -4411,16 +4411,17 @@ void ContainerState::ProcessDisplayItems
   // Tracks the PaintedLayerData that the item will be accumulated in, if it is
   // non-null.
   PaintedLayerData* selectedLayer = nullptr;
   AutoTArray<size_t, 2> opacityIndices;
 
   // AGR and ASR for the container item that was flattened.
   AnimatedGeometryRoot* containerAGR = nullptr;
   const ActiveScrolledRoot* containerASR = nullptr;
+  nsIFrame* containerReferenceFrame = nullptr;
   RefPtr<TransformClipNode> transformNode = nullptr;
 
   const auto InTransform = [&]() { return transformNode; };
 
   const auto InOpacity = [&]() {
     return selectedLayer && opacityIndices.Length() > 0;
   };
 
@@ -5039,17 +5040,18 @@ void ContainerState::ProcessDisplayItems
       } else {
         paintedLayerData->Accumulate(this, item, itemVisibleRect, itemContent,
                                      itemClip, layerState, aList, marker,
                                      opacityIndices, transformNode);
 
         if (!paintedLayerData->mLayer) {
           // Try to recycle the old layer of this display item.
           RefPtr<PaintedLayer> layer = AttemptToRecyclePaintedLayer(
-              itemAGR, item, topLeft, referenceFrame);
+              itemAGR, item, topLeft,
+              inEffect ? containerReferenceFrame : referenceFrame);
           if (layer) {
             paintedLayerData->mLayer = layer;
 
             PaintedDisplayItemLayerUserData* userData =
                 GetPaintedDisplayItemLayerUserData(layer);
             paintedLayerData->mAssignedDisplayItems.reserve(
                 userData->mLastItemCount);
 
@@ -5061,24 +5063,26 @@ void ContainerState::ProcessDisplayItems
         }
       }
 
       const auto ClearLayerSelectionIfNeeded = [&]() {
         if (!InOpacity() && !InTransform()) {
           selectedLayer = nullptr;
           containerAGR = nullptr;
           containerASR = nullptr;
+          containerReferenceFrame = nullptr;
         }
       };
 
       const auto SelectLayerIfNeeded = [&]() {
         if (!selectedLayer) {
           selectedLayer = paintedLayerData;
-          containerAGR = item->GetAnimatedGeometryRoot();
-          containerASR = item->GetActiveScrolledRoot();
+          containerAGR = itemAGR;
+          containerASR = itemASR;
+          containerReferenceFrame = const_cast<nsIFrame*>(referenceFrame);
         }
       };
 
       if (marker == DisplayItemEntryType::PUSH_TRANSFORM) {
         nsDisplayTransform* transform = static_cast<nsDisplayTransform*>(item);
 
         const Matrix4x4Flagged& matrix = transform->GetTransformForRendering();