Bug 1793826 Part 1 - Change nsFrameList::ExtractHead and ExtractTail to take nsIFrame* argument. r=emilio

This is a preparation to remove nsFrameList::FrameLinkEnumerator in the next
part.

Differential Revision: https://phabricator.services.mozilla.com/D158700
This commit is contained in:
Ting-Yu Lin
2022-10-06 06:47:25 +00:00
parent 2c54eaad13
commit 6656a45e40
6 changed files with 93 additions and 122 deletions

View File

@@ -11007,13 +11007,17 @@ nsIFrame* nsCSSFrameConstructor::ConstructInline(
ConstructFramesFromItemList(aState, aItem.mChildItems, newFrame,
/* aParentIsWrapperAnonBox = */ false, childList);
nsFrameList::FrameLinkEnumerator firstBlockEnumerator(childList);
nsIFrame* firstBlock = nullptr;
if (!aItem.mIsAllInline) {
firstBlockEnumerator.Find(
[](nsIFrame* aFrame) { return aFrame->IsBlockOutside(); });
for (nsIFrame* f : childList) {
if (f->IsBlockOutside()) {
firstBlock = f;
break;
}
}
}
if (aItem.mIsAllInline || firstBlockEnumerator.AtEnd()) {
if (aItem.mIsAllInline || !firstBlock) {
// This part is easy. We either already know we have no non-inline kids,
// or haven't found any when constructing actual frames (the latter can
// happen only if out-of-flows that we thought had no containing block
@@ -11029,7 +11033,7 @@ nsIFrame* nsCSSFrameConstructor::ConstructInline(
// has to be chopped into several pieces, as described above.
// Grab the first inline's kids
nsFrameList firstInlineKids = childList.ExtractHead(firstBlockEnumerator);
nsFrameList firstInlineKids = childList.ExtractHead(firstBlock);
newFrame->SetInitialChildList(kPrincipalList, firstInlineKids);
aFrameList.AppendFrame(nullptr, newFrame);