Bug 943846 - Make APZC's generated display port contain the composition bounds. r=kats
authorChris Lord <chrislord.net@gmail.com>
Fri, 06 Dec 2013 13:15:58 +0000
changeset 174838 adcc42bc9430483bdeb1bd74c6058890f4f69844
parent 174837 099f65a712a8d098bd44ee45794724fbf9f8b0a6
child 174839 01762a3bb7fb792d3238f3309b276195c060a928
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs943846, 936500
milestone28.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 943846 - Make APZC's generated display port contain the composition bounds. r=kats A bug in layout means that setting a displayport on an element that doesn't contain its scroll frame may cause the display item to be optimised away (bug 936500).
gfx/layers/ipc/AsyncPanZoomController.cpp
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -1213,16 +1213,31 @@ const CSSRect AsyncPanZoomController::Ca
     scrollOffset.x = scrollableRect.x;
   }
   if (scrollOffset.y + compositionBounds.height > scrollableRect.height) {
     scrollOffset.y -= compositionBounds.height + scrollOffset.y - scrollableRect.height;
   } else if (scrollOffset.y < scrollableRect.y) {
     scrollOffset.y = scrollableRect.y;
   }
 
+  // FIXME/bug 936500: Make sure the displayport contains the composition
+  // bounds. This is to work around a layout bug that means if a display item's
+  // corresponding displayport doesn't contain its frame's bounds, it may get
+  // optimised out and the layer won't get created.
+  if (displayPort.x + displayPort.width < compositionBounds.width) {
+    displayPort.x = -(displayPort.width - compositionBounds.width);
+  } else if (displayPort.x > 0) {
+    displayPort.x = 0;
+  }
+  if (displayPort.y + displayPort.height < compositionBounds.height) {
+    displayPort.y = -(displayPort.height - compositionBounds.height);
+  } else if (displayPort.y > 0) {
+    displayPort.y = 0;
+  }
+
   CSSRect shiftedDisplayPort = displayPort + scrollOffset;
   return scrollableRect.ClampRect(shiftedDisplayPort) - scrollOffset;
 }
 
 void AsyncPanZoomController::ScheduleComposite() {
   if (mCompositorParent) {
     mCompositorParent->ScheduleRenderOnCompositorThread();
   }