Backed out changeset 99011d150a1d (bug 1163572) for b2g ics debug bustage on a CLOSED TREE
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Mon, 01 Jun 2015 13:03:30 +0200
changeset 278907 0d4f25a9ef1f1dd4ca72cebc84cacfd69745da4a
parent 278906 85785e257efc491f3d7c45ca228e2a04b00bda23
child 278908 3eae6ca6d8224912983d8177ab863f0504dc5727
push id897
push userjlund@mozilla.com
push dateMon, 14 Sep 2015 18:56:12 +0000
treeherdermozilla-release@9411e2d2b214 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1163572
milestone41.0a1
backs out99011d150a1d5eec6fa8f662113fc05c4a061f5b
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
Backed out changeset 99011d150a1d (bug 1163572) for b2g ics debug bustage on a CLOSED TREE
dom/ipc/TabChild.cpp
gfx/layers/apz/util/APZCCallbackHelper.cpp
gfx/layers/apz/util/APZCCallbackHelper.h
gfx/layers/apz/util/ChromeProcessController.cpp
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -570,19 +570,18 @@ TabChildBase::UpdateFrameHandler(const F
 FrameMetrics
 TabChildBase::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
 {
     if (!mGlobal || !mTabChildGlobal) {
         return aFrameMetrics;
     }
 
     FrameMetrics newMetrics = aFrameMetrics;
-    nsCOMPtr<nsIContent> target = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId());
-    if (target) {
-      APZCCallbackHelper::UpdateRootFrame(target, newMetrics);
+    if (nsCOMPtr<nsIPresShell> presShell = GetPresShell()) {
+      APZCCallbackHelper::UpdateRootFrame(presShell, newMetrics);
     }
 
     CSSSize cssCompositedSize = newMetrics.CalculateCompositedSizeInCssPixels();
     // The BrowserElementScrolling helper must know about these updated metrics
     // for other functions it performs, such as double tap handling.
     // Note, %f must not be used because it is locale specific!
     nsString data;
     data.AppendPrintf("{ \"x\" : %d", NS_lround(newMetrics.GetScrollOffset().x));
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp
+++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp
@@ -158,41 +158,28 @@ SetDisplayPortMargins(nsIPresShell* aPre
   nsLayoutUtils::SetDisplayPortMargins(aContent, aPresShell, margins, 0);
   CSSRect baseCSS = aMetrics.CalculateCompositedRectInCssPixels();
   nsRect base(0, 0,
               baseCSS.width * nsPresContext::AppUnitsPerCSSPixel(),
               baseCSS.height * nsPresContext::AppUnitsPerCSSPixel());
   nsLayoutUtils::SetDisplayPortBaseIfNotSet(aContent, base);
 }
 
-static already_AddRefed<nsIPresShell>
-GetPresShell(const nsIContent* aContent)
-{
-  nsCOMPtr<nsIPresShell> result;
-  if (nsIDocument* doc = aContent->GetComposedDoc()) {
-    result = doc->GetShell();
-  }
-  return result.forget();
-}
-
 void
-APZCCallbackHelper::UpdateRootFrame(nsIContent* aContent,
+APZCCallbackHelper::UpdateRootFrame(nsIPresShell* aPresShell,
                                     FrameMetrics& aMetrics)
 {
   // Precondition checks
-  MOZ_ASSERT(aContent);
+  MOZ_ASSERT(aPresShell);
   MOZ_ASSERT(aMetrics.GetUseDisplayPortMargins());
-  nsCOMPtr<nsIPresShell> shell = GetPresShell(aContent);
-  MOZ_ASSERT(shell);
-
   if (aMetrics.GetScrollId() == FrameMetrics::NULL_SCROLL_ID) {
     return;
   }
 
-  float presShellResolution = nsLayoutUtils::GetResolution(shell);
+  float presShellResolution = nsLayoutUtils::GetResolution(aPresShell);
 
   // If the pres shell resolution has changed on the content side side
   // the time this repaint request was fired, consider this request out of date
   // and drop it; setting a zoom based on the out-of-date resolution can have
   // the effect of getting us stuck with the stale resolution.
   if (presShellResolution != aMetrics.GetPresShellResolution()) {
     return;
   }
@@ -202,29 +189,40 @@ APZCCallbackHelper::UpdateRootFrame(nsIC
   // be 100, and gecko would limit the maximum scroll offset to 400 (so as to prevent
   // overscroll). Note that if the content here was zoomed to 2x, the document would
   // be 1000 pixels long but the frame would still be 100 pixels, and so the maximum
   // scroll range would be 900. Therefore this calculation depends on the zoom applied
   // to the content relative to the container.
   // Note that this needs to happen before scrolling the frame (in UpdateFrameCommon),
   // otherwise the scroll position may get clamped incorrectly.
   CSSSize scrollPort = aMetrics.CalculateCompositedSizeInCssPixels();
-  nsLayoutUtils::SetScrollPositionClampingScrollPortSize(shell, scrollPort);
+  nsLayoutUtils::SetScrollPositionClampingScrollPortSize(aPresShell, scrollPort);
 
   // The pres shell resolution is updated by the the async zoom since the
   // last paint.
   presShellResolution = aMetrics.GetPresShellResolution()
                       * aMetrics.GetAsyncZoom().scale;
-  nsLayoutUtils::SetResolutionAndScaleTo(shell, presShellResolution);
+  nsLayoutUtils::SetResolutionAndScaleTo(aPresShell, presShellResolution);
 
   // Do this as late as possible since scrolling can flush layout. It also
   // adjusts the display port margins, so do it before we set those.
-  ScrollFrame(aContent, aMetrics);
+  nsIContent* content = nsLayoutUtils::FindContentFor(aMetrics.GetScrollId());
+  ScrollFrame(content, aMetrics);
+
+  SetDisplayPortMargins(aPresShell, content, aMetrics);
+}
 
-  SetDisplayPortMargins(shell, aContent, aMetrics);
+static already_AddRefed<nsIPresShell>
+GetPresShell(const nsIContent* aContent)
+{
+  nsCOMPtr<nsIPresShell> result;
+  if (nsIDocument* doc = aContent->GetComposedDoc()) {
+    result = doc->GetShell();
+  }
+  return result.forget();
 }
 
 void
 APZCCallbackHelper::UpdateSubFrame(nsIContent* aContent,
                                    FrameMetrics& aMetrics)
 {
   // Precondition checks
   MOZ_ASSERT(aContent);
--- a/gfx/layers/apz/util/APZCCallbackHelper.h
+++ b/gfx/layers/apz/util/APZCCallbackHelper.h
@@ -42,17 +42,17 @@ class APZCCallbackHelper
 
 public:
     /* Applies the scroll and zoom parameters from the given FrameMetrics object to
        the root frame corresponding to the given pres shell. If tiled thebes
        layers are enabled, this will align the displayport to tile boundaries.
        Setting the scroll position can cause some small adjustments to be made
        to the actual scroll position. aMetrics' display port and scroll position
        will be updated with any modifications made. */
-    static void UpdateRootFrame(nsIContent* aPresShell,
+    static void UpdateRootFrame(nsIPresShell* aPresShell,
                                 FrameMetrics& aMetrics);
 
     /* Applies the scroll parameters from the given FrameMetrics object to the subframe
        corresponding to the given content object. If tiled thebes
        layers are enabled, this will align the displayport to tile boundaries.
        Setting the scroll position can cause some small adjustments to be made
        to the actual scroll position. aMetrics' display port and scroll position
        will be updated with any modifications made. */
--- a/gfx/layers/apz/util/ChromeProcessController.cpp
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -71,27 +71,19 @@ ChromeProcessController::RequestContentR
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (aFrameMetrics.GetScrollId() == FrameMetrics::NULL_SCROLL_ID) {
     return;
   }
 
   nsCOMPtr<nsIContent> targetContent = nsLayoutUtils::FindContentFor(aFrameMetrics.GetScrollId());
-  FrameMetrics metrics = aFrameMetrics;
-  if (aFrameMetrics.GetIsRoot()) {
-    nsCOMPtr<nsIDocument> doc = targetContent->GetComposedDoc();
-    nsCOMPtr<nsIPresShell> shell = doc ? doc->GetShell() : nullptr;
-    if (shell && aFrameMetrics.GetPresShellId() == shell->GetPresShellId()) {
-      APZCCallbackHelper::UpdateRootFrame(targetContent, metrics);
-    }
-  } else {
-    if (targetContent) {
-      APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
-    }
+  if (targetContent) {
+    FrameMetrics metrics = aFrameMetrics;
+    APZCCallbackHelper::UpdateSubFrame(targetContent, metrics);
   }
 }
 
 void
 ChromeProcessController::PostDelayedTask(Task* aTask, int aDelayMs)
 {
   MessageLoop::current()->PostDelayedTask(FROM_HERE, aTask, aDelayMs);
 }