Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interoperable handling of invalid markup for mmultiscripts #61

Open
NSoiffer opened this issue Nov 1, 2019 · 3 comments
Open

Interoperable handling of invalid markup for mmultiscripts #61

NSoiffer opened this issue Nov 1, 2019 · 3 comments

Comments

@NSoiffer
Copy link
Contributor

NSoiffer commented Nov 1, 2019

This is a special case of #136. Because mmultiscripts is "special" in it's argument handling, some of the ideas discussed in #136 potentially need special details added to handle mmultiscripts. I've opened a separate issue to discuss what should happen because the argument processing for mmultiscripts are more complicated than for other elements....

To recap, the arguments to mmultiscripts are:

  • the base (required)
  • optional pairs of arguments that represent the postscripts
  • optional <mprescripts/> to indicate the following args are prescripts
  • optional pairs of arguments that represent the prescripts

#136 has two cases: too few arguments and too many arguments.

One solution proposed is that if there are the wrong number of arguments, then lay the children out in an mrow. That sort of works, but "wrong" number is not as simple as too few or too many children. Also one the children is <mprescripts/>, which doesn't have layout, and so would probably try to display its children, which it doesn't have, so it would disappear, essentially deleting some of the content.

Another proposed solution in #136 is to add missing arguments as empty mrows and to wrap extra arguments together with the last argument in an mrow to make the number of children correct. This is doable, but again, the notion of too few and too many is more complex and needs to be specified for this element.

@NSoiffer
Copy link
Contributor Author

@fred-wang: this can be closed if there are tests for wrong number of children, extra , and other invalid markup cases involving the children.

@NSoiffer NSoiffer transferred this issue from w3c/mathml Jun 29, 2021
@fred-wang
Copy link
Contributor

The current text follows what we decided for level 1: just fallback to <mrow> layout for invalid markup:

A valid <mmultiscripts> element contains the following in-flow children:

...

If an <mmultiscripts> element is not valid then it is laid out the same as the <mrow> element. Otherwise the layout algorithm is explained below. 

I'm adding the "needs-test" label to check again current coverage.

@fred-wang
Copy link
Contributor

  • <mprescripts> is laid out as <mrow> (the specification does not force it to be "empty"). Tests were added in [Gecko Bug 1802336] Align none/mprescripts on MathML Core. web-platform-tests/wpt#37173

  • The spec says to layout mmultiscripts as an <mrow> if the element's children are not of this form:

    • A first in-flow child, called the mmultiscripts base, that is not an mprescripts element.
    • Followed by an even number of in-flow children called mmultiscripts postscripts, none of them being a mprescripts element. These scripts form a (possibly empty) list subscript, superscript, subscript, superscript, subscript, superscript, etc. Each consecutive couple of children subscript, superscript is called a subscript/superscript pair.
    • Optionally followed by an mprescripts element and an even number of in-flow children called mmultiscripts prescripts, none of them being a mprescripts element. These scripts form a (possibly empty) list of subscript/superscript pair.
  • https://wpt.fyi/results/mathml/presentation-markup/mrow/mrow-fallback.html checks the mrow fallback for the following invalid cases:

  <mmultiscripts>
  </mmultiscripts>

  <mmultiscripts>
    <mspace height="5px" depth="15px" width="10px" style="background: black"/>
    <mspace height="30px" depth="10px" width="20px" style="background: black"/>
  </mmultiscripts>

  <mmultiscripts>
    <mspace height="5px" depth="15px" width="10px" style="background: black"/>
    <mspace height="30px" depth="10px" width="20px" style="background: black"/>
    <mspace height="15px" depth="45px" width="30px" style="background: black"/>
    <mspace height="60px" depth="20px" width="40px" style="background: black"/>
  </mmultiscripts>

  <mmultiscripts>
    <mspace height="5px" depth="15px" width="10px" style="background: black"/>
    <mspace height="30px" depth="10px" width="20px" style="background: black"/>
    <mspace height="15px" depth="45px" width="30px" style="background: black"/>
    <mspace height="60px" depth="20px" width="40px" style="background: black"/>
    <mspace height="25px" depth="75px" width="50px" style="background: black"/>
    <mprescripts/>
    <mspace height="35px" depth="105px" width="70px" style="background: black"/>
  </mmultiscripts>

  <mmultiscripts>
    <mspace height="5px" depth="15px" width="10px" style="background: black"/>
    <mspace height="30px" depth="10px" width="20px" style="background: black"/>
    <mspace height="15px" depth="45px" width="30px" style="background: black"/>
    <mspace height="60px" depth="20px" width="40px" style="background: black"/>
    <mspace height="25px" depth="75px" width="50px" style="background: black"/>
    <mprescripts/>
    <mspace height="35px" depth="105px" width="70px" style="background: black"/>
    <mspace height="120px" depth="40px" width="80px" style="background: black"/>
    <mspace height="45px" depth="135px" width="90px" style="background: black"/>
  </mmultiscripts>

  <mmultiscripts>
    <mspace height="5px" depth="15px" width="10px" style="background: black"/>
    <mspace height="30px" depth="10px" width="20px" style="background: black"/>
    <mspace height="15px" depth="45px" width="30px" style="background: black"/>
    <mspace height="60px" depth="20px" width="40px" style="background: black"/>
    <mspace height="25px" depth="75px" width="50px" style="background: black"/>
    <mprescripts/>
    <mspace height="35px" depth="105px" width="70px" style="background: black"/>
    <mspace height="120px" depth="40px" width="80px" style="background: black"/>
    <mspace height="45px" depth="135px" width="90px" style="background: black"/>
    <mspace height="150px" depth="50px" width="100px" style="background: black"/>
    <mspace height="55px" depth="165px" width="110px" style="background: black"/>
  </mmultiscripts>
  • I believe the following cases are not covered by existing tests (ignoring the "in-flow" term for the present issue, which is covered by other tests):
    • The first child is an mprescripts.
    • One of the even number of children after the mprescripts is an mprescripts.

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this issue Dec 22, 2022
…r invalid mmultiscripts, a=testonly

Automatic update from web-platform-tests
Add more tests to check mrow fallback for invalid mmultiscripts (#37404)

See w3c/mathml-core#61 (comment)
--

wpt-commits: 685d3f47d15acf60251fc6be9e825ed97c47e125
wpt-pr: 37404
jamienicol pushed a commit to jamienicol/gecko that referenced this issue Jan 3, 2023
…r invalid mmultiscripts, a=testonly

Automatic update from web-platform-tests
Add more tests to check mrow fallback for invalid mmultiscripts (#37404)

See w3c/mathml-core#61 (comment)
--

wpt-commits: 685d3f47d15acf60251fc6be9e825ed97c47e125
wpt-pr: 37404
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants