Bug 1435015: Unbreak display: contents on unknown MathML elements. r=mats

Bug 1427292 broke display: contents on non-special MathML elements.

Just for reference, I've manually audited calls to nsIFrame::GetContent() in
MathML and turns out that MathML is pretty well-behaved in that sense (it
inspects the frame tree, then gets the content), so it should work fine with
display: contents / ShadowDOM.

Only exception to that is[1], but that one seems harmless.

[1]: https://searchfox.org/mozilla-central/rev/eeb7190f9ad6f1a846cd6df09986325b3f2c3117/layout/mathml/nsMathMLmactionFrame.cpp#301

So we can enable or implement when the CSSWG pleases.

MozReview-Commit-ID: 8N6kiGyjE4i

--HG--
extra : rebase_source : a80197e39b20bc6ab385a3d0b90628bc4ad81d92
This commit is contained in:
Emilio Cobos Álvarez 2018-02-02 20:52:54 +01:00
parent fe694732ac
commit 200a23f376
3 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,9 @@
<!doctype html>
<style>
div { display: contents; }
</style>
<math></math>
<script>
let div = document.createElementNS('http://www.w3.org/1998/Math/MathML', 'div');
document.querySelector('math').appendChild(div);
</script>

View File

@ -522,3 +522,4 @@ load 1425893.html
load 1428353.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1429088.html
load 1429961.html
load 1435015.html

View File

@ -6095,6 +6095,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
}
bool isPopup = false;
bool foundMathMLData = false;
// Try to find frame construction data for this content
const FrameConstructionData* data;
if (isText) {
@ -6124,6 +6125,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
}
if (!data) {
data = FindMathMLData(element, aTag, aNameSpaceID, styleContext);
foundMathMLData = !!data;
}
if (!data) {
data = FindSVGData(element, aTag, aNameSpaceID, aParentFrame,
@ -6189,7 +6191,7 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
//
// Figure out what should happen for display: contents in MathML.
if (display->mDisplay == StyleDisplay::Contents &&
!aContent->IsMathMLElement()) {
!foundMathMLData) {
if (!GetDisplayContentsStyleFor(aContent)) {
MOZ_ASSERT(styleContext->GetPseudo() || !isGeneratedContent,
"Should have had pseudo type");