You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Define if width/height/inline-size/block-size are supported. #75
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.
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.
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.
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).
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.
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.
Activity
bfgeek commentedon Feb 25, 2019
Oh this is more fun as it appears to selectively apply to certain elements, e.g.
https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=6706
fred-wang commentedon Jul 5, 2019
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.
rwlbuis commentedon Jul 16, 2019
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.
fred-wang commentedon Jul 16, 2019
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).rwlbuis commentedon Jul 16, 2019
Oops, I meant height/depth here instead of ascent/descent.
fred-wang commentedon Jul 16, 2019
To be clear, we have a general layout algorithm described here:
https://mathml-refresh.github.io/mathml-core/#layout-algorithms
So we have:
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.
fred-wang commentedon Jul 29, 2019
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.
MathML: Add test to verify that new math layout ignore width/height
MathML: Add test to verify that new math layout ignore width/height
MathML: Add test to verify that new math layout ignore width/height (w…
Bug 1570016 [wpt PR 18171] - MathML: Add test to verify that new math…
Bug 1570016 [wpt PR 18171] - MathML: Add test to verify that new math…
MathML: Add test to verify that new math layout ignore width/height (w…
fred-wang commentedon Sep 15, 2019
The spec now says that it is ignored for elements with "display: math"
Bug 1570016 [wpt PR 18171] - MathML: Add test to verify that new math…
73 remaining items
[mathml] Add more tests for layout algorithms with specified width/he…
fred-wang commentedon Feb 14, 2023
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
Bug 1815063 [wpt PR 38361] - [mathml] Update WPT tests that assume CS…
Bug 1815063 [wpt PR 38361] - [mathml] Update WPT tests that assume CS…
Bug 1816063 [wpt PR 38443] - [mathml] Add more tests for layout algor…
Bug 1816063 [wpt PR 38443] - [mathml] Add more tests for layout algor…
Bug 1816063 [wpt PR 38443] - [mathml] Add more tests for layout algor…
[mathml] Update WPT tests that assume CSS width/height are ignored
[mathml] Add more tests for layout algorithms with specified width/he…
Bug 1807035 [wpt PR 37651] - [mathml] Refactor parsing of mspace and …