Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2023-03-27 16:11:31 +08:00
commit 77fe104113

View file

@ -8192,26 +8192,10 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
MOZ_ASSERT(!childFrame || !GetDisplayContentsStyleFor(aChild), MOZ_ASSERT(!childFrame || !GetDisplayContentsStyleFor(aChild),
"display:contents nodes shouldn't have a frame"); "display:contents nodes shouldn't have a frame");
if (!childFrame && GetDisplayContentsStyleFor(aChild)) { if (!childFrame && GetDisplayContentsStyleFor(aChild)) {
nsIContent* ancestor = aChild->GetFlattenedTreeParent(); // NOTE(emilio): We may iterate through ::before and ::after here and they
MOZ_ASSERT(ancestor, "display: contents on the root?"); // may be gone after the respective ContentRemoved call. Right now
while (!ancestor->GetPrimaryFrame()) { // StyleChildrenIterator handles that properly, so it's not an issue.
ancestor = ancestor->GetFlattenedTreeParent(); StyleChildrenIterator iter(aChild);
MOZ_ASSERT(ancestor, "we can't have a display: contents subtree root!");
}
nsIFrame* ancestorFrame = ancestor->GetPrimaryFrame();
if (ancestorFrame->GetProperty(nsIFrame::GenConProperty())) {
*aDidReconstruct = true;
// XXXmats Can we recreate frames only for the ::after/::before content?
// XXX Perhaps even only those that belong to the aChild sub-tree?
LAYOUT_PHASE_TEMP_EXIT();
RecreateFramesForContent(ancestor, insertionKind, aFlags);
LAYOUT_PHASE_TEMP_REENTER();
return;
}
FlattenedChildIterator iter(aChild);
for (nsIContent* c = iter.GetNextChild(); c; c = iter.GetNextChild()) { for (nsIContent* c = iter.GetNextChild(); c; c = iter.GetNextChild()) {
if (c->GetPrimaryFrame() || GetDisplayContentsStyleFor(c)) { if (c->GetPrimaryFrame() || GetDisplayContentsStyleFor(c)) {
LAYOUT_PHASE_TEMP_EXIT(); LAYOUT_PHASE_TEMP_EXIT();
@ -8391,8 +8375,13 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
NS_ASSERTION(childFrame, "Missing placeholder frame for out of flow."); NS_ASSERTION(childFrame, "Missing placeholder frame for out of flow.");
parentFrame = childFrame->GetParent(); parentFrame = childFrame->GetParent();
} }
RemoveFrame(nsLayoutUtils::GetChildListNameFor(childFrame), childFrame); RemoveFrame(nsLayoutUtils::GetChildListNameFor(childFrame), childFrame);
// NOTE(emilio): aChild could be dead here already if it is a ::before or
// ::after pseudo-element (since in that case it was owned by childFrame,
// which we just destroyed).
if (isRoot) { if (isRoot) {
mRootElementFrame = nullptr; mRootElementFrame = nullptr;
mRootElementStyleFrame = nullptr; mRootElementStyleFrame = nullptr;
@ -8412,8 +8401,7 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
// to do this if the table parent type of our parent type is not // to do this if the table parent type of our parent type is not
// eTypeBlock, though, because in that case the whitespace isn't // eTypeBlock, though, because in that case the whitespace isn't
// being suppressed due to us anyway. // being suppressed due to us anyway.
if (aContainer && !aChild->IsRootOfAnonymousSubtree() && if (aContainer && aOldNextSibling && aFlags == REMOVE_CONTENT &&
aFlags == REMOVE_CONTENT &&
GetParentType(parentType) == eTypeBlock) { GetParentType(parentType) == eTypeBlock) {
// Adjacent whitespace-only text nodes might have been suppressed if // Adjacent whitespace-only text nodes might have been suppressed if
// this node does not have inline ends. Create frames for them now // this node does not have inline ends. Create frames for them now
@ -8428,17 +8416,15 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
// //
// FIXME(emilio): This should probably use the lazy frame construction // FIXME(emilio): This should probably use the lazy frame construction
// bits if possible instead of reframing it in place. // bits if possible instead of reframing it in place.
if (aOldNextSibling) { nsIContent* prevSibling = aOldNextSibling->GetPreviousSibling();
nsIContent* prevSibling = aOldNextSibling->GetPreviousSibling(); if (prevSibling && prevSibling->GetPreviousSibling()) {
if (prevSibling && prevSibling->GetPreviousSibling()) { LAYOUT_PHASE_TEMP_EXIT();
LAYOUT_PHASE_TEMP_EXIT(); ReframeTextIfNeeded(aContainer, prevSibling);
ReframeTextIfNeeded(aContainer, prevSibling); LAYOUT_PHASE_TEMP_REENTER();
LAYOUT_PHASE_TEMP_REENTER();
}
} }
// Reframe any text node just after the node being removed, if there is // Reframe any text node just after the node being removed, if there is
// one, and if it's not the last child or the first child. // one, and if it's not the last child or the first child.
if (aOldNextSibling && aOldNextSibling->GetNextSibling() && if (aOldNextSibling->GetNextSibling() &&
aOldNextSibling->GetPreviousSibling()) { aOldNextSibling->GetPreviousSibling()) {
LAYOUT_PHASE_TEMP_EXIT(); LAYOUT_PHASE_TEMP_EXIT();
ReframeTextIfNeeded(aContainer, aOldNextSibling); ReframeTextIfNeeded(aContainer, aOldNextSibling);