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

Reset CSS writing-mode and direction on the <math> root #35

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

Reset CSS writing-mode and direction on the <math> root #35

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

Comments

@fred-wang
Copy link

fred-wang commented Feb 22, 2019

I think Gecko and WebKit resets direction and writing-mode to rtl and horizontal-tb on the math root. We should probably do the same in MathML Core

"* In some countries and languages, text is written from right-to-left
while mathematical formulas are written from left-to-write. Hence it is
wrong to inherit the direction and we reset that property to
left-to-write on the tag. Per the MathML specification, authors
should explicitly use the "dir" attribute on the element if they
want to force the overall direction of the mathematical formulas.
Similarly, the writing-mode should probably be set to "horizontal-tb" by
default."
Original report: https://lists.w3.org/Archives/Public/www-math/2016Jul/0025.html

cc @rwlbuis

https://trac.webkit.org/browser/trunk/Source/WebCore/css/mathml.css
https://dxr.mozilla.org/mozilla-central/source/layout/mathml/mathml.css

@fred-wang fred-wang added MathML Core Issues affecting the MathML Core specification css / html5 Issues related to CSS or HTML5 interoperability need tests Issues related to writing WPT tests labels Feb 22, 2019
@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

The CSS stylesheet has "direction: ltr;" but I can't remember whether we agree on it: https://mathml-refresh.github.io/mathml-core/#user-agent-stylesheet

MathML Core now says that writing-mode has no effect on https://mathml-refresh.github.io/mathml-core/#css-styling ; however this is not as easy to implement because of interaction with logical properties. I believe @emilio suggested to just add a rule

* { writing-mode: initial; }

in the MathML UA sheet. See https://phabricator.services.mozilla.com/D48279

@NSoiffer
Copy link
Contributor

NSoiffer commented May 17, 2020

The spec currently says:

Vertical math layout: writing-mode is treated as horizontal-tb on all MathML elements

So unless we change the spec, I think it makes more sense/is clearer to use

* { writing-mode:  horizontal-tb; }

In the end, it probably boils down to the same thing since the CSS spec says the initial value is horizontal-tb;.

At the bottom of 3.1.2, the spec says:

The block offset of the alphabetic baseline of a box is the line-ascent if the CSS property writing-mode is horizontal-lr, vertical-rl or sideways-rl and is the line-descent otherwise.

If core always uses horizontal-tb on all MathML elements, this line should be removed because it implies the value can be something different. I've added the "spec" label because of this conflict.

Note: w3c/mathml-core#175 is related so I'm linking to it. w3c/mathml-core#175 has a discussion and examples of vertical writing modes, and the temporary(?) solution from @fred-wang in https://github.com/mathml-refresh/mathml/issues/18#issuecomment-517642587 is to force horizontal-tb.

Are we at a point where we can close these and say that Core 1.0 (or Core Level 1) only supports horizontal-tb or is this something we want to continue discussing?

@NSoiffer NSoiffer added the need specification update Issues requiring specification changes label May 17, 2020
@fred-wang
Copy link
Author

The first version will only support horizontal-tb but I don't think we plan to close issues that won't be address in the first version.

About how to force the writing-mode, I don't think we have a consensus on whether it's done by forcing CSS in the UA or in the style adjuster code (this is something to check with implementers). In any case you'd need an !important rule.

We still want to use logical metrics for the spec, but we might need to add a warning. I think keeping the ISSUE label is fine for now.

@fred-wang
Copy link
Author

Actually this issue is specifically about setting the writing-mode (and direction) on the math root, not on other elements. I think it's safe to add this to UA and close it.

@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
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

2 participants