[csswg-drafts] [css-inline-3] Naming text-box-trim et al. (#10675)

fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-inline-3] Naming text-box-trim et al. ==
Just landed the edits to split `text-box-edge` into two properties and add a shorthand with text-box-trim in https://github.com/w3c/csswg-drafts/commit/7869dc6823e2ce9c6d816c33fb070ed5c317eb1a ; see
* [CSSWG resolution in 8829](https://github.com/w3c/csswg-drafts/issues/8829#issuecomment-1699500216)
* [line box sizing property definition](https://drafts.csswg.org/css-inline-3/#text-edges)
* https://drafts.csswg.org/css-inline-3/#leading-trim (leading-trim properties and shorthand)

We had left open some amount of bikeshedding to follow up on, so before I publish the draft I wanted to run the current state by the CSSWG.

Here's the syntax tree:
```
<text-edges> = [ text | cap | ex | ideographic | ideographic-ink ]
               [ text | alphabetic | ideographic | ideographic-ink ]?
<text-trim> = start | end | both

/* line box sizing property (inherited) */
line-fit-edge: leading | <text-edges>

/* leading-trim properties (non-inherited) */
text-box: normal | <text-trim> || <text-edges>
text-box-trim: none | <text-trim>
text-box-edge: auto | <text-edges>
```

Shorthand details:
* `text-box: normal` sets to initial values (`none`/`auto`).
* Setting only `<text-trim>` defaults `text-box-edge` to `auto` (initial value).
* Setting only `<text-eges>` defaults `text-box-trim` to `both` (not initial value).

Additional details:
* `text-box-edge: auto` copies from `line-fit-edge`, treating `leading` as `text`.
* Reminder: `line-fit-edge` values other than `leading` opt into the newer line box sizing model (leading only on root inline, honoring margin/border/padding on inline boxes).

Consequences:

* Defaulting this way enables trimming the leading by just setting a `<text-trim>` value.
* If the author set something more aggressive and script-specific for the inherited `line-fit-edge` property, that gets passed through as the default trim edges.
* They can alternatively set an explicit trim value.
* Shorthanding magic means that:
    * `text-box: both` sets trimming to the default edge.
    * `text-box: cap alphabetic` sets trimming to those edges on both sides.
    * `text-box: normal` does the normal thing of not trimming the line box. :)

Additional Suggestion:
Having the `text-box` shorthand take `start | end | both` reads badly, suggest renaming these keywords to `trim-start | trim-end | trim-both` for two reasons:
* Consistency with `text-spacing-trim`
* The shorthand reads a lot more reasonably: `text-box: trim-both` rather than `text-box: both` which is weird.

Proposed Resolutions:
* Adopt `text-box`/`text-box-trim`/`text-box-edge` properties as outlined above.
* Rename `start | end | both` values of `text-box-trim` to `trim-start | trim-end | trim-both`.
* Name the line-box sizing property (previously discussed as `text-line-edge` to contrast with `text-box-edge`) to `line-fit-edge` (for now), or to some alternative that people might suggest here.
* Republish css-inline-3 as WD with [these edits](https://drafts.csswg.org/css-inline-3/#changes).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/10675 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 2 August 2024 18:38:02 UTC