Backed out changeset e3b5dca30ade (bug 907743) for build failure on Windows on a CLOSED TREE
authorChris Lord <chrislord.net@gmail.com>
Tue, 26 Nov 2013 14:13:23 +0000
changeset 157615 097926f8a90455d21d4691a344c594161ec7bdea
parent 157614 b38ee8d06e1bf902c57f178ba5a589512c845dff
child 157616 93343cccb3ed7e5a8674e3efd4352e8b50891e8d
push id25717
push userkwierso@gmail.com
push dateWed, 27 Nov 2013 01:34:26 +0000
treeherdermozilla-central@a6a046acc881 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs907743
milestone28.0a1
backs oute3b5dca30adefbcc7a10080e0c0db71291d14550
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 e3b5dca30ade (bug 907743) for build failure on Windows on a CLOSED TREE
dom/base/nsDOMWindowUtils.cpp
dom/interfaces/base/nsIDOMWindowUtils.idl
dom/ipc/TabChild.cpp
gfx/layers/moz.build
widget/windows/winrt/APZController.cpp
widget/xpwidgets/APZCCallbackHelper.cpp
widget/xpwidgets/APZCCallbackHelper.h
--- a/dom/base/nsDOMWindowUtils.cpp
+++ b/dom/base/nsDOMWindowUtils.cpp
@@ -1476,48 +1476,42 @@ nsDOMWindowUtils::SuppressEventHandling(
     doc->SuppressEventHandling();
   } else {
     doc->UnsuppressEventHandlingAndFireEvents(true);
   }
 
   return NS_OK;
 }
 
-static nsresult
-getScrollXYAppUnits(nsWeakPtr mWindow, bool aFlushLayout, nsPoint& aScrollPos) {
+NS_IMETHODIMP
+nsDOMWindowUtils::GetScrollXY(bool aFlushLayout, int32_t* aScrollX, int32_t* aScrollY)
+{
   if (!nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
   NS_ENSURE_STATE(window);
 
   nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
   NS_ENSURE_STATE(doc);
 
   if (aFlushLayout) {
     doc->FlushPendingNotifications(Flush_Layout);
   }
 
+  nsPoint scrollPos(0,0);
   nsIPresShell *presShell = doc->GetShell();
   if (presShell) {
     nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollable();
     if (sf) {
-      aScrollPos = sf->GetScrollPosition();
+      scrollPos = sf->GetScrollPosition();
     }
   }
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsDOMWindowUtils::GetScrollXY(bool aFlushLayout, int32_t* aScrollX, int32_t* aScrollY)
-{
-  nsPoint scrollPos(0,0);
-  nsresult rv = getScrollXYAppUnits(mWindow, aFlushLayout, scrollPos);
-  NS_ENSURE_SUCCESS(rv, rv);
+
   *aScrollX = nsPresContext::AppUnitsToIntCSSPixels(scrollPos.x);
   *aScrollY = nsPresContext::AppUnitsToIntCSSPixels(scrollPos.y);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDOMWindowUtils::ScrollToCSSPixelsApproximate(float aX, float aY, bool* aRetVal)
@@ -1532,28 +1526,16 @@ nsDOMWindowUtils::ScrollToCSSPixelsAppro
   if (aRetVal) {
     *aRetVal = (sf != nullptr);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDOMWindowUtils::GetScrollXYFloat(bool aFlushLayout, float* aScrollX, float* aScrollY)
-{
-  nsPoint scrollPos(0,0);
-  nsresult rv = getScrollXYAppUnits(mWindow, aFlushLayout, scrollPos);
-  NS_ENSURE_SUCCESS(rv, rv);
-  *aScrollX = nsPresContext::AppUnitsToFloatCSSPixels(scrollPos.x);
-  *aScrollY = nsPresContext::AppUnitsToFloatCSSPixels(scrollPos.y);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsDOMWindowUtils::GetScrollbarSize(bool aFlushLayout, int32_t* aWidth,
                                                       int32_t* aHeight)
 {
   if (!nsContentUtils::IsCallerChrome()) {
     return NS_ERROR_DOM_SECURITY_ERR;
   }
 
   *aWidth = 0;
--- a/dom/interfaces/base/nsIDOMWindowUtils.idl
+++ b/dom/interfaces/base/nsIDOMWindowUtils.idl
@@ -38,17 +38,17 @@ interface nsIDOMFile;
 interface nsIFile;
 interface nsIDOMTouch;
 interface nsIDOMClientRect;
 interface nsIURI;
 interface nsIDOMEventTarget;
 interface nsIRunnable;
 interface nsICompositionStringSynthesizer;
 
-[scriptable, uuid(3772df78-905f-40cf-952f-e4954c63d0ec)]
+[scriptable, uuid(928356ff-26b2-434e-a7ce-c1a660162d81)]
 interface nsIDOMWindowUtils : nsISupports {
 
   /**
    * Image animation mode of the window. When this attribute's value
    * is changed, the implementation should set all images in the window
    * to the given value. That is, when set to kDontAnimMode, all images
    * will stop animating. The attribute's value must be one of the
    * animationMode values from imgIContainer.
@@ -648,24 +648,16 @@ interface nsIDOMWindowUtils : nsISupport
    * Returns the scroll position of the window's currently loaded document.
    *
    * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
    * @see nsIDOMWindow::scrollX/Y
    */
   void getScrollXY(in boolean aFlushLayout, out long aScrollX, out long aScrollY);
 
   /**
-   * Returns the scroll position of the window's currently loaded document.
-   *
-   * @param aFlushLayout flushes layout if true. Otherwise, no flush occurs.
-   * @see nsIDOMWindow::scrollX/Y
-   */
-  void getScrollXYFloat(in boolean aFlushLayout, out float aScrollX, out float aScrollY);
-
-  /**
    * Sets the scroll position of the root scroll frame of the window.
    * Returns true on success, false on error (if the window didn't have a root
    * scroll frame).
    */
   boolean scrollToCSSPixelsApproximate(in float aX, in float aY);
 
   /**
    * Returns the scrollbar width of the window's scroll frame.
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1554,71 +1554,78 @@ TabChild::RecvUpdateFrame(const FrameMet
 
 bool
 TabChild::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
   {
     if (!mGlobal || !mTabChildGlobal) {
         return true;
     }
 
-    nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
-
-    FrameMetrics newMetrics = aFrameMetrics;
-    APZCCallbackHelper::UpdateRootFrame(utils, newMetrics);
-
-    CSSRect cssCompositedRect = newMetrics.CalculateCompositedRectInCssPixels();
+    CSSRect cssCompositedRect = aFrameMetrics.CalculateCompositedRectInCssPixels();
     // 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!
     nsCString data;
-    data.AppendPrintf("{ \"x\" : %d", NS_lround(newMetrics.mScrollOffset.x));
-    data.AppendPrintf(", \"y\" : %d", NS_lround(newMetrics.mScrollOffset.y));
+    data.AppendPrintf("{ \"x\" : %d", NS_lround(aFrameMetrics.mScrollOffset.x));
+    data.AppendPrintf(", \"y\" : %d", NS_lround(aFrameMetrics.mScrollOffset.y));
     data.AppendLiteral(", \"viewport\" : ");
         data.AppendLiteral("{ \"width\" : ");
-        data.AppendFloat(newMetrics.mViewport.width);
+        data.AppendFloat(aFrameMetrics.mViewport.width);
         data.AppendLiteral(", \"height\" : ");
-        data.AppendFloat(newMetrics.mViewport.height);
+        data.AppendFloat(aFrameMetrics.mViewport.height);
         data.AppendLiteral(" }");
     data.AppendLiteral(", \"displayPort\" : ");
         data.AppendLiteral("{ \"x\" : ");
-        data.AppendFloat(newMetrics.mDisplayPort.x);
+        data.AppendFloat(aFrameMetrics.mDisplayPort.x);
         data.AppendLiteral(", \"y\" : ");
-        data.AppendFloat(newMetrics.mDisplayPort.y);
+        data.AppendFloat(aFrameMetrics.mDisplayPort.y);
         data.AppendLiteral(", \"width\" : ");
-        data.AppendFloat(newMetrics.mDisplayPort.width);
+        data.AppendFloat(aFrameMetrics.mDisplayPort.width);
         data.AppendLiteral(", \"height\" : ");
-        data.AppendFloat(newMetrics.mDisplayPort.height);
+        data.AppendFloat(aFrameMetrics.mDisplayPort.height);
         data.AppendLiteral(" }");
     data.AppendLiteral(", \"compositionBounds\" : ");
-        data.AppendPrintf("{ \"x\" : %d", newMetrics.mCompositionBounds.x);
-        data.AppendPrintf(", \"y\" : %d", newMetrics.mCompositionBounds.y);
-        data.AppendPrintf(", \"width\" : %d", newMetrics.mCompositionBounds.width);
-        data.AppendPrintf(", \"height\" : %d", newMetrics.mCompositionBounds.height);
+        data.AppendPrintf("{ \"x\" : %d", aFrameMetrics.mCompositionBounds.x);
+        data.AppendPrintf(", \"y\" : %d", aFrameMetrics.mCompositionBounds.y);
+        data.AppendPrintf(", \"width\" : %d", aFrameMetrics.mCompositionBounds.width);
+        data.AppendPrintf(", \"height\" : %d", aFrameMetrics.mCompositionBounds.height);
         data.AppendLiteral(" }");
     data.AppendLiteral(", \"cssPageRect\" : ");
         data.AppendLiteral("{ \"x\" : ");
-        data.AppendFloat(newMetrics.mScrollableRect.x);
+        data.AppendFloat(aFrameMetrics.mScrollableRect.x);
         data.AppendLiteral(", \"y\" : ");
-        data.AppendFloat(newMetrics.mScrollableRect.y);
+        data.AppendFloat(aFrameMetrics.mScrollableRect.y);
         data.AppendLiteral(", \"width\" : ");
-        data.AppendFloat(newMetrics.mScrollableRect.width);
+        data.AppendFloat(aFrameMetrics.mScrollableRect.width);
         data.AppendLiteral(", \"height\" : ");
-        data.AppendFloat(newMetrics.mScrollableRect.height);
+        data.AppendFloat(aFrameMetrics.mScrollableRect.height);
         data.AppendLiteral(" }");
     data.AppendLiteral(", \"cssCompositedRect\" : ");
         data.AppendLiteral("{ \"width\" : ");
         data.AppendFloat(cssCompositedRect.width);
         data.AppendLiteral(", \"height\" : ");
         data.AppendFloat(cssCompositedRect.height);
         data.AppendLiteral(" }");
     data.AppendLiteral(" }");
 
     DispatchMessageManagerMessage(NS_LITERAL_STRING("Viewport:Change"), data);
 
-    mLastMetrics = newMetrics;
+    nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
+
+    APZCCallbackHelper::UpdateRootFrame(utils, aFrameMetrics);
+
+    mLastMetrics = aFrameMetrics;
+
+    // ScrollWindowTo() can make some small adjustments to the offset before
+    // actually scrolling the window. To ensure that the scroll offset stored
+    // in mLastMetrics is the same as the offset stored in the window,
+    // re-query the latter.
+    CSSIntPoint actualScrollOffset;
+    utils->GetScrollXY(false, &actualScrollOffset.x, &actualScrollOffset.y);
+    mLastMetrics.mScrollOffset = actualScrollOffset;
 
     return true;
 }
 
 bool
 TabChild::RecvHandleDoubleTap(const CSSIntPoint& aPoint)
 {
     if (!mGlobal || !mTabChildGlobal) {
--- a/gfx/layers/moz.build
+++ b/gfx/layers/moz.build
@@ -34,17 +34,16 @@ EXPORTS += [
     'opengl/Composer2D.h',
     'opengl/ImageLayerOGL.h',
     'opengl/LayerManagerOGL.h',
     'opengl/LayerManagerOGLProgram.h',
     'opengl/LayerManagerOGLShaders.h',
     'opengl/TexturePoolOGL.h',
     'ReadbackLayer.h',
     'SharedTextureImage.h',
-    'TiledLayerBuffer.h',
 ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     UNIFIED_SOURCES += [
         'D3D9SurfaceImage.cpp',
     ]
     if CONFIG['MOZ_ENABLE_D3D9_LAYER']:
         EXPORTS += [
--- a/widget/windows/winrt/APZController.cpp
+++ b/widget/windows/winrt/APZController.cpp
@@ -132,18 +132,20 @@ public:
     nsCOMPtr<nsIDOMWindow> window = subDocument->GetDefaultView();
     if (window) {
       utils = do_GetInterface(window);
       if (utils) {
         APZCCallbackHelper::UpdateRootFrame(utils, mFrameMetrics);
 
         // Return the actual scroll value so we can use it to filter
         // out scroll messages triggered by setting the display port.
+        CSSIntPoint actualScrollOffset;
+        utils->GetScrollXY(false, &actualScrollOffset.x, &actualScrollOffset.y);
         if (mLastOffsetOut) {
-          *mLastOffsetOut = mFrameMetrics.mScrollOffset;
+          *mLastOffsetOut = actualScrollOffset;
         }
         if (mLastScrollIdOut) {
           mLastScrollIdOut->mScrollId = mFrameMetrics.mScrollId;
           mLastScrollIdOut->mPresShellId = mFrameMetrics.mPresShellId;
         }
 
 #ifdef DEBUG_CONTROLLER
         WinUtils::Log("APZController: %I64d mDisplayPort: %0.2f %0.2f %0.2f %0.2f",
--- a/widget/xpwidgets/APZCCallbackHelper.cpp
+++ b/widget/xpwidgets/APZCCallbackHelper.cpp
@@ -1,99 +1,37 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "APZCCallbackHelper.h"
-#include "mozilla/Preferences.h"
 #include "nsIScrollableFrame.h"
 #include "nsLayoutUtils.h"
 #include "nsIDOMElement.h"
 #include "nsIInterfaceRequestorUtils.h"
-#include "TiledLayerBuffer.h" // For TILEDLAYERBUFFER_TILE_SIZE
 
 namespace mozilla {
 namespace widget {
 
 bool
 APZCCallbackHelper::HasValidPresShellId(nsIDOMWindowUtils* aUtils,
                                         const FrameMetrics& aMetrics)
 {
     MOZ_ASSERT(aUtils);
 
     uint32_t presShellId;
     nsresult rv = aUtils->GetPresShellId(&presShellId);
     MOZ_ASSERT(NS_SUCCEEDED(rv));
     return NS_SUCCEEDED(rv) && aMetrics.mPresShellId == presShellId;
 }
 
-/**
- * Expands a given rectangle to the next tile boundary. Note, this will
- * expand the rectangle if it is already on tile boundaries.
- */
-static CSSRect ExpandDisplayPortToTileBoundaries(
-  const CSSRect& aDisplayPort,
-  const CSSToLayerScale& aLayerPixelsPerCSSPixel)
-{
-  // Convert the given rect to layer coordinates so we can inflate to tile
-  // boundaries (layer space corresponds to texture pixel space here).
-  LayerRect displayPortInLayerSpace = aDisplayPort * aLayerPixelsPerCSSPixel;
-
-  // Inflate the rectangle by 1 so that we always push to the next tile
-  // boundary. This is desirable to stop from having a rectangle with a
-  // moving origin occasionally being smaller when it coincidentally lines
-  // up to tile boundaries.
-  displayPortInLayerSpace.Inflate(1);
-
-  // Now nudge the rectangle to the nearest equal or larger tile boundary.
-  gfxFloat left = TILEDLAYERBUFFER_TILE_SIZE
-    * floor(displayPortInLayerSpace.x / TILEDLAYERBUFFER_TILE_SIZE);
-  gfxFloat top = TILEDLAYERBUFFER_TILE_SIZE
-    * floor(displayPortInLayerSpace.y / TILEDLAYERBUFFER_TILE_SIZE);
-  gfxFloat right = TILEDLAYERBUFFER_TILE_SIZE
-    * ceil(displayPortInLayerSpace.XMost() / TILEDLAYERBUFFER_TILE_SIZE);
-  gfxFloat bottom = TILEDLAYERBUFFER_TILE_SIZE
-    * ceil(displayPortInLayerSpace.YMost() / TILEDLAYERBUFFER_TILE_SIZE);
-
-  displayPortInLayerSpace = LayerRect(left, top, right - left, bottom - top);
-  CSSRect displayPort = displayPortInLayerSpace / aLayerPixelsPerCSSPixel;
-
-  return displayPort;
-}
-
-static void
-MaybeAlignAndClampDisplayPort(mozilla::layers::FrameMetrics& aFrameMetrics,
-                              const CSSPoint& aActualScrollOffset)
-{
-  // Correct the display-port by the difference between the requested scroll
-  // offset and the resulting scroll offset after setting the requested value.
-  CSSRect& displayPort = aFrameMetrics.mDisplayPort;
-  displayPort += aActualScrollOffset - aFrameMetrics.mScrollOffset;
-
-  // Expand the display port to the next tile boundaries, if tiled thebes layers
-  // are enabled.
-  if (Preferences::GetBool("layers.force-tiles")) {
-    // aFrameMetrics.mZoom is the zoom amount reported by the APZC,
-    // scale by ScreenToLayerScale to get the gecko zoom amount
-    displayPort =
-      ExpandDisplayPortToTileBoundaries(displayPort + aActualScrollOffset,
-                                        aFrameMetrics.mZoom * ScreenToLayerScale(1))
-      - aActualScrollOffset;
-  }
-
-  // Finally, clamp the display port to the scrollable rect.
-  CSSRect scrollableRect = aFrameMetrics.mScrollableRect;
-  displayPort = scrollableRect.ClampRect(displayPort + aActualScrollOffset)
-    - aActualScrollOffset;
-}
-
 void
 APZCCallbackHelper::UpdateRootFrame(nsIDOMWindowUtils* aUtils,
-                                    FrameMetrics& aMetrics)
+                                    const FrameMetrics& aMetrics)
 {
     // Precondition checks
     MOZ_ASSERT(aUtils);
     if (aMetrics.mScrollId == FrameMetrics::NULL_SCROLL_ID) {
         return;
     }
 
     // Set the scroll port size, which determines the scroll range. For example if
@@ -104,27 +42,16 @@ APZCCallbackHelper::UpdateRootFrame(nsID
     // scroll range would be 900. Therefore this calculation depends on the zoom applied
     // to the content relative to the container.
     CSSSize scrollPort = aMetrics.CalculateCompositedRectInCssPixels().Size();
     aUtils->SetScrollPositionClampingScrollPortSize(scrollPort.width, scrollPort.height);
 
     // Scroll the window to the desired spot
     aUtils->ScrollToCSSPixelsApproximate(aMetrics.mScrollOffset.x, aMetrics.mScrollOffset.y, nullptr);
 
-    // Re-query the scroll position after setting it so that anything that relies on it
-    // can have an accurate value.
-    CSSPoint actualScrollOffset;
-    aUtils->GetScrollXYFloat(false, &actualScrollOffset.x, &actualScrollOffset.y);
-
-    // Correct the display port due to the difference between mScrollOffset and the
-    // actual scroll offset, possibly align it to tile boundaries (if tiled layers are
-    // enabled), and clamp it to the scrollable rect.
-    MaybeAlignAndClampDisplayPort(aMetrics, actualScrollOffset);
-    aMetrics.mScrollOffset = actualScrollOffset;
-
     // The mZoom variable on the frame metrics stores the CSS-to-screen scale for this
     // frame. This scale includes all of the (cumulative) resolutions set on the presShells
     // from the root down to this frame. However, when setting the resolution, we only
     // want the piece of the resolution that corresponds to this presShell, rather than
     // all of the cumulative stuff, so we need to divide out the parent resolutions.
     // Finally, we multiply by a ScreenToLayerScale of 1.0f because the goal here is to
     // take the async zoom calculated by the APZC and tell gecko about it (turning it into
     // a "sync" zoom) which will update the resolution at which the layer is painted.
--- a/widget/xpwidgets/APZCCallbackHelper.h
+++ b/widget/xpwidgets/APZCCallbackHelper.h
@@ -28,23 +28,19 @@ public:
     /* Checks to see if the pres shell that the given FrameMetrics object refers
        to is still the valid pres shell for the DOMWindowUtils. This can help
        guard against apply stale updates (updates meant for a pres shell that has
        since been torn down and replaced). */
     static bool HasValidPresShellId(nsIDOMWindowUtils* aUtils,
                                     const FrameMetrics& aMetrics);
 
     /* Applies the scroll and zoom parameters from the given FrameMetrics object to
-       the root frame corresponding to the given DOMWindowUtils. 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. */
+       the root frame corresponding to the given DOMWindowUtils. */
     static void UpdateRootFrame(nsIDOMWindowUtils* aUtils,
-                                FrameMetrics& aMetrics);
+                                const FrameMetrics& aMetrics);
 
     /* Applies the scroll parameters from the given FrameMetrics object to the subframe
        corresponding to the given content object. */
     static void UpdateSubFrame(nsIContent* aContent,
                                const FrameMetrics& aMetrics);
 
     /* Get the DOMWindowUtils for the window corresponding to the given document. */
     static already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils(const nsIDocument* aDoc);