Bug 1204535 - Hoist out the code to initially compute usingDisplayPort. r=tn
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 15 Sep 2015 16:09:35 -0400
changeset 296983 8d05eefc5da2eb9ddaaa9308db5634d023d4f7ad
parent 296982 f0f0bf01b3a805de8d931dea6e9ad13405d7a38f
child 296984 88f0280c257ed703d27191cff13305a4e91ba969
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1204535
milestone43.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 1204535 - Hoist out the code to initially compute usingDisplayPort. r=tn
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2811,24 +2811,24 @@ ScrollFrameHelper::BuildDisplayList(nsDi
   // they're not scrolled with the rest of the document. But when both
   // scrollbars are visible, the layer's visible rectangle would be the size
   // of the viewport, so most layer implementations would create a layer buffer
   // that's much larger than necessary. Creating independent layers for each
   // scrollbar works around the problem.
   bool createLayersForScrollbars = mIsRoot &&
     mOuter->PresContext()->IsRootContentDocument();
 
+  bool usingDisplayPort = aBuilder->IsPaintingToWindow() &&
+    nsLayoutUtils::GetDisplayPort(mOuter->GetContent());
+
   if (aBuilder->GetIgnoreScrollFrame() == mOuter || IsIgnoringViewportClipping()) {
     // Root scrollframes have FrameMetrics and clipping on their container
     // layers, so don't apply clipping again.
     mAddClipRectToLayer = false;
 
-    bool usingDisplayPort = aBuilder->IsPaintingToWindow() &&
-        nsLayoutUtils::GetDisplayPort(mOuter->GetContent());
-
     if (usingDisplayPort) {
       // There is a display port for this frame, so we want to appear as having
       // active scrolling, so that animated geometry roots are assigned correctly.
       mShouldBuildScrollableLayer = true;
       mIsScrollableLayerInRootContainer = true;
     }
 
     // If we are a root scroll frame that has a display port we want to add
@@ -2868,19 +2868,18 @@ ScrollFrameHelper::BuildDisplayList(nsDi
   // Not all our descendants will be clipped by overflow clipping, but all
   // the ones that aren't clipped will be out of flow frames that have already
   // had dirty rects saved for them by their parent frames calling
   // MarkOutOfFlowChildrenForDisplayList, so it's safe to restrict our
   // dirty rect here.
   nsRect dirtyRect = aDirtyRect.Intersect(mScrollPort);
 
   nsRect displayPort;
-  bool usingDisplayPort = false;
   if (aBuilder->IsPaintingToWindow()) {
-    bool wasUsingDisplayPort = nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), nullptr);
+    bool wasUsingDisplayPort = usingDisplayPort;
 
     if (mIsRoot && gfxPrefs::LayoutUseContainersForRootFrames()) {
       // For a root frame in a container, just get the value of the existing
       // display port if any.
       usingDisplayPort = nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &displayPort);
     } else {
       // Override the value of the display port base rect, and possibly create a
       // display port if there isn't one already.