Bug 1071686 - Enable creation of an initial displayport on non-B2G platforms. r=mstange
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 14 Oct 2014 14:51:34 -0400
changeset 210294 1a5153ae014fcc6025e11e38bd6628df1c5d26b3
parent 210293 1d1e647773f1fec4ef93050e89ae9487ad8cd235
child 210295 7246195fb751da0975f4a5abff617ff42e2ba712
push id9359
push userkgupta@mozilla.com
push dateTue, 14 Oct 2014 18:54:35 +0000
treeherderfx-team@7246195fb751 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
Bug 1071686 - Enable creation of an initial displayport on non-B2G platforms. r=mstange
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -83,30 +83,27 @@
 #include "TiledLayerBuffer.h" // For TILEDLAYERBUFFER_TILE_SIZE
 #include "ClientLayerManager.h"
 #include "nsRefreshDriver.h"
 #include "nsIContentViewer.h"
 #include "LayersLogging.h"
 #include "mozilla/Preferences.h"
 #include "nsFrameSelection.h"
 #include "FrameLayerBuilder.h"
+#include "mozilla/layers/AsyncPanZoomController.h"
 #ifdef MOZ_XUL
 #include "nsXULPopupManager.h"
 #include "GeckoProfiler.h"
 #include "nsAnimationManager.h"
 #include "nsTransitionManager.h"
 #include "RestyleManager.h"
-// Additional includes used on B2G by code in GetOrMaybeCreateDisplayPort().
-#include "mozilla/layers/AsyncPanZoomController.h"
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::image;
 using namespace mozilla::layers;
 using namespace mozilla::layout;
 using namespace mozilla::gfx;
@@ -2729,19 +2726,16 @@ nsLayoutUtils::GetFramesForArea(nsIFrame
   nsDisplayItem::HitTestState hitTestState;
   list.HitTest(&builder, aRect, &hitTestState, &aOutFrames);
   return NS_OK;
-// This function is only used on B2G, and some compilers complain about
-// unused static functions, so we need to #ifdef it.
 // aScrollFrame and aScrollFrameAsScrollable must be non-nullptr
 static FrameMetrics
 CalculateFrameMetricsForDisplayPort(nsIFrame* aScrollFrame,
                                     nsIScrollableFrame* aScrollFrameAsScrollable) {
   // Calculate the metrics necessary for calculating the displayport.
   // This code has a lot in common with the code in ComputeFrameMetrics();
   // we may want to refactor this at some point.
   FrameMetrics metrics;
@@ -2779,17 +2773,16 @@ CalculateFrameMetricsForDisplayPort(nsIF
   metrics.mScrollableRect = CSSRect::FromAppUnits(
       nsLayoutUtils::CalculateScrollableRectForFrame(aScrollFrameAsScrollable, nullptr));
   return metrics;
 nsLayoutUtils::GetOrMaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
                                            nsIFrame* aScrollFrame,
                                            nsRect aDisplayPortBase,
                                            nsRect* aOutDisplayport) {
   nsIContent* content = aScrollFrame->GetContent();
   nsIScrollableFrame* scrollableFrame = do_QueryFrame(aScrollFrame);
@@ -2799,18 +2792,17 @@ nsLayoutUtils::GetOrMaybeCreateDisplayPo
   // Set the base rect. Note that this will not influence 'haveDisplayPort',
   // which is based on either the whole rect or margins being set, but it
   // will affect what is returned in 'aOutDisplayPort' if margins are set.
   SetDisplayPortBase(content, aDisplayPortBase);
   bool haveDisplayPort = GetDisplayPort(content, aOutDisplayport);
-  // On B2G, we perform an optimization where we ensure that at least one
+  // We perform an optimization where we ensure that at least one
   // async-scrollable frame (i.e. one that WantsAsyncScroll()) has a displayport.
   // If that's not the case yet, and we are async-scrollable, we will get a
   // displayport.
   // Note: we only do this in processes where we do subframe scrolling to
   //       begin with (i.e., not in the parent process on B2G).
   if (aBuilder.IsPaintingToWindow() && WantSubAPZC() &&
       !aBuilder.HaveScrollableDisplayPort() &&
       scrollableFrame->WantAsyncScroll()) {
@@ -2829,17 +2821,16 @@ nsLayoutUtils::GetOrMaybeCreateDisplayPo
           alignment.height, 0, nsLayoutUtils::RepaintMode::DoNotRepaint);
       haveDisplayPort = GetDisplayPort(content, aOutDisplayport);
       NS_ASSERTION(haveDisplayPort, "should have a displayport after having just set it");
     // Record that the we now have a scrollable display port.
   return haveDisplayPort;
 nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFrame,
                           const nsRegion& aDirtyRegion, nscolor aBackstop,
                           uint32_t aFlags)