зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1798373 Part 4 - Remove nsFrameList::SetFrames() that takes nsFrameList. r=emilio
SetFrame() is equivalent to `operator=`, so external callers can use `operator=` instead. For the two callers wanting to set `nsFrameList` to `AbsoluteFrameList` in `nsCSSFrameConstructor`, removing SetFrame() disallows it. However, we can easily change the declaration from `nsFrameList` to a `AbsoluteFrameList` to resolve the problem. Differential Revision: https://phabricator.services.mozilla.com/D160840
This commit is contained in:
Родитель
2d28e97d61
Коммит
fc3719b5aa
|
@ -996,7 +996,7 @@ void nsFrameConstructorState::ReparentAbsoluteItems(
|
|||
MOZ_ASSERT(aNewParent->HasAnyStateBits(NS_FRAME_HAS_MULTI_COLUMN_ANCESTOR),
|
||||
"Restrict the usage under column hierarchy.");
|
||||
|
||||
nsFrameList newAbsoluteItems;
|
||||
AbsoluteFrameList newAbsoluteItems(aNewParent);
|
||||
|
||||
nsIFrame* current = mAbsoluteList.FirstChild();
|
||||
while (current) {
|
||||
|
@ -1020,7 +1020,7 @@ void nsFrameConstructorState::ReparentAbsoluteItems(
|
|||
// It doesn't matter whether aNewParent has position style or not. Caller
|
||||
// won't call us if we can't have absolute children.
|
||||
PushAbsoluteContainingBlock(aNewParent, aNewParent, absoluteSaveState);
|
||||
mAbsoluteList.SetFrames(newAbsoluteItems);
|
||||
mAbsoluteList = std::move(newAbsoluteItems);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1032,7 +1032,7 @@ void nsFrameConstructorState::ReparentFloats(nsContainerFrame* aNewParent) {
|
|||
"Why calling this method if aNewParent is not a float containing block?");
|
||||
|
||||
// Gather floats that should reparent under aNewParent.
|
||||
nsFrameList floats;
|
||||
AbsoluteFrameList floats(aNewParent);
|
||||
nsIFrame* current = mFloatedList.FirstChild();
|
||||
while (current) {
|
||||
nsIFrame* placeholder = current->GetPlaceholderFrame();
|
||||
|
@ -1049,7 +1049,7 @@ void nsFrameConstructorState::ReparentFloats(nsContainerFrame* aNewParent) {
|
|||
// ~nsFrameConstructorSaveState() when destructing floatSaveState.
|
||||
nsFrameConstructorSaveState floatSaveState;
|
||||
PushFloatContainingBlock(aNewParent, floatSaveState);
|
||||
mFloatedList.SetFrames(floats);
|
||||
mFloatedList = std::move(floats);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ void nsAbsoluteContainingBlock::SetInitialChildList(nsIFrame* aDelegatingFrame,
|
|||
MOZ_ASSERT(f->GetParent() == aDelegatingFrame, "Unexpected parent");
|
||||
}
|
||||
#endif
|
||||
mAbsoluteFrames.SetFrames(aChildList);
|
||||
mAbsoluteFrames = std::move(aChildList);
|
||||
}
|
||||
|
||||
void nsAbsoluteContainingBlock::AppendFrames(nsIFrame* aDelegatingFrame,
|
||||
|
|
|
@ -7482,7 +7482,7 @@ void nsBlockFrame::Init(nsIContent* aContent, nsContainerFrame* aParent,
|
|||
void nsBlockFrame::SetInitialChildList(ChildListID aListID,
|
||||
nsFrameList& aChildList) {
|
||||
if (kFloatList == aListID) {
|
||||
mFloats.SetFrames(aChildList);
|
||||
mFloats = std::move(aChildList);
|
||||
} else if (kPrincipalList == aListID) {
|
||||
#ifdef DEBUG
|
||||
// The only times a block that is an anonymous box is allowed to have a
|
||||
|
|
|
@ -85,7 +85,7 @@ void nsContainerFrame::SetInitialChildList(ChildListID aListID,
|
|||
if (aListID == kPrincipalList) {
|
||||
MOZ_ASSERT(mFrames.IsEmpty(),
|
||||
"unexpected second call to SetInitialChildList");
|
||||
mFrames.SetFrames(aChildList);
|
||||
mFrames = std::move(aChildList);
|
||||
} else if (aListID == kBackdropList) {
|
||||
MOZ_ASSERT(StyleDisplay()->mTopLayer != StyleTopLayer::None,
|
||||
"Only top layer frames should have backdrop");
|
||||
|
|
|
@ -78,7 +78,7 @@ void nsFirstLetterFrame::SetInitialChildList(ChildListID aListID,
|
|||
nsLayoutUtils::MarkDescendantsDirty(f); // Drops cached textruns
|
||||
}
|
||||
|
||||
mFrames.SetFrames(aChildList);
|
||||
mFrames = std::move(aChildList);
|
||||
}
|
||||
|
||||
nsresult nsFirstLetterFrame::GetChildFrameContainingOffset(
|
||||
|
|
|
@ -115,7 +115,10 @@ class nsFrameList {
|
|||
}
|
||||
nsFrameList& operator=(nsFrameList&& aOther) {
|
||||
if (this != &aOther) {
|
||||
SetFrames(aOther);
|
||||
MOZ_ASSERT(IsEmpty(), "Assigning to a non-empty list will lose frames!");
|
||||
mFirstChild = aOther.FirstChild();
|
||||
mLastChild = aOther.LastChild();
|
||||
aOther.Clear();
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -147,14 +150,6 @@ class nsFrameList {
|
|||
|
||||
void Clear() { mFirstChild = mLastChild = nullptr; }
|
||||
|
||||
void SetFrames(nsFrameList& aFrameList) {
|
||||
MOZ_ASSERT(!mFirstChild, "Losing frames");
|
||||
|
||||
mFirstChild = aFrameList.FirstChild();
|
||||
mLastChild = aFrameList.LastChild();
|
||||
aFrameList.Clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Append aFrameList to this list. If aParent is not null,
|
||||
* reparents the newly added frames. Clears out aFrameList and
|
||||
|
|
|
@ -308,7 +308,7 @@ void nsInlineFrame::Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
|
|||
// wait to do this until we actually reflow the frame. If the overflow
|
||||
// list contains thousands of frames this is a big performance issue
|
||||
// (see bug #5588)
|
||||
mFrames.SetFrames(*prevOverflowFrames);
|
||||
mFrames = std::move(*prevOverflowFrames);
|
||||
lazilySetParentPointer = true;
|
||||
} else {
|
||||
// Insert the new frames at the beginning of the child list
|
||||
|
|
|
@ -94,7 +94,7 @@ void nsTableWrapperFrame::SetInitialChildList(ChildListID aListID,
|
|||
// the frame constructor already checked for table-caption display type
|
||||
MOZ_ASSERT(mCaptionFrames.IsEmpty(),
|
||||
"already have child frames in CaptionList");
|
||||
mCaptionFrames.SetFrames(aChildList);
|
||||
mCaptionFrames = std::move(aChildList);
|
||||
} else {
|
||||
MOZ_ASSERT(kPrincipalList != aListID ||
|
||||
(aChildList.FirstChild() &&
|
||||
|
|
Загрузка…
Ссылка в новой задаче