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

"initial" is not a legal specified value that can be checked #154

Closed
NSoiffer opened this issue Oct 14, 2019 · 7 comments
Closed

"initial" is not a legal specified value that can be checked #154

NSoiffer opened this issue Oct 14, 2019 · 7 comments
Labels
css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification

Comments

@NSoiffer
Copy link
Contributor

NSoiffer commented Oct 14, 2019

In the spec, the scriptlevel mentions checking for initial. This is not legal according to the CSS spec.

The currently says:

If font-size is specified or if the specified value of math-script-level is initial then math-script-level does not affect the computed value of font-size.

The spec should check against 0, which is the initial value. The spec should probably say this.

@tabatkins
Copy link
Member

Yes, the 'initial' keyword disappears by specified value time, via the defaulting process. https://drafts.csswg.org/css-cascade/#specified

They're technically visible at earlier stages, but those stages aren't exposed or manipulated by anything else; they're a spec fiction to help explain the process in detail.

So yeah, key off of the actual initial value, not the 'initial' keyword.

@fred-wang fred-wang added css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification need resolution Issues needing resolution at MathML Refresh CG meeting need specification update Issues requiring specification changes need tests Issues related to writing WPT tests labels Nov 12, 2019
@fred-wang
Copy link

Checking against 0 won't cover the usual case where the user explicitly resets the scriptlevel to the font-size of the <math> root:

<math>
  <mfrac>
    <mstyle scriptlevel="0">...</mstyle>
    <mrow>...</mrow>
  </mfrac>
</math>

In order to ensure that CSS math-script-level=0 corresponds to MathML3's scriptlevel="0", the UA sheet has the following rule:

math {
    math-script-level: initial;
}

and in order to prevent this rule from changing font-size (if math-script-level was set to a nonzero value in one ancestor) the math-script-level definition contains "the specified value of math-script-level is initial". I believe we were able to check and test this case in our Chromium implementation but maybe it was wrong and we shouldn't do that if that's not allowed by the CSS anyway.

So I see two options:

(1) Either remove both "math-script-level: initial" and "the specified value of math-script-level is initial". This means that if someone sets math-script-level to nonzero on an ancestor (e.g. with nested <math> tags) then we would have a mismatch between CSS/Core and MathML3's concept.

(2) Or keep "math-script-level: initial" and remove "the specified value of math-script-level is initial". This means that if someone sets math-script-level to nonzero on an ancestor (e.g. with nested <math> tags) then the font-size will be reset on the <math> tag.

@fred-wang
Copy link

(of course a third option would be to introduce a new keyword, but probably not worth it if at the end we do #174 )

@brucemiller
Copy link
Contributor

Is there a notion of the font-size effective at the math element? If so, call it initial-font-size, then rather than saying that script-level=0 does not change the font size, it could say that it resets it to the initial-font-size.

@NSoiffer
Copy link
Contributor Author

NSoiffer commented Apr 6, 2020

The intent of setting scriptlevel="0" is that the font size is reset to the initial value. That's what both Firefox and MathPlayer do... at least in the trivial test I tried:

<math xmlns="http://www.w3.org/1998/Math/MathML">
  <mfrac>
    <mstyle scriptlevel="0">
      <mn>1</mn>
    </mstyle>
    <mn>2</mn>
  </mfrac>
</math>

@fred-wang
Copy link

Is there a notion of the font-size effective at the math element? If so, call it initial-font-size, then rather than saying that script-level=0 does not change the font size, it could say that it resets it to the initial-font-size.

Yes, but CSS resolution of an element cannot directly involve the values of arbitrary ancestors, it just uses the one inherited from its the parent.

As Neil said, scriptlevel=0 is already supposed to move back to the initial size, except in edge cases when someone decides to modify the font-size inside the formula (e.g. using mathsize) or when the minsize had been reached due to too many nested expressions.

My comment was about nested <math> tag, which I also consider an edge case. This was discussed in the CG meeting with Emilio.

@fred-wang fred-wang removed need resolution Issues needing resolution at MathML Refresh CG meeting need specification update Issues requiring specification changes need tests Issues related to writing WPT tests labels May 22, 2020
@fred-wang
Copy link

Closing after the change in https://github.com/mathml-refresh/mathml/issues/174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification
Projects
None yet
Development

No branches or pull requests

4 participants