Bug 1546139 - Pick up fixed layer margins in AsyncCompositionManager with containerless scrolling. r=kats a=pascalc
authorBotond Ballo <botond@mozilla.com>
Fri, 26 Apr 2019 15:33:46 +0300
changeset 523366 d41af59923c97c57c2c7c22fe47ce6760f1a2029
parent 523365 9fa4cf7dfb75f9591fd91a76776221af0868a995
child 523367 37474b32ecd189afb5c50d65b9d208eee94f0639
push id11166
push userapavel@mozilla.com
push dateFri, 26 Apr 2019 12:48:25 +0000
treeherdermozilla-beta@ded211603671 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, pascalc
bugs1546139, 1525181
milestone67.0
Bug 1546139 - Pick up fixed layer margins in AsyncCompositionManager with containerless scrolling. r=kats a=pascalc Summary: This is a fix for the 67 branch only. 68 will require a different fix due to bug 1525181 having changed this code since then. Reviewers: kats Reviewed By: kats Bug #: 1546139 Differential Revision: https://phabricator.services.mozilla.com/D28407
gfx/layers/composite/AsyncCompositionManager.cpp
--- a/gfx/layers/composite/AsyncCompositionManager.cpp
+++ b/gfx/layers/composite/AsyncCompositionManager.cpp
@@ -1241,20 +1241,35 @@ bool AsyncCompositionManager::ApplyAsync
                 zoomedMetrics->GetApzc());
 
             LayerToParentLayerMatrix4x4 currentTransform;
             LayerToParentLayerMatrix4x4 previousTransform =
                 CSSTransformMatrix() *
                 CompleteAsyncTransform(
                     sampler->GetCurrentAsyncViewportRelativeTransform(
                         *zoomedMetrics));
+            // Correct positioning of fixed content during dynamic toolbar
+            // transitions requires passing mFixedLayerMargins to
+            // AdjustFixedOrStickyLayer(). There is logic above to set the
+            // local |fixedLayerMargins| variable to mFixedLayerMargins for
+            // the root content layer, but here we need it while processing
+            // the fixed layers themselves, so set it again.
+            // We do not reuse the |fixedLayerMargins| variable itself so that
+            // the ExpandRootClipRect() call below (which expects it to be
+            // populated only for the root content layer) does not pick it up.
+            // We can't just pass mFixedLayerMargins directly because it's
+            // an #ifdef MOZ_WIDGET_ANDROID field.
+            ScreenMargin marginsForFixedLayer;
+#ifdef MOZ_WIDGET_ANDROID
+            marginsForFixedLayer = mFixedLayerMargins;
+#endif
             AdjustFixedOrStickyLayer(zoomContainer, layer,
                                      sampler->GetGuid(*zoomedMetrics).mScrollId,
                                      previousTransform, currentTransform,
-                                     fixedLayerMargins, clipPartsCache);
+                                     marginsForFixedLayer, clipPartsCache);
           }
         }
 
         bool clipChanged = (hasAsyncTransform || clipDeferredFromChildren ||
                             layer->GetScrolledClipRect());
         if (clipChanged) {
           // Intersect the two clip parts and apply them to the layer.
           // During ApplyAsyncContentTransformTree on an ancestor layer,