-
Notifications
You must be signed in to change notification settings - Fork 15
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
Handling of out-of-flow elements #74
Comments
cc @bfgeek |
I agree on the suggestion in w3c/mathml#48 (comment) |
From w3c/mathml#48:
|
Static position can't meaningfully follow flex/grid, as they have flex/grid-specific definitions that don't generalize to other layouts. If at all possible, defining staticpos as the start-start corner of the containing block would be ideal, as it just makes life so much simpler. |
At the 5/8/19 meeting, we decided to treat out of flow elements as if they aren't part of layout/don't exist for rendering. The error repair mechanism in w3c/mathml#15 will kick in. Hence, if someone uses position:absolute (or display:none or ...) for the first child of an Note: if someone want to prevent the denominator from shifting up, then they can add an The meeting did not discuss the containing block part of the issue. |
The behavior you're describing is 👍, exactly what you'd expect from a rendering model. |
Proposal:
I'm not exactly sure what is the definition of "static-position" and I was not really able to find any in https://drafts.csswg.org/css-position-3/ ; MathML Core already defines position of children for "position: static" children (for example 1 and 2 are positioned with relatively complex rules) but I guess no one proposes to change that here. @rwlbuis has done some work as per https://github.com/mathml-refresh/mathml/issues/16#issuecomment-518364768 but I'm not sure what he did regarding block container & child positions. |
In addition to absolutely positioned boxes, out-of-flow boxes also include floated boxes: https://drafts.csswg.org/css2/visuren.html#positioning-scheme I propose that for the layout of a math box, the float/clear properties on its children are ignored, similarly to what is done for grid/flexbox. So concretely,
is laid out the same as
|
A few responses:
Comments:
|
The idea is to ignore the CSS float property so that a child with a specified float left/right is effectively not floated and so the only out-of-flow children are the absolutely positioned ones. |
During Thursday's meeting (2019/09/12) the consensus was:
|
Containing block for all descendants, correct? |
This needs tests for positioning so it can be closed. In addition, the spec likely needs to say more -- it says very little about out-of-flow elements. It currently has "Floats: float and clear are treated as none on all MathML elements." which seems wrong. |
For now I've tweaked the spec to say it forces float to none on MathML element via the UA sheet, but maybe that's not exactly what we want. I've been experimenting with the following test case:
I'm currently getting the following rendering in WebKit, Firefox, Chrome (from top to bottom), which is a bit inconsistent: Chrome works as I would expect. WebKit completely drops the floats in MathML. Firefox is not able to place floats in mtext. I guess it is fine to have a floating |
Another interesting case is floats in
which is not handled by Chrome, causes line break in Firefox and is handled by WebKit. For now I'm leaning towards adjusting computed style of elements with a "display: math" parent to force |
Yeah likely not exactly what you want as that'll prevent elements form floating. You can likley rely on the spec text from: E.g. something like "Math containers are not block containers, etc etc etc" |
@bfgeek Thanks. I think this was the spirit of the previous formulation, but it seems a bit unprecise. I was thinking about adjusted computed style to be 'none'. https://w3c.github.io/csswg-drafts/css2/#float-position seems to say something similar for absolutely positioned elements and all browsers interpret that has computing the style to none. |
I've prepared tests for out-of-flow elements in Chromium: For now, the choice I made for float is to adjust the computed value to none in 'math' display types, so that MathML-specific layout does not need to deal with them. This is doing a bit more than what is stated in the flexbox/grid specifications which only mention that they don't create floating children. It seems WebKit interpreted the latter as adjusting the computed value of float to none, while Firefox/Chome just ignore the float property. I've opened w3c/csswg-drafts#8130 ; we can likely revise what do for display: math depending on the decision in the CSSWG. Regarding, absolutely/fixed positioned element, the containing block is defined in https://w3c.github.io/csswg-drafts/css2/#containing-block-details ; Chrome is already able to place absolutely/fixed positioned element in MathML layout using that containing block as a reference point, so I only needed to write the tests accordingly. Probably MathML Core can be a bit more precise in https://w3c.github.io/mathml-core/#layout-algorithms in "Layout and positioning of out-of-flow child boxes." mentioning the case of floats and referring to CSS2 for the containing block of absolutely/fixed positioned elements. |
I believe this bug is resolved. The spec has been aligned on Chromium's behavior and tests added accordingly. FloatsSimilar wording as flex/grid is used: "The float property does not create floating of elements whose parent's computed display value is block math or inline math, and does not take them out-of-flow." Tests were added to check that:
Other out-of-flow elementsThe general layout algorithm now refers to CSS Position 3 for absolutely-positioned and fixed-positioned: "Layout and positioning of absolutely-positioned and fixed-positioned boxes, as described in [CSS-POSITION-3]. " Tests were added to verify
|
cc @mrego
I'm not sure there is a concrete use case to e.g. absolutely position a numerator of a fraction. I think Gecko supports it but WebKit does not.
See https://bugs.webkit.org/show_bug.cgi?id=178865
Original report: https://gitlab.com/mathml/MathMLinHTML5/issues/9
The text was updated successfully, but these errors were encountered: