Skip to content

[css-logical][css-cascade] revert/revert-layer with logical properties #7054

@Loirooriol

Description

@Loirooriol

When setting a logical property to a css-wide keyword,

  • initial: currently, all the properties in every logical property group have the same initial values, so this just behaves as setting that value. It doesn't matter if it's first resolved into a physical property or not.
  • inherit: resolved in [css-logical-1] Order of inheritance vs. mapping in logical properties #3029 that logical properties inherit from the same logical property in the parent, even if they map to different physical properties. Note that Blink, Firefox and WebKit don't do that: they resolve into physical, and then inherit the physical.
  • unset: currently, all logical properties are non-inherited, so it just behaves as initial.

OK, but what about revert? Imagine:

  • UA origin:

    foo {
      margin-inline-start: 100px;
      margin-left: 200px;
    }
  • Author origin:

    foo {
      margin-left: 300px;
      margin-inline-start: revert;
    }

https://www.w3.org/TR/css-cascade-5/#default says:

Rolls back the cascaded value to the user level, [...]

So do we use margin-inline-start: 100px?

[...] so that the specified value is calculated as if no author-origin rules were specified for this property on this element.

So do we drop margin-inline-start and use margin-left: 300px from author origin?

Actually, browsers use margin-inline-start: 200px.

Blink has dialog {left: 0; right: 0} in UA origin. Then, in horizontal ltr, left: auto; inset-inline-start: revert behaves like inset-inline-start: 0, using the UA value for left.

Analogously, Firefox and WebKit have dialog {inset-inline-start: 0; inset-inline-end: 0} in UA origin. Then, in horizontal ltr, inset-inline-start: auto; left: revert behaves like left: 0, using the UA value for inset-inline-end.

Similar for revert-layer, which actually allows more comprehensive tests: https://software.hixie.ch/utilities/js/live-dom-viewer/saved/10046. It seems that what browser do is:

  1. Find the final writing mode.
  2. Use it to resolve logical all property declarations into physical ones, in all origins/layers.
  3. Revert as usual.

Not unreasonable, but probably not much consistent with inherit using the same property instead of resolving into a physical property first (no browser has implemented that yet).

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