Bug 949404 - Applications are half repainted once the keyboard is closed. r=Cwiiis
authorVivien Nicolas <21@vingtetun.org>
Fri, 13 Dec 2013 18:23:47 +0100
changeset 160343 76280df86771d5a28d1b9bf59910dbc586f5449f
parent 160342 2fbd4bd129e2e2bc092923797ff59b23cd769935
child 160344 f56f433b9bd5a333f9ea9ffc8562d03871e1da5e
push id25829
push userryanvm@gmail.com
push dateFri, 13 Dec 2013 20:13:08 +0000
treeherdermozilla-central@934d696d57d4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs949404
milestone29.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 949404 - Applications are half repainted once the keyboard is closed. r=Cwiiis
gfx/layers/FrameMetrics.h
gfx/layers/ipc/AsyncPanZoomController.cpp
widget/xpwidgets/APZCCallbackHelper.cpp
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -108,16 +108,40 @@ public:
     return mScrollOffset * LayersPixelsPerCSSPixel();
   }
 
   LayoutDeviceToParentLayerScale GetParentResolution() const
   {
     return mCumulativeResolution / mResolution;
   }
 
+  // Ensure the scrollableRect is at least as big as the compositionBounds
+  // because the scrollableRect can be smaller if the content is not large
+  // and the scrollableRect hasn't been updated yet.
+  // We move the scrollableRect up because we don't know if we can move it
+  // down. i.e. we know that scrollableRect can go back as far as zero.
+  // but we don't know how much further ahead it can go.
+  CSSRect GetExpandedScrollableRect() const
+  {
+    CSSRect scrollableRect = mScrollableRect;
+    if (scrollableRect.width < mCompositionBounds.width) {
+      scrollableRect.x = std::max(0.f,
+                                  scrollableRect.x - (mCompositionBounds.width - scrollableRect.width));
+      scrollableRect.width = mCompositionBounds.width;
+    }
+
+    if (scrollableRect.height < mCompositionBounds.height) {
+      scrollableRect.y = std::max(0.f,
+                                  scrollableRect.y - (mCompositionBounds.height - scrollableRect.height));
+      scrollableRect.height = mCompositionBounds.height;
+    }
+
+    return scrollableRect;
+  }
+
   /**
    * Return the scale factor needed to fit the viewport
    * into its composition bounds.
    */
   CSSToScreenScale CalculateIntrinsicScale() const
   {
     return CSSToScreenScale(float(mCompositionBounds.width) / float(mViewport.width));
   }
--- a/gfx/layers/ipc/AsyncPanZoomController.cpp
+++ b/gfx/layers/ipc/AsyncPanZoomController.cpp
@@ -1160,35 +1160,18 @@ const CSSRect AsyncPanZoomController::Ca
   // data. In this case, we're dealing with either a stationary frame or a first
   // paint. In either of these cases, we can just assume it'll take 1 second to
   // paint. Getting this correct is not important anyways since it's only really
   // useful when accelerating, which can't be happening at this point.
   double estimatedPaintDuration =
     aEstimatedPaintDuration > EPSILON ? aEstimatedPaintDuration : 1.0;
 
   CSSIntRect compositionBounds = gfx::RoundedIn(aFrameMetrics.mCompositionBounds / aFrameMetrics.mZoom);
-  CSSRect scrollableRect = aFrameMetrics.mScrollableRect;
 
-  // Ensure the scrollableRect is at least as big as the compositionBounds
-  // because the scrollableRect can be smaller if the content is not large
-  // and the scrollableRect hasn't been updated yet.
-  // We move the scrollableRect up because we don't know if we can move it
-  // down. i.e. we know that scrollableRect can go back as far as zero.
-  // but we don't know how much further ahead it can go.
-  if (scrollableRect.width < compositionBounds.width) {
-      scrollableRect.x = std::max(0.f,
-                                  scrollableRect.x - (compositionBounds.width - scrollableRect.width));
-      scrollableRect.width = compositionBounds.width;
-  }
-  if (scrollableRect.height < compositionBounds.height) {
-      scrollableRect.y = std::max(0.f,
-                                  scrollableRect.y - (compositionBounds.height - scrollableRect.height));
-      scrollableRect.height = compositionBounds.height;
-  }
-
+  CSSRect scrollableRect = aFrameMetrics.GetExpandedScrollableRect();
   CSSPoint scrollOffset = aFrameMetrics.mScrollOffset;
 
   CSSRect displayPort = CSSRect(compositionBounds);
   displayPort.MoveTo(0, 0);
   displayPort.Scale(gXStationarySizeMultiplier, gYStationarySizeMultiplier);
 
   // If there's motion along an axis of movement, and it's above a threshold,
   // then we want to paint a larger area in the direction of that motion so that
--- a/widget/xpwidgets/APZCCallbackHelper.cpp
+++ b/widget/xpwidgets/APZCCallbackHelper.cpp
@@ -73,18 +73,18 @@ MaybeAlignAndClampDisplayPort(mozilla::l
   // are enabled.
   if (Preferences::GetBool("layers.force-tiles")) {
     displayPort =
       ExpandDisplayPortToTileBoundaries(displayPort + aActualScrollOffset,
                                         aFrameMetrics.LayersPixelsPerCSSPixel())
       - aActualScrollOffset;
   }
 
-  // Finally, clamp the display port to the scrollable rect.
-  CSSRect scrollableRect = aFrameMetrics.mScrollableRect;
+  // Finally, clamp the display port to the expanded scrollable rect.
+  CSSRect scrollableRect = aFrameMetrics.GetExpandedScrollableRect();
   displayPort = scrollableRect.Intersect(displayPort + aActualScrollOffset)
     - aActualScrollOffset;
 }
 
 void
 APZCCallbackHelper::UpdateRootFrame(nsIDOMWindowUtils* aUtils,
                                     FrameMetrics& aMetrics)
 {