diff options
author | Mats Palmgren <mats@mozilla.com> | 2019-11-29 10:48:50 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-11-29 10:48:50 +0100 |
commit | 6ea8e51aaa192d920ffd6b8a7d4cc4e998d7222a (patch) | |
tree | c1eb96e91f59a8bbf8afe08c085829411b1f254c /layout | |
parent | 013ef52eddc20d97d821195de85b4de27877dc58 (diff) | |
download | UXP-6ea8e51aaa192d920ffd6b8a7d4cc4e998d7222a.tar UXP-6ea8e51aaa192d920ffd6b8a7d4cc4e998d7222a.tar.gz UXP-6ea8e51aaa192d920ffd6b8a7d4cc4e998d7222a.tar.lz UXP-6ea8e51aaa192d920ffd6b8a7d4cc4e998d7222a.tar.xz UXP-6ea8e51aaa192d920ffd6b8a7d4cc4e998d7222a.zip |
Remove unnecessary calls to ReparentFloatsForInlineChild in
nsInlineFrame.
Diffstat (limited to 'layout')
-rw-r--r-- | layout/generic/BlockReflowInput.cpp | 2 | ||||
-rw-r--r-- | layout/generic/nsInlineFrame.cpp | 49 | ||||
-rw-r--r-- | layout/generic/nsInlineFrame.h | 4 |
3 files changed, 10 insertions, 45 deletions
diff --git a/layout/generic/BlockReflowInput.cpp b/layout/generic/BlockReflowInput.cpp index 10084fd8b..86248ac14 100644 --- a/layout/generic/BlockReflowInput.cpp +++ b/layout/generic/BlockReflowInput.cpp @@ -716,6 +716,8 @@ FloatMarginISize(const ReflowInput& aCBReflowInput, bool BlockReflowInput::FlowAndPlaceFloat(nsIFrame* aFloat) { + MOZ_ASSERT(aFloat->GetParent() == mBlock); + WritingMode wm = mReflowInput.GetWritingMode(); // Save away the Y coordinate before placing the float. We will // restore mBCoord at the end after placing the float. This is diff --git a/layout/generic/nsInlineFrame.cpp b/layout/generic/nsInlineFrame.cpp index 5a04f0cd1..7e188c247 100644 --- a/layout/generic/nsInlineFrame.cpp +++ b/layout/generic/nsInlineFrame.cpp @@ -376,8 +376,6 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext, bool lazilySetParentPointer = false; - nsIFrame* lineContainer = aReflowInput.mLineLayout->LineContainerFrame(); - // Check for an overflow list with our prev-in-flow nsInlineFrame* prevInFlow = (nsInlineFrame*)GetPrevInFlow(); if (prevInFlow) { @@ -403,12 +401,6 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext, mFrames.SetFrames(*prevOverflowFrames); lazilySetParentPointer = true; } else { - // Assign all floats to our block if necessary - if (lineContainer && lineContainer->GetPrevContinuation()) { - ReparentFloatsForInlineChild(lineContainer, - prevOverflowFrames->FirstChild(), - true); - } // Insert the new frames at the beginning of the child list // and set their parent pointer const nsFrameList::Slice& newFrames = @@ -442,14 +434,13 @@ nsInlineFrame::Reflow(nsPresContext* aPresContext, if (aReflowInput.mLineLayout->GetInFirstLine()) { flags = DrainFlags(flags | eInFirstLine); } - DrainSelfOverflowListInternal(flags, lineContainer); + DrainSelfOverflowListInternal(flags); } - // Set our own reflow state (additional state above and beyond - // aReflowInput) + // Set our own reflow state (additional state above and beyond aReflowInput) InlineReflowInput irs; irs.mPrevFrame = nullptr; - irs.mLineContainer = lineContainer; + irs.mLineContainer = aReflowInput.mLineLayout->LineContainerFrame(); irs.mLineLayout = aReflowInput.mLineLayout; irs.mNextInFlow = (nsInlineFrame*) GetNextInFlow(); irs.mSetParentPointer = lazilySetParentPointer; @@ -494,8 +485,7 @@ nsInlineFrame::AttributeChanged(int32_t aNameSpaceID, } bool -nsInlineFrame::DrainSelfOverflowListInternal(DrainFlags aFlags, - nsIFrame* aLineContainer) +nsInlineFrame::DrainSelfOverflowListInternal(DrainFlags aFlags) { AutoFrameListPtr overflowFrames(PresContext(), StealOverflowFrames()); if (overflowFrames) { @@ -504,9 +494,6 @@ nsInlineFrame::DrainSelfOverflowListInternal(DrainFlags aFlags, // correct parent pointer. This is sometimes skipped by Reflow. if (!(aFlags & eDontReparentFrames)) { nsIFrame* firstChild = overflowFrames->FirstChild(); - if (aLineContainer && aLineContainer->GetPrevContinuation()) { - ReparentFloatsForInlineChild(aLineContainer, firstChild, true); - } const bool doReparentSC = (aFlags & eInFirstLine); RestyleManagerHandle restyleManager = PresContext()->RestyleManager(); for (nsIFrame* f = firstChild; f; f = f->GetNextSibling()) { @@ -537,7 +524,7 @@ nsInlineFrame::DrainSelfOverflowList() break; } } - return DrainSelfOverflowListInternal(flags, lineContainer); + return DrainSelfOverflowListInternal(flags); } /* virtual */ bool @@ -606,23 +593,8 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext, while (frame) { // Check if we should lazily set the child frame's parent pointer. if (irs.mSetParentPointer) { - bool havePrevBlock = - irs.mLineContainer && irs.mLineContainer->GetPrevContinuation(); nsIFrame* child = frame; do { - // If our block is the first in flow, then any floats under the pulled - // frame must already belong to our block. - if (havePrevBlock) { - // This has to happen before we update frame's parent; we need to - // know frame's ancestry under its old block. - // The blockChildren.ContainsFrame check performed by - // ReparentFloatsForInlineChild here may be slow, but we can't - // easily avoid it because we don't know where 'frame' originally - // came from. If we really really have to optimize this we could - // cache whether frame->GetParent() is under its containing blocks - // overflowList or not. - ReparentFloatsForInlineChild(irs.mLineContainer, child, false); - } child->SetParent(this); if (inFirstLine) { restyleManager->ReparentStyleContext(child); @@ -1098,20 +1070,13 @@ nsFirstLineFrame::Reflow(nsPresContext* aPresContext, return; // XXX does this happen? why? } - nsIFrame* lineContainer = aReflowInput.mLineLayout->LineContainerFrame(); - // Check for an overflow list with our prev-in-flow nsFirstLineFrame* prevInFlow = (nsFirstLineFrame*)GetPrevInFlow(); if (prevInFlow) { AutoFrameListPtr prevOverflowFrames(aPresContext, prevInFlow->StealOverflowFrames()); if (prevOverflowFrames) { - // Assign all floats to our block if necessary - if (lineContainer && lineContainer->GetPrevContinuation()) { - ReparentFloatsForInlineChild(lineContainer, - prevOverflowFrames->FirstChild(), - true); - } + // Reparent the new frames and their style contexts. const nsFrameList::Slice& newFrames = mFrames.InsertFrames(this, nullptr, *prevOverflowFrames); ReparentChildListStyle(aPresContext, newFrames, this); @@ -1125,7 +1090,7 @@ nsFirstLineFrame::Reflow(nsPresContext* aPresContext, // aReflowInput) InlineReflowInput irs; irs.mPrevFrame = nullptr; - irs.mLineContainer = lineContainer; + irs.mLineContainer = aReflowInput.mLineLayout->LineContainerFrame(); irs.mLineLayout = aReflowInput.mLineLayout; irs.mNextInFlow = (nsInlineFrame*) GetNextInFlow(); diff --git a/layout/generic/nsInlineFrame.h b/layout/generic/nsInlineFrame.h index a9679e93f..36df6be93 100644 --- a/layout/generic/nsInlineFrame.h +++ b/layout/generic/nsInlineFrame.h @@ -179,11 +179,9 @@ private: /** * Move any frames on our overflow list to the end of our principal list. * @param aFlags one or more of the above DrainFlags - * @param aLineContainer the nearest line container ancestor * @return true if there were any overflow frames */ - bool DrainSelfOverflowListInternal(DrainFlags aFlags, - nsIFrame* aLineContainer); + bool DrainSelfOverflowListInternal(DrainFlags aFlags); protected: nscoord mBaseline; }; |