commit 842b503b5758dcdb90d4aea8a6081d7c876d443e
parent 3031f3f7d434094f11a6bd61b1d7ceae18ba9958
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Sat, 1 Nov 2025 09:48:20 +0000
Bug 1997630 - Text nodes can't ever be display: contents. r=layout-reviewers,dshin
Minor optimization, no behavior change.
Differential Revision: https://phabricator.services.mozilla.com/D270892
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
@@ -7386,8 +7386,8 @@ bool nsCSSFrameConstructor::ContentWillBeRemoved(nsIContent* aChild,
// complexity for the display: none -> other case, which right now
// unnecessarily walks the content tree down.
auto CouldHaveBeenDisplayContents = [aKind](nsIContent* aContent) -> bool {
- return aKind == RemovalKind::ForReconstruction ||
- IsDisplayContents(aContent);
+ return aContent->IsElement() && (aKind == RemovalKind::ForReconstruction ||
+ IsDisplayContents(aContent->AsElement()));
};
if (!childFrame && CouldHaveBeenDisplayContents(aChild)) {