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

New properties for CSS math-variant, script-level and math-style #31

Closed
fred-wang opened this issue Feb 22, 2019 · 14 comments
Closed

New properties for CSS math-variant, script-level and math-style #31

fred-wang opened this issue Feb 22, 2019 · 14 comments
Labels
css / html5 Issues related to CSS or HTML5 interoperability MathML Core Issues affecting the MathML Core specification

Comments

@fred-wang
Copy link

The current proposal is
https://mathml-refresh.github.io/mathml-css-proposals/ but there is currently a lot to discuss!

It's related also to the simplification of mstyle #1 so that it can just become pure CSS inheritance.

Please make sure to read the comments, as that might require some simplification of MathML too:
https://mathml-refresh.github.io/mathml-css-proposals/math-variant-comments.html
https://mathml-refresh.github.io/mathml-css-proposals/math-script-level-and-math-style-comments.html

cc @mrego

@fred-wang fred-wang added MathML Core Issues affecting the MathML Core specification css / html5 Issues related to CSS or HTML5 interoperability labels Feb 22, 2019
@fred-wang fred-wang added the need tests Issues related to writing WPT tests label Feb 28, 2019
@fred-wang
Copy link
Author

Just for the record, some feedback from the CSS WG was:

  1. Proposal and discussion should be moved to CSS WG github, even if it's still a draft.
  2. Mathvariant should probably be integrated into text-transform.
  3. People were considering the syntax "text-transform: math(fraktur);" . It seems this parenthesis syntax is becoming more and more popular.

