Re: [csswg-drafts] [css-display] math/inline-math (#5385)

@fantasai wrote:
> And in terms of tests, we need a test for what happens with these display values on non-MathML elements either way

Indeed, and we should probably also move any spec text from the MathML spec to the CSS Display spec about any box tree "fixups" that happens when non-MathML elements are injected into this context.

For the record, here's what Gecko currently does:
https://searchfox.org/mozilla-central/rev/89d33e1c3b0a57a9377b4815c2f4b58d933b7c32/layout/base/nsCSSFrameConstructor.cpp#3764-3783
https://searchfox.org/mozilla-central/rev/89d33e1c3b0a57a9377b4815c2f4b58d933b7c32/layout/base/nsCSSFrameConstructor.cpp#4666-4702
https://searchfox.org/mozilla-central/rev/89d33e1c3b0a57a9377b4815c2f4b58d933b7c32/layout/mathml/mathml.css#213-217

Translated into English: each consecutive sequence of inlines or text are wrapped in an anonymous `-moz-mathml-anonymous-block` pseudo box, which is essentially a plain inline-block.  So for example:
```html
<math><ms>X</ms></math>
<script>
let math = document.querySelector("math");
let span = document.createElement("span");
span.append(document.createTextNode("b"));
math.prepend(span);
math.prepend(document.createTextNode("a"));
math.append(document.createTextNode("c"));
</script>
```

will create a box tree that looks something like this:
```
Inline(math) <
  ::-moz-mathml-anonymous-block(math) <
    Text("a")
    Inline(span) <
      Text("b")
    >
  >
  Box(ms)<... details intentionally left out ...>
  ::-moz-mathml-anonymous-block(math) <
    Text("c")
  >
>
```

which renders as: `ab"X"c`

I think details like this needs to be specced somewhere.

-- 
GitHub Notification of comment by MatsPalmgren
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5385#issuecomment-700089004 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 28 September 2020 15:30:35 UTC