[csswg-drafts] [css-overflow] text-overflow and anonymous blocks

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

== [css-overflow] text-overflow and anonymous blocks ==
`text-overflow` is defined in [CSS UI](https://drafts.csswg.org/css-ui-3/#text-overflow) (should be moved into CSS Overflow per resolution) as:

 - Applies to: block containers
 - Inherited: no

Since the property controls how inline contents overflow line boxes, I would assume that the value that matters is the one of the block container that establishes the inline formatting context to which the line boxes belong.

The problem is that properties that apply to IFC roots should be inheritable, because lots of IFC roots are anonymous blocks. But this is a special case, because `text-overflow` has effect only if `overflow` is not `visible`, and `overflow` is definitely not inherited. Therefore it cannot just be said that anonymous blocks must act as if they were assigned `text-overflow: inherit` via a rule in the UA origin (because `overflow` should definitely not be inherited)

So consider this example: https://jsfiddle.net/fck9xqtx/

```html
<div id="test1">abcdefghijklmoqrstuvwxyz</div>
<div id="test2">
  <div>-</div>
  <div>abcdefghijklmoqrstuvwxyz</div>
</div>
```
```css
#test1, #test2 {
  text-overflow: ellipsis;
  overflow: hidden;
  width: 50px;
}
#test1::before {
  content: "-";
  display: block;
}
```

In `#test1` there is a `::before` block, and then the other text is wrapped inside an anonymous block which is what establishes the IFC (and not `#test1`).

In `#test2` it's basically the same, but now the inner block is element-generated.

Both Firefox and Chrome show ellipsis in `#test1` and do not in `#test2`. Edge does not show ellipsis in either case.

Given the current definitions, I think Edge's behavior makes more sense, but it's not useful because anonymous blocks can't be selected to assign `text-overflow` and `overflow` styles. Additionally I think IFC should always be established by anonymous blocks, but with Edge's behavior this would mean that `text-overflow` would never work.

So I think the spec should say something like that anonymous blocks are ignored even if the IFC is established by them, and that the values of `text-overflow` and `overflow` that matter are the ones of the nearest non-anonymous block ancestor.

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

Received on Thursday, 19 April 2018 15:48:01 UTC