(cc' @rego @rwbuis)

@fred-wang
Copy link
Author

fred-wang commented Mar 19, 2019

cc @rwlbuis @emilio

After yesterday's meeting I think we are close to be able to move this to the CSS WG. Proposal is to modify https://github.com/mathml-refresh/mathml-css-proposals/blob/master/math-script-level-and-math-style-explainer.md#css-math-script-level-property as follows:

#76 is not resolved.

@fred-wang
Copy link
Author

As @NSoiffer we should probably not spend too much time on the CSS details. I've modified the CSS proposals after the previous discussion/feedback and I've moved the proposals to csswg-drafts:

w3c/csswg-drafts#3745
w3c/csswg-drafts#3746

Let's see what the CSS WG people say.

@rwlbuis
Copy link

rwlbuis commented May 13, 2019

We implemented script-level as math-script-level as described here:
https://github.com/mathml-refresh/mathml-css-proposals/blob/master/math-script-level-and-math-style-explainer.md#native-implementations-of-display-displaystyle-and-scriptlevel

It turns out that exact timing of when to handle is hard when done in C++, by the time we can handle math-script-level the computed font size is pretty much determined already and hard to change anymore. Because of this for now we opted for a user agent stylesheet solution.

@rwlbuis
Copy link

rwlbuis commented May 13, 2019

To get fractions right we add such a rule (verbose because universal selector is not allowed in UA):
mfrac > maction, mfrac > menclose, mfrac > merror, mfrac > mfenced, mfrac > mfrac, mfrac > mpadded, mfrac > mphantom, mfrac > mroot, mfrac > msqrt, mfrac > mrow, mfrac > mspace, mfrac > mstyle,
mfrac > mn, mfrac > mtext, mfrac > mi, mfrac > ms, mfrac > mo, mfrac > munder, mfrac > mover, mfrac > munderover, mfrac > msub, mfrac > msup, mfrac > msubsup, mfrac > mmultiscripts, mfrac > semantics {
math-script-level: auto;
math-style: inline;
}

@rwlbuis
Copy link

rwlbuis commented May 13, 2019

To get roots right we add such a rule (verbose because universal selector is not allowed in UA):
mroot > maction:nth-child(n+2), mroot > menclose:nth-child(n+2), mroot > merror:nth-child(n+2), mroot > mfenced:nth-child(n+2), mroot > mfrac:nth-child(n+2), mroot > mpadded:nth-child(n+2), mroot > mphantom:nth-child(n+2), mroot > mroot:nth-child(n+2), mroot > msqrt:nth-child(n+2), mroot > mrow:nth-child(n+2), mroot > mspace:nth-child(n+2), mroot > mstyle:nth-child(n+2),
mroot > mn:nth-child(n+2), mroot > mtext:nth-child(n+2), mroot > mi:nth-child(n+2), mroot > ms:nth-child(n+2), mroot > mo:nth-child(n+2), mroot > munder:nth-child(n+2), mroot > mover:nth-child(n+2), mroot > munderover:nth-child(n+2), mroot > msub:nth-child(n+2), mroot > msup:nth-child(n+2), mroot > msubsup:nth-child(n+2), mroot > mmultiscripts:nth-child(n+2), mroot > semantics:nth-child(n+2) {
math-script-level: add(2);
math-style: inline;
}

@rwlbuis
Copy link

rwlbuis commented May 13, 2019

To get script-level right for script elements, we specify all possible combinations with children (using :nth-child(n+2) to select them) and apply to them:
math-script-level: add(1);
math-style: inline;

@rwlbuis
Copy link

rwlbuis commented May 13, 2019

math-style probably works but needs more testing, since focus was on math-script-level.

@NSoiffer
Copy link
Contributor

For the mfrac rules, what does auto do? The rule should be:

The element sets displaystyle to "false", or if it was already false increments scriptlevel by 1, within numerator and denominator.

Easy to do in code, but maybe not with CSS because you can't condition the selector on a CSS value, right?

@rwlbuis
Copy link

rwlbuis commented May 13, 2019

For the mfrac rules, what does auto do? The rule should be:

The element sets displaystyle to "false", or if it was already false increments scriptlevel by 1, within numerator and denominator.

Easy to do in code, but maybe not with CSS because you can't condition the selector on a CSS value, right?

Right, the auto behavior has to be done in code, actual commit is here to give you an idea:
https://github.com/Igalia/chromium-dev/commit/a8aafff1ff1fbdac54a35f006b19bd8efbeaa982

@fred-wang fred-wang added the need resolution Issues needing resolution at MathML Refresh CG meeting label May 16, 2019
@fred-wang
Copy link
Author

Resolution:

  • We agreed to go ahead and continue discussion at the CSS WG.

Specification:

  • Define the mapping in MathML Core.
  • Need to update a bit the CSS proposal after Chromium's implementation.

Implementation:

  • WebKit: TODO
  • Firefox: TODO
  • Implemented in Chromium.

Polyfill:

  • N/A

Tests:

  • ¡¡¡¡A lot of tests!!!!
  • They should probably be located in the css/ directory and have the "tentative.html" extensions for now.

@fred-wang fred-wang added need implementation update need specification update Issues requiring specification changes and removed need resolution Issues needing resolution at MathML Refresh CG meeting labels May 16, 2019
@fred-wang
Copy link
Author

@fred-wang
Copy link
Author

It seems "internal" properties are supported in WebKit:

https://lists.webkit.org/pipermail/webkit-dev/2019-September/030770.html

and that's the case in Gecko and Blink too.

So we probably don't need to push too much for this at the CSSWG and just implement things internally for the sake of native MathML support. If later users ask for it, it would be easy to expose them for implementers and we would have concrete use cases we can show to the CSSWG.

Incidentally, one of the use case I was thinking about is if people write a fancy custom MathML layout (e.g. attaching scripts to each side / corner of a base) involving math-style and script-level then they would need to have these properties exposed. But for now math "polyfills" don't rely on modern techniques like custom elements or CSS layout API so this is highly hypothetical.

@fred-wang fred-wang removed need implementation update need specification update Issues requiring specification changes labels Sep 16, 2019
@fred-wang
Copy link
Author

As proposed during the hackfest, we can close it and open individual issues as necessary.

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

3 participants