зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1474771 - Revert all changes from bug 1459937 since they are no longer needed. r=dholbert
(The single line that made them active was commented out in the previous patch.) Differential Revision: https://phabricator.services.mozilla.com/D36425 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2f31b3fef4
Коммит
bb277e6cb2
|
@ -133,12 +133,6 @@ enum class DrawStringFlags {
|
|||
};
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DrawStringFlags)
|
||||
|
||||
enum class ReparentingDirection {
|
||||
Backwards,
|
||||
Forwards,
|
||||
Variable // Could be either of the above; take most pessimistic action.
|
||||
};
|
||||
|
||||
/**
|
||||
* nsLayoutUtils is a namespace class used for various helper
|
||||
* functions that are useful in multiple places in layout. The goal
|
||||
|
|
|
@ -580,79 +580,23 @@ void nsBlockFrame::GetChildLists(nsTArray<ChildList>* aLists) const {
|
|||
/* virtual */
|
||||
bool nsBlockFrame::IsFloatContainingBlock() const { return true; }
|
||||
|
||||
static void ReparentFrameInternal(nsIFrame* aFrame,
|
||||
nsContainerFrame* aOldParent,
|
||||
nsContainerFrame* aNewParent,
|
||||
bool aMarkDirty) {
|
||||
static void ReparentFrame(nsIFrame* aFrame, nsContainerFrame* aOldParent,
|
||||
nsContainerFrame* aNewParent) {
|
||||
NS_ASSERTION(aOldParent == aFrame->GetParent(),
|
||||
"Parent not consistent with expectations");
|
||||
|
||||
aFrame->SetParent(aNewParent);
|
||||
if (aMarkDirty) {
|
||||
// aFrame->AddStateBits(NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
// When pushing and pulling frames we need to check for whether any
|
||||
// views need to be reparented
|
||||
nsContainerFrame::ReparentFrameView(aFrame, aOldParent, aNewParent);
|
||||
}
|
||||
|
||||
static bool ShouldMarkReparentedFramesDirty(
|
||||
#ifdef DEBUG
|
||||
nsContainerFrame* aOldParent,
|
||||
#endif
|
||||
nsIFrame* aNewParent, ReparentingDirection aDirection) {
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(aOldParent->FirstInFlow() == aNewParent->FirstInFlow(),
|
||||
"Reparenting should be between continuations of the same frame");
|
||||
if (aDirection != ReparentingDirection::Variable &&
|
||||
aOldParent->FirstInFlow() == aNewParent->FirstInFlow()) {
|
||||
auto IndexInFlow = [](const nsIFrame* f) {
|
||||
int i = 0;
|
||||
while ((f = f->GetPrevInFlow())) {
|
||||
++i;
|
||||
}
|
||||
return i;
|
||||
};
|
||||
MOZ_ASSERT((IndexInFlow(aOldParent) < IndexInFlow(aNewParent)) ==
|
||||
(aDirection == ReparentingDirection::Forwards),
|
||||
"Parents not in expected order");
|
||||
}
|
||||
#endif
|
||||
// Frames going forward must have already been reflowed, or at least marked
|
||||
// dirty. Otherwise frames going backwards (or direction is unknown) may not
|
||||
// be marked dirty yet.
|
||||
return (aDirection != ReparentingDirection::Forwards) &&
|
||||
(aNewParent->GetStateBits() & NS_FRAME_IS_DIRTY);
|
||||
}
|
||||
|
||||
// Because a frame with NS_FRAME_IS_DIRTY marks all of its children dirty at
|
||||
// the start of its reflow, when we move a frame from a later frame backwards to
|
||||
// an earlier frame, and the earlier frame has NS_FRAME_IS_DIRTY (though that
|
||||
// should corresponded with the later frame having NS_FRAME_IS_DIRTY), we need
|
||||
// to add NS_FRAME_IS_DIRTY to the reparented frame.
|
||||
static void ReparentFrame(nsIFrame* aFrame, nsContainerFrame* aOldParent,
|
||||
nsContainerFrame* aNewParent,
|
||||
ReparentingDirection aDirection) {
|
||||
const bool markDirty = ShouldMarkReparentedFramesDirty(
|
||||
#ifdef DEBUG
|
||||
aOldParent,
|
||||
#endif
|
||||
aNewParent, aDirection);
|
||||
ReparentFrameInternal(aFrame, aOldParent, aNewParent, markDirty);
|
||||
}
|
||||
|
||||
static void ReparentFrames(nsFrameList& aFrameList,
|
||||
nsContainerFrame* aOldParent,
|
||||
nsContainerFrame* aNewParent,
|
||||
ReparentingDirection aDirection) {
|
||||
const bool markDirty = ShouldMarkReparentedFramesDirty(
|
||||
#ifdef DEBUG
|
||||
aOldParent,
|
||||
#endif
|
||||
aNewParent, aDirection);
|
||||
nsContainerFrame* aNewParent) {
|
||||
for (nsFrameList::Enumerator e(aFrameList); !e.AtEnd(); e.Next()) {
|
||||
ReparentFrameInternal(e.get(), aOldParent, aNewParent, markDirty);
|
||||
ReparentFrame(e.get(), aOldParent, aNewParent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2339,15 +2283,14 @@ static bool LineHasClear(nsLineBox* aLine) {
|
|||
*/
|
||||
void nsBlockFrame::ReparentFloats(nsIFrame* aFirstFrame,
|
||||
nsBlockFrame* aOldParent,
|
||||
bool aReparentSiblings,
|
||||
ReparentingDirection aDirection) {
|
||||
bool aReparentSiblings) {
|
||||
nsFrameList list;
|
||||
aOldParent->CollectFloats(aFirstFrame, list, aReparentSiblings);
|
||||
if (list.NotEmpty()) {
|
||||
for (nsIFrame* f : list) {
|
||||
MOZ_ASSERT(!(f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT),
|
||||
"CollectFloats should've removed that bit");
|
||||
ReparentFrame(f, aOldParent, this, aDirection);
|
||||
ReparentFrame(f, aOldParent, this);
|
||||
}
|
||||
mFloats.AppendFrames(nullptr, list);
|
||||
}
|
||||
|
@ -2842,8 +2785,7 @@ void nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState) {
|
|||
if (pulledLine == nextInFlow->GetLineCursor()) {
|
||||
nextInFlow->ClearLineCursor();
|
||||
}
|
||||
ReparentFrames(pulledFrames, nextInFlow, this,
|
||||
ReparentingDirection::Backwards);
|
||||
ReparentFrames(pulledFrames, nextInFlow, this);
|
||||
|
||||
NS_ASSERTION(pulledFrames.LastChild() == pulledLine->LastChild(),
|
||||
"Unexpected last frame");
|
||||
|
@ -2860,8 +2802,7 @@ void nsBlockFrame::ReflowDirtyLines(BlockReflowInput& aState) {
|
|||
aState.mPrevChild = mFrames.LastChild();
|
||||
|
||||
// Reparent floats whose placeholders are in the line.
|
||||
ReparentFloats(pulledLine->mFirstChild, nextInFlow, true,
|
||||
ReparentingDirection::Backwards);
|
||||
ReparentFloats(pulledLine->mFirstChild, nextInFlow, true);
|
||||
|
||||
DumpLine(aState, pulledLine, deltaBCoord, 0);
|
||||
#ifdef DEBUG
|
||||
|
@ -3131,13 +3072,12 @@ nsIFrame* nsBlockFrame::PullFrameFrom(nsLineBox* aLine,
|
|||
|
||||
// When pushing and pulling frames we need to check for whether any
|
||||
// views need to be reparented.
|
||||
ReparentFrame(frame, aFromContainer, this, ReparentingDirection::Backwards);
|
||||
ReparentFrame(frame, aFromContainer, this);
|
||||
mFrames.AppendFrame(nullptr, frame);
|
||||
|
||||
// The frame might have (or contain) floats that need to be brought
|
||||
// over too. (pass 'false' since there are no siblings to check)
|
||||
ReparentFloats(frame, aFromContainer, false,
|
||||
ReparentingDirection::Backwards);
|
||||
ReparentFloats(frame, aFromContainer, false);
|
||||
} else {
|
||||
MOZ_ASSERT(aLine == aFromLine.prev());
|
||||
}
|
||||
|
@ -3869,8 +3809,7 @@ void nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
|
|||
return;
|
||||
}
|
||||
if (parent != this) {
|
||||
ReparentFrame(nextFrame, parent, this,
|
||||
ReparentingDirection::Variable);
|
||||
ReparentFrame(nextFrame, parent, this);
|
||||
}
|
||||
mFrames.InsertFrame(nullptr, frame, nextFrame);
|
||||
madeContinuation = true; // needs to be added to mLines
|
||||
|
@ -4509,8 +4448,7 @@ void nsBlockFrame::SplitFloat(BlockReflowInput& aState, nsIFrame* aFloat,
|
|||
DebugOnly<nsresult> rv = oldParent->StealFrame(nextInFlow);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "StealFrame failed");
|
||||
if (oldParent != this) {
|
||||
ReparentFrame(nextInFlow, oldParent, this,
|
||||
ReparentingDirection::Backwards);
|
||||
ReparentFrame(nextInFlow, oldParent, this);
|
||||
}
|
||||
if (!aFloatStatus.IsOverflowIncomplete()) {
|
||||
nextInFlow->RemoveStateBits(NS_FRAME_IS_OVERFLOW_CONTAINER);
|
||||
|
@ -5007,8 +4945,7 @@ bool nsBlockFrame::DrainOverflowLines() {
|
|||
FrameLines* overflowLines = prevBlock->RemoveOverflowLines();
|
||||
if (overflowLines) {
|
||||
// Make all the frames on the overflow line list mine.
|
||||
ReparentFrames(overflowLines->mFrames, prevBlock, this,
|
||||
ReparentingDirection::Forwards);
|
||||
ReparentFrames(overflowLines->mFrames, prevBlock, this);
|
||||
|
||||
// Collect overflow containers from our [Excess]OverflowContainers lists
|
||||
// that are continuations from the frames we picked up from our
|
||||
|
@ -5054,8 +4991,7 @@ bool nsBlockFrame::DrainOverflowLines() {
|
|||
pushedFloats.AppendFrame(nullptr, nif);
|
||||
}
|
||||
}
|
||||
ReparentFrames(oofs.mList, prevBlock, this,
|
||||
ReparentingDirection::Forwards);
|
||||
ReparentFrames(oofs.mList, prevBlock, this);
|
||||
mFloats.InsertFrames(nullptr, nullptr, oofs.mList);
|
||||
if (!pushedFloats.IsEmpty()) {
|
||||
nsFrameList* pf = EnsurePushedFloats();
|
||||
|
|
|
@ -522,7 +522,7 @@ class nsBlockFrame : public nsContainerFrame {
|
|||
}
|
||||
|
||||
void ReparentFloats(nsIFrame* aFirstFrame, nsBlockFrame* aOldParent,
|
||||
bool aReparentSiblings, ReparentingDirection aDirection);
|
||||
bool aReparentSiblings);
|
||||
|
||||
virtual bool ComputeCustomOverflow(nsOverflowAreas& aOverflowAreas) override;
|
||||
|
||||
|
|
|
@ -1490,8 +1490,7 @@ bool nsContainerFrame::MoveInlineOverflowToChildList(nsIFrame* aLineContainer) {
|
|||
// container if the container has prev continuation.
|
||||
if (aLineContainer->GetPrevContinuation()) {
|
||||
ReparentFloatsForInlineChild(aLineContainer,
|
||||
prevOverflowFrames->FirstChild(), true,
|
||||
ReparentingDirection::Forwards);
|
||||
prevOverflowFrames->FirstChild(), true);
|
||||
}
|
||||
// When pushing and pulling frames we need to check for whether
|
||||
// any views need to be reparented.
|
||||
|
@ -1639,9 +1638,9 @@ nsIFrame* nsContainerFrame::PullNextInFlowChild(
|
|||
}
|
||||
|
||||
/* static */
|
||||
void nsContainerFrame::ReparentFloatsForInlineChild(
|
||||
nsIFrame* aOurLineContainer, nsIFrame* aFrame, bool aReparentSiblings,
|
||||
ReparentingDirection aDirection) {
|
||||
void nsContainerFrame::ReparentFloatsForInlineChild(nsIFrame* aOurLineContainer,
|
||||
nsIFrame* aFrame,
|
||||
bool aReparentSiblings) {
|
||||
// XXXbz this would be better if it took a nsFrameList or a frame
|
||||
// list slice....
|
||||
NS_ASSERTION(aOurLineContainer->GetNextContinuation() ||
|
||||
|
@ -1661,7 +1660,7 @@ void nsContainerFrame::ReparentFloatsForInlineChild(
|
|||
NS_ASSERTION(ourBlock, "Not a block, but broke vertically?");
|
||||
|
||||
while (true) {
|
||||
ourBlock->ReparentFloats(aFrame, frameBlock, false, aDirection);
|
||||
ourBlock->ReparentFloats(aFrame, frameBlock, false);
|
||||
|
||||
if (!aReparentSiblings) return;
|
||||
nsIFrame* next = aFrame->GetNextSibling();
|
||||
|
@ -1674,8 +1673,7 @@ void nsContainerFrame::ReparentFloatsForInlineChild(
|
|||
// trust that the frames in the sibling chain all have the same parent,
|
||||
// because lazy reparenting may be going on. If we find a different
|
||||
// parent we need to redo our analysis.
|
||||
ReparentFloatsForInlineChild(aOurLineContainer, next, aReparentSiblings,
|
||||
aDirection);
|
||||
ReparentFloatsForInlineChild(aOurLineContainer, next, aReparentSiblings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -596,8 +596,7 @@ class nsContainerFrame : public nsSplittableFrame {
|
|||
*/
|
||||
static void ReparentFloatsForInlineChild(nsIFrame* aOurBlock,
|
||||
nsIFrame* aFrame,
|
||||
bool aReparentSiblings,
|
||||
ReparentingDirection aDirection);
|
||||
bool aReparentSiblings);
|
||||
|
||||
// ==========================================================================
|
||||
/*
|
||||
|
|
|
@ -756,8 +756,7 @@ nsIFrame* nsInlineFrame::PullOneFrame(nsPresContext* aPresContext,
|
|||
// The blockChildren.ContainsFrame check performed by
|
||||
// ReparentFloatsForInlineChild will be fast because frame's ancestor
|
||||
// will be the first child of its containing block.
|
||||
ReparentFloatsForInlineChild(irs.mLineContainer, frame, false,
|
||||
ReparentingDirection::Backwards);
|
||||
ReparentFloatsForInlineChild(irs.mLineContainer, frame, false);
|
||||
}
|
||||
nextInFlow->mFrames.RemoveFirstChild();
|
||||
// nsFirstLineFrame::PullOneFrame calls ReparentComputedStyle.
|
||||
|
|
|
@ -746,8 +746,7 @@ void nsRubyBaseContainerFrame::PullOneColumn(nsLineLayout* aLineLayout,
|
|||
MOZ_ASSERT(newFloatCB, "Must have a float containing block");
|
||||
if (oldFloatCB != newFloatCB) {
|
||||
for (nsIFrame* frame : aColumn) {
|
||||
newFloatCB->ReparentFloats(frame, oldFloatCB, false,
|
||||
ReparentingDirection::Backwards);
|
||||
newFloatCB->ReparentFloats(frame, oldFloatCB, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -388,8 +388,7 @@ nsRubyBaseContainerFrame* nsRubyFrame::PullOneSegment(
|
|||
if (nsBlockFrame* newFloatCB =
|
||||
do_QueryFrame(aLineLayout->LineContainerFrame())) {
|
||||
if (oldFloatCB && oldFloatCB != newFloatCB) {
|
||||
newFloatCB->ReparentFloats(baseFrame, oldFloatCB, true,
|
||||
ReparentingDirection::Backwards);
|
||||
newFloatCB->ReparentFloats(baseFrame, oldFloatCB, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче