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

Yes, @fantasai and I think that the first option is best.  #2 is bad because it produces sibling ::first-line boxes, which doesn't happen currently and would break certain types of formatting, such as image backgrounds and letter-spacing. 

#3 is bad because it's actually impossible - the boxes don't exist, so we don't know whether they "would contain" inlines or blocks (that fact can change depending on surroundings).  Also, appending content to an element shouldn't fundamentally change the structure of earlier contents.

So #1 is the most reasonable, I think - just look at the resulting box tree and insert ::first-line boxes as appropriate.  This keeps ::first-line generation purely a box-tree-time operation (which both #2 and #3 fail, since they require element-tree information)  The only downside is that, from an author's perspective, it "flips" inheritance for text inside a display:contents that would have been a block (without display:contents, the ::first-line goes inside the div, so text inherits from the ::first-line rather than the div), however we don't really have a concept of "would have been a block" (as the block-ness comes from the display value).

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

Received on Tuesday, 16 May 2017 00:28:41 UTC