summaryrefslogtreecommitdiffstats
path: root/layout/base
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-16 17:54:38 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-16 17:54:38 -0400
commit4630e4abb531e416f8153846d422794de20261bd (patch)
tree6df1c5bc7a1b602c2adcd98d1a490584d60e0d07 /layout/base
parent2c4d69359fc76d115c62e14383c4eef21f6b1ba5 (diff)
downloadUXP-4630e4abb531e416f8153846d422794de20261bd.tar
UXP-4630e4abb531e416f8153846d422794de20261bd.tar.gz
UXP-4630e4abb531e416f8153846d422794de20261bd.tar.lz
UXP-4630e4abb531e416f8153846d422794de20261bd.tar.xz
UXP-4630e4abb531e416f8153846d422794de20261bd.zip
Bug 1343879 - Be consistent about the parent style context the document-level anonymous content container should get: it should get no parent style context.
Tag #1375
Diffstat (limited to 'layout/base')
-rw-r--r--layout/base/nsCSSFrameConstructor.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index e88b2d62c..374764203 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -10751,16 +10751,22 @@ nsCSSFrameConstructor::AddFCItemsForAnonymousContent(
}
}
- if (inheritFrame->GetType() == nsGkAtoms::canvasFrame) {
- // CorrectStyleParentFrame returns nullptr if the prospective parent is
- // the canvas frame, so avoid calling it in that situation.
- } else {
- inheritFrame = nsFrame::CorrectStyleParentFrame(inheritFrame, pseudo);
- }
- Element* originating = pseudo ? inheritFrame->GetContent()->AsElement() : nullptr;
-
+ nsIFrame* styleParentFrame =
+ nsFrame::CorrectStyleParentFrame(inheritFrame, pseudo);
+ // The only way we can not have a style parent now is if inheritFrame is the
+ // canvas frame and we're the NAC parent for all the things added via
+ // nsIDocument::InsertAnonymousContent.
+ MOZ_ASSERT_IF(!styleParentFrame,
+ inheritFrame->GetType() == nsGkAtoms::canvasFrame);
+ // And that anonymous div has no pseudo.
+ MOZ_ASSERT_IF(!styleParentFrame, !pseudo);
+
+ Element* originating =
+ pseudo ? styleParentFrame->GetContent()->AsElement() : nullptr;
+ nsStyleContext* parentStyle =
+ styleParentFrame ? styleParentFrame->StyleContext() : nullptr;
styleContext =
- ResolveStyleContext(inheritFrame->StyleContext(), content, &aState, originating);
+ ResolveStyleContext(parentStyle, content, &aState, originating);
nsTArray<nsIAnonymousContentCreator::ContentInfo>* anonChildren = nullptr;
if (!aAnonymousItems[i].mChildren.IsEmpty()) {