From 3025106c4eb787512a9c3a353b7e5ca1cb2b07c6 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 25 Aug 2016 11:18:56 +1200 Subject: [PATCH] Bug 1198135 - Part 3: Set the size of HTMLScrollFrames earlier so that we compute perspective earlier. r=dbaron --- layout/generic/nsGfxScrollFrame.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 2107311268a6..d4c39e6b945e 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -1034,6 +1034,16 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, ReflowContents(&state, aDesiredSize); + aDesiredSize.Width() = state.mInsideBorderSize.width + + state.mComputedBorder.LeftRight(); + aDesiredSize.Height() = state.mInsideBorderSize.height + + state.mComputedBorder.TopBottom(); + + // Set the size of the frame now since computing the perspective-correct + // overflow (within PlaceScrollArea) can rely on it. + SetSize(aDesiredSize.GetWritingMode(), + aDesiredSize.Size(aDesiredSize.GetWritingMode())); + // Restore the old scroll position, for now, even if that's not valid anymore // because we changed size. We'll fix it up in a post-reflow callback, because // our current size may only be temporary (e.g. we're compute XUL desired sizes). @@ -1073,11 +1083,6 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext, } } - aDesiredSize.Width() = state.mInsideBorderSize.width + - state.mComputedBorder.LeftRight(); - aDesiredSize.Height() = state.mInsideBorderSize.height + - state.mComputedBorder.TopBottom(); - aDesiredSize.SetOverflowAreasToDesiredBounds(); if (mHelper.IsIgnoringViewportClipping()) { aDesiredSize.mOverflowAreas.UnionWith(