Skip to content

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

Closed

Description

@fred-wang

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

Activity

  1. added
    MathML Core
    css / html5
    need tests
    on Feb 22, 2019
  2. added
    need resolution
    on May 16, 2019
  3. fred-wang commented on Jan 20, 2020

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

  4. NSoiffer commented on May 17, 2020

    @NSoiffer
    Contributor

    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?

  5. added
    need specification update
    on May 17, 2020
  6. fred-wang commented on May 22, 2020

    @fred-wang
    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.

  7. fred-wang commented on May 22, 2020

    @fred-wang
    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.

  8. removed
    need resolution
    need specification update
    need tests
    on May 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    MathML Corecss / html5

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions