Bug 1116718 part 1 - Don't bother calculating overflow areas when they will be discarded anyway. r=roc
authorMats Palmgren <mats@mozilla.com>
Tue, 06 Jan 2015 09:27:56 +0000
changeset 235228 2c26d6715f100184ae102c1f0b12b0cb8ee0410b
parent 235227 8a5c5cf141b77db7ad2d900acf73c3d0151284d3
child 235229 dbd12f80f9fae280f9bcc8a75382f6f0c3045ee8
push id355
push usermleibovic@mozilla.com
push dateWed, 07 Jan 2015 02:29:19 +0000
reviewersroc
bugs1116718
milestone37.0a1
Bug 1116718 part 1 - Don't bother calculating overflow areas when they will be discarded anyway. r=roc
layout/generic/nsViewportFrame.cpp
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -247,28 +247,26 @@ ViewportFrame::Reflow(nsPresContext*    
       reflowState.AvailableBSize() = maxSize.BSize(wm);
       // Not having border/padding simplifies things
       NS_ASSERTION(reflowState.ComputedPhysicalBorderPadding() == nsMargin(0,0,0,0),
                    "Viewports can't have border/padding");
       reflowState.SetComputedBSize(maxSize.BSize(wm));
     }
 
     nsRect rect = AdjustReflowStateAsContainingBlock(&reflowState);
-
-    // Just reflow all the fixed-pos frames.
+    nsOverflowAreas* overflowAreas = &aDesiredSize.mOverflowAreas;
+    nsIScrollableFrame* rootScrollFrame =
+                    aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
+    if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
+      overflowAreas = nullptr;
+    }
     GetAbsoluteContainingBlock()->Reflow(this, aPresContext, reflowState, aStatus,
                                          rect,
                                          false, true, true, // XXX could be optimized
-                                         &aDesiredSize.mOverflowAreas);
-
-    nsIScrollableFrame* rootScrollFrame =
-                    aPresContext->PresShell()->GetRootScrollFrameAsScrollable();
-    if (rootScrollFrame && !rootScrollFrame->IsIgnoringViewportClipping()) {
-      aDesiredSize.SetOverflowAreasToDesiredBounds();
-    }
+                                         overflowAreas);
   }
 
   if (mFrames.NotEmpty()) {
     ConsiderChildOverflow(aDesiredSize.mOverflowAreas, mFrames.FirstChild());
   }
 
   // If we were dirty then do a repaint
   if (GetStateBits() & NS_FRAME_IS_DIRTY) {