New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 717460 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Feature

Blocking:
issue 657748


Show other hotlists

Hotlists containing this issue:
style-dev-current


Sign in to add a comment

::first-letter does not inherit from display:contents parent

Reported by oriol-bu...@hotmail.com, May 2 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3088.0 Safari/537.36

Steps to reproduce the problem:
1. Place some text inside a block
2. Create a ::first-letter pseudo-element on the block
3. Wrap part of the text (including the first letter) inside a display:contents element

What is the expected behavior?
The first letter inherits from ::first-letter pseudo-element, which inherits from the display:contents element, which inherits from the block element that generates the pseudo-element.

What went wrong?
The ::first-letter pseudo-element inherits directly from the block element.

Did this work before? No 

Does this work in other browsers? N/A

Chrome version: 60.0.3088.0  Channel: n/a
OS Version: 10.0
Flash Version:
 
testcase.htm
270 bytes View Download

Comment 1 by shans@chromium.org, May 2 2017

Labels: Needs-Feedback
display: contents isn't yet shipped by Chrome. The supplied test case passes on my Canary (60.0.3087.0) and Stable (57.0.2987.133). Could you provide more information about your environment (e.g. are experimental features enabled)? 

It's possible that the breaking change was introduced between 60.0.3087.0 and 60.0.3088.0 - I'm leaving this untriaged so that somebody can look once their Canary has ticked past that version.
Ah, yes, you need to enable web platform features to reproduce. This issue should block  issue 657748  to make sure this is fixed before shipping display:contents
Project Member

Comment 3 by sheriffbot@chromium.org, May 3 2017

Cc: shans@chromium.org
Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "shans@chromium.org" to the cc list and removing "Needs-Feedback" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot

Comment 4 by r...@opera.com, May 3 2017

Cc: eco...@igalia.com

Comment 5 by eco...@igalia.com, May 3 2017

Blocking: 657748
Labels: -OS-Windows -Pri-2 OS-All Pri-3
Yes, this is basically the same as  issue 706316 , just applied to first-letter instead.

I'd wait to see what are the resolutions to the multiple spec issues regarding this and others underspecifications related with display: contents:

https://github.com/w3c/csswg-drafts/issues?q=is%3Aissue+is%3Aopen+label%3Acss-display-3

Thanks for putting it in the tracker though :)

Comment 6 by shans@chromium.org, May 4 2017

Status: Available (was: Unconfirmed)

Comment 7 by shans@chromium.org, May 4 2017

Thanks for the extra info!
Labels: Update-Monthly

Comment 9 by kojii@chromium.org, Aug 1 2017

Cc: kojii@chromium.org
Status: ExternalDependency (was: Available)
Labels: -Type-Bug Type-Feature
Owner: futhark@chromium.org
Status: Assigned (was: ExternalDependency)
Project Member

Comment 13 by bugdroid1@chromium.org, Nov 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/acb3d3a0246a5c96b7ea2dc9b0ad6239bfef2775

commit acb3d3a0246a5c96b7ea2dc9b0ad6239bfef2775
Author: Rune Lillesveen <futhark@chromium.org>
Date: Thu Nov 30 00:20:59 2017

Test that ::first-letter inherits from display:contents.

Bug:  717460 
Change-Id: I3cb9ddc2eb70f64244669853fb9f3fc5b6b06a26
Reviewed-on: https://chromium-review.googlesource.com/798270
Reviewed-by: Darren Shen <shend@chromium.org>
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520327}
[modify] https://crrev.com/acb3d3a0246a5c96b7ea2dc9b0ad6239bfef2775/third_party/WebKit/LayoutTests/TestExpectations
[add] https://crrev.com/acb3d3a0246a5c96b7ea2dc9b0ad6239bfef2775/third_party/WebKit/LayoutTests/external/wpt/css/css-display/display-contents-first-letter-002.html

Project Member

Comment 14 by bugdroid1@chromium.org, Dec 5 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fc5c3629044888b8d723cc11424879bb883d8d3e

commit fc5c3629044888b8d723cc11424879bb883d8d3e
Author: Rune Lillesveen <futhark@chromium.org>
Date: Tue Dec 05 12:13:10 2017

Wrap text child of display:contents in anonymous if necessary.

A text node gets its style from its flat tree parent. The problem is
that our layout code expects the LayoutObject parent to have the same
inherited styles as the text node. That is not the case if a text node
has display:contents ancestors and the display:contents parent does not
have the same inherited styles as the closest ancestor generating a box.

Example:

  <div>
    <div style="display:contents;font-size:50px">Text</div>
  </div>

We're solving this by inserting an anonymous inline between the
LayoutText and its parent LayoutObject. We do not try to merge inline
wrappers for subsequent text nodes, so for:

  <div style="display:contents:color:pink">A<!-- -->B</div>

we create one wrapper for each of A and B, even though one would
suffice.

We attach and detach these wrappers on-demand, so if, for instance, the
inherited computed styles of the display:contents change so that it
matches the computed styles of the LayoutObject parent, we detach the
wrapper as it's no longer needed.

We also currently detach the wrapper when the computed style of the
display:contents and hence the computed style of the wrapper changes. We
could have optimized this through more checking and SetStyle on the
anonymous wrapper.

Bug:  717460 ,  706316 ,  709808 ,  713019 
Change-Id: Ia53b9fe2c0a6067c4600dab49cdf43f23b95b8fa
Tests: see removed lines from TestExpectations.
Reviewed-on: https://chromium-review.googlesource.com/806158
Commit-Queue: Rune Lillesveen <futhark@chromium.org>
Reviewed-by: Robert Hogan <robhogan@gmail.com>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521673}
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/LayoutTests/TestExpectations
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.cpp
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/dom/LayoutTreeBuilder.h
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/dom/Text.cpp
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/layout/LayoutInline.cpp
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/layout/LayoutObjectTest.cpp
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/style/ComputedStyle.cpp
[modify] https://crrev.com/fc5c3629044888b8d723cc11424879bb883d8d3e/third_party/WebKit/Source/core/style/ComputedStyle.h

Status: Fixed (was: Assigned)

Sign in to add a comment