Bug 1136971 - Draw layer borders correctly in the presence of multi-FrameMetrics. r=kats
authorBotond Ballo <botond@mozilla.com>
Wed, 25 Feb 2015 18:25:19 -0500
changeset 261878 e04b01edb94473ba82046177b4660166b5ef5bf5
parent 261877 d83e46943d92a5bcc3cc380159340079648b45d2
child 261879 fe48916662d10e1b907d5c99c4f980743711721a
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1136971
milestone39.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 1136971 - Draw layer borders correctly in the presence of multi-FrameMetrics. r=kats
gfx/layers/composite/ContainerLayerComposite.cpp
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -379,27 +379,36 @@ RenderLayers(ContainerT* aContainer,
       PrintUniformityInfo(layer);
     }
 
     if (gfxPrefs::DrawLayerInfo()) {
       DrawLayerInfo(clipRect, aManager, layer);
     }
 
     // Draw a border around scrollable layers.
-    for (uint32_t i = 0; i < layer->GetFrameMetricsCount(); i++) {
-      // A layer can be scrolled by multiple scroll frames. Draw a border
-      // for each.
-      if (layer->GetFrameMetrics(i).IsScrollable()) {
+    // A layer can be scrolled by multiple scroll frames. Draw a border
+    // for each.
+    // Within the list of scroll frames for a layer, the layer border for a
+    // scroll frame lower down is affected by the async transforms on scroll
+    // frames higher up, so loop from the top down, and accumulate an async
+    // transform as we go along.
+    Matrix4x4 asyncTransform;
+    for (uint32_t i = layer->GetFrameMetricsCount(); i > 0; --i) {
+      if (layer->GetFrameMetrics(i - 1).IsScrollable()) {
         // Since the composition bounds are in the parent layer's coordinates,
         // use the parent's effective transform rather than the layer's own.
-        ParentLayerRect compositionBounds = layer->GetFrameMetrics(i).mCompositionBounds;
+        ParentLayerRect compositionBounds = layer->GetFrameMetrics(i - 1).mCompositionBounds;
         aManager->GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTAINER,
                                                    compositionBounds.ToUnknownRect(),
                                                    gfx::Rect(aClipRect.ToUnknownRect()),
-                                                   aContainer->GetEffectiveTransform());
+                                                   asyncTransform * aContainer->GetEffectiveTransform());
+        if (AsyncPanZoomController* apzc = layer->GetAsyncPanZoomController(i - 1)) {
+          asyncTransform = apzc->GetCurrentAsyncTransformWithOverscroll()
+                         * asyncTransform;
+        }
       }
     }
 
     // invariant: our GL context should be current here, I don't think we can
     // assert it though
   }
 }