Re: [csswg-drafts] [css-logical-1] Interaction of shorthands and logical properties

Proposal:

During parsing of a css declaration block, shorthands (like `margin` and `all`) expands only to the set of longhand (grouped by `mapping logic` so either `flow-relative` or `physical`) required to describe their value, and by default resort to use `physical` properties if both sets are possible. Note that they can only expand if they do not contain `var()` substitutions.

During serialization, each `logical property group` is considered, and shorthand values can be emitted instead of the longhands only if the all the longhands of the same `mapping logic` are present and consecutive (ignoring all properties that are not in the group). Otherwise, the shorthand is not used when serializing the properties in the group.

During serialization, a specific rule should be added in case all longhand properties of one `mapping logic` are defined, and are followed by all longhand properties of the other `mapping logic` (this would result in the shorthand being emitted twice, in which case the rule would discard its first appearance)

ex:
```
margin-top: 0px; margin-left: 0px; margin-bottom: 0px; margin-right: 0px;
margin-inline-start: 10px; margin-block-start: 10px; margin-inline-end: 10px; margin-inline-end: 10px
```
should serialize as `margin: logical 10px` (if supported) or just `margin-inline-start: 10px; margin-block-start: 10px; margin-inline-end: 10px; margin-inline-end: 10px` (otherwise), ignoring the set of longhand properties of `physical mapping logic` whose all values are to be ignored in the end.

When removing a shorthand property, all the longhand associated with that shorthand should be removed, regardless of their `mapping kind`.

-- 
GitHub Notification of comment by FremyCompany
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3030#issuecomment-414020359 using your GitHub account

Received on Saturday, 18 August 2018 00:53:42 UTC