Skip to content

Are css/css-contain/contain-layout-baseline-005.html css/css-contain/contain-layout-button-001.html correct? #45889

@bfgeek

Description

@bfgeek

I'm currently investigating making buttons block-layout by default in Blink.

As part of this work I'm fixing how we synthesize baselines for various form elements in an inline-context.
(Note: this only applies to inline baselines, in all other contexts (flex/grid align-items: baseline) we synthesize based off the border-box edges).

Broadly speaking everything synthesizes off the margin-box edges except:

  • <input type=radio>/<inpput type=checkbox> - with effective appearance they synthesize off the border-box edges, and with appearance:none of the margin-box edges.
  • <input type=range> in Blink/Webkit synthesizes off the border-box edge, Firefox margin-box.
  • <button>/<input type=button>/<input type=submit>/<input type=reset> synthesizes off the content-box edge. Testcase: https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=12646 (Blink isn't correct here but we'll fix that).

When containment is applied, we all seem to be synthesizing button like things off the margin-box edge.

I think this is incorrect per-spec:

https://drafts.csswg.org/css-contain-1/#containment-layout

For the purpose of the vertical-align property, or any other property whose effects need to relate the position of the layout containment box's baseline to something other than its descendants, the containment box is treated as having no baseline.

(To me) This reads as if:

baseline <button></button> <button style="contain:layout"></button>

Should be aligned the same way (e.g. the context-box edge(s)) as we are just treating them as having no baseline, and are instead synthesizing it.

@frivoal @dholbert @emilio Thoughts?

cc/ @mrego As you wrote (at least) one of the tests :P.

Ian

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions