Skip to content

Define if width/height/inline-size/block-size are supported. #75

Closed

Description

@bfgeek

A simple test case:
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=6693

Safari appears to support height at least on the element, however firefox appears not to?

From an implementation POV it may be easier just to support all width/height/etc on all elements, however this gets into how to define the internal MathML algorithms.

On the element this needs tests for various values of width/height, and within various formatting contexts, e.g. flex (does it respect flex-basis properly), grid, etc.

Activity

  1. bfgeek commented on Feb 25, 2019

    @bfgeek
    Author
  2. fred-wang commented on Jul 5, 2019

    @fred-wang
    Contributor

    I think we are now ready to handle this, so I'll put this on the agenda of the nxt MathML CG meeting.

    Currently, each MathML box layout its content without linebreaking. The content box is defined to be the one of generated by the content:
    https://mathml-refresh.github.io/mathml-core/#layout-algorithms

    If width/height/inline-size/block-size are useful, a simple interpretation for now would be to set the content box to the specified size and let the content overflow.

  3. rwlbuis commented on Jul 16, 2019

    @rwlbuis
    Contributor

    Supporting width/height properties in MathML could potentially make things simpler in the implementation since a lot of layout/rendering code expects width/height info.

    I am not sure on all the details though. As usual CSS property vs presentation attribute has to be defined, i.e. which one wins ultimately. For mspace, width property could override the width attribute, but how do ascent/descent attribute and height property interact? We'll probably have to look per element how much sense it makes.

  4. fred-wang commented on Jul 16, 2019

    @fred-wang
    Contributor

    I am not sure on all the details though. As usual CSS property vs presentation attribute has to be defined, i.e. which one wins ultimately. For mspace, width property could override the width attribute, but how do ascent/descent attribute and height property interact? We'll probably have to look per element how much sense it makes.

    With my generic proposal for MathML, <mspace width="100px" height="50px" depth="50px" style="width: 50px; height: 200px;"> would still create a 100px square (MathML content) but the content box would have size 50px X 200px so the mspace will have visible overflow on the inline axis and be aligned along the line-over edge (or follows any consistent block alignment rule).

  5. rwlbuis commented on Jul 16, 2019

    @rwlbuis
    Contributor

    For mspace, width property could override the width attribute, but how do ascent/descent attribute and height property interact?

    Oops, I meant height/depth here instead of ascent/descent.

  6. fred-wang commented on Jul 16, 2019

    @fred-wang
    Contributor

    To be clear, we have a general layout algorithm described here:

    https://mathml-refresh.github.io/mathml-core/#layout-algorithms

    So we have:

    • The box obtained when content is laid out, described in other individual sections. Let's call it the "math box" for convenience.
    • The CSS content box which is currently defined to be the same as the "math box".
    • The CSS padding/border/margin boxes which are described in this section from the CSS content box.

    My generic proposal is to interpret width/height as follows for most MathML elements:
    (1) Percent width/height are interpreted relative to the "math box" dimensions.
    (2) The content box takes the width/height specified by CSS (A).
    (3) The inline-start edge of the "math box" is aligned with the inline-start edge of the content box. The line-over edge of the "math box" is aligned with the line-over edge of the content box. (B)
    (4) If the specified width (respectively height) is smaller than the one of the "max box" then the "math box" will overflow (C).

    (A) Assuming we ignore box-sizing for now. Small adjustment will be needed if we support the border-box value.
    (B) Assuming we ignore alignment properties for now.
    (C) Assuming we ignore overflow for now. For other other values than "overflow", we might need to introduce anonymous block container or something.

    As Neil noted, for the <math> root it makes sense to keep the CSS interpretation of width/height for display: block and inline.

    We might also want to consider width/height for the actual layout of the "math box". For example an mrow might take into account the width to perform some line breaking, an mfrac can pass the width constraint to the numerator/denominator or an mspace/mpadded element can have special interpretation according to its attribute. But indeed this special cases would need more analysis than my general proposal, so maybe that should be defined later.

    Finally, there is the option of just ignoring width/height on MathML elements.

  7. fred-wang commented on Jul 29, 2019

    @fred-wang
    Contributor

    Consensus during mathml core meeting: Ignore width/height on all new layout as they are no clear use case and that simplifies implementation. It still makes sense for mtable or math elements.

  8. fred-wang commented on Sep 15, 2019

    @fred-wang
    Contributor

    The spec now says that it is ignored for elements with "display: math"

  9. 73 remaining items

  10. fred-wang commented on Feb 14, 2023

    @fred-wang
    Contributor

    We have minimal test coverage after these PR, so closing:

    web-platform-tests/wpt#38361
    web-platform-tests/wpt#38443
    web-platform-tests/wpt#38466

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions