commit a3acf350c2af92f85fffb534888d09415286a6ab
parent a2f7844ff12ff81ed6ae02c38f161dcbb6603357
Author: Serban Stanca <sstanca@mozilla.com>
Date: Fri, 3 Oct 2025 13:28:44 +0300
Revert "Bug 1948933 - Avoid looking up insertion point when turning something into display: none. r=layout-reviewers,tnikkel" for causing multiple failures.
This reverts commit 454911cd834f085439203f6e66a285ceaeeeac40.
Diffstat:
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
@@ -8475,13 +8475,9 @@ void nsCSSFrameConstructor::RecreateFramesForContent(
MOZ_ASSERT(aContent->GetParentNode());
const bool didReconstruct =
ContentWillBeRemoved(aContent, REMOVE_FOR_RECONSTRUCTION);
- if (didReconstruct) {
- // If ContentWillBeRemoved triggered reconstruction, then we don't need to
- // do anything else because the frames will already have been built.
- return;
- }
- if (aContent->IsElement()) {
- if (aInsertionKind == InsertionKind::Async) {
+
+ if (!didReconstruct) {
+ if (aInsertionKind == InsertionKind::Async && aContent->IsElement()) {
// FIXME(emilio, bug 1397239): There's nothing removing the frame state
// for elements that go away before we come back to the frame
// constructor.
@@ -8491,16 +8487,14 @@ void nsCSSFrameConstructor::RecreateFramesForContent(
// construction to apply to all elements first.
RestyleManager()->PostRestyleEvent(aContent->AsElement(), RestyleHint{0},
nsChangeHint_ReconstructFrame);
- return;
- }
- // If we're display: none, there's no point on trying to find an insertion
- // point, we're done.
- if (Servo_Element_IsDisplayNone(aContent->AsElement())) {
- return;
+ } else {
+ // Now, recreate the frames associated with this content object. If
+ // ContentWillBeRemoved triggered reconstruction, then we don't need to do
+ // this because the frames will already have been built.
+ ContentRangeInserted(aContent, aContent->GetNextSibling(),
+ aInsertionKind);
}
}
- // Now, recreate the frames associated with this content object.
- ContentRangeInserted(aContent, aContent->GetNextSibling(), aInsertionKind);
}
bool nsCSSFrameConstructor::DestroyFramesFor(nsIContent* aContent) {