Re: [csswg-drafts] [css-display][css-pseudo] Interaction of display:contents and ::first-line

Now I'm thinking that option 1 may be a bit more costly to implement, e.g. if you have

```html
<section>
  <div ><div ><div ><div ><div ><div ><div ><div ><div ><div >
    <span>Foo</span>
  </div></div></div></div></div></div></div></div></div></div>
</section>
```
```css
section::first-line { color: green }
div { display: contents }
```

When the browser generates the styles for the `section`, it sees a `::first-line` must be generated, but does not know where. I guess it must first iterate all the nested `div` because there could be some block container inside them. When it finds out that nope, then it goes back and creates a style for the outermost `div` which inherits from `section::first-line`, then a style for the second `div` which inherits from the previous style, and so on. Alternatively it could start creating these styles once it sees the first `display: contents` element, but if there were a block container inside, that work would have been useless.

Option 2 seems easier to implement: once you find a first-child inline-level inside a block container, create a `::first-line` fragment, let it inherit from the parent element of the inline, and place the inline-level (and following inline-level siblings, until the end of the line) inside that `::first-line`.



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

Received on Monday, 22 May 2017 21:11:56 UTC