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

Issue 713019 link

Starred by 6 users

Issue metadata

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

Blocking:
issue 657748



Sign in to add a comment

The display: contents element cannot be correctly aligned in the flex container.

Reported by yio...@gmail.com, Apr 19 2017

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

Steps to reproduce the problem:
1. Open testcase: http://jsbin.com/xicujadiye/edit?html,css,output

What is the expected behavior?
The bottom of the text is aligned with the bottom of the box.

What went wrong?
Text beyond borders.

Did this work before? N/A 

Chrome version: 60.0.3074.0  Channel: canary
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 25.0 r0
 

Comment 1 Deleted

Comment 2 Deleted

Comment 3 by yio...@gmail.com, Apr 19 2017

testcase.png
28.7 KB View Download

Comment 4 by eco...@igalia.com, Apr 19 2017

Blocking: 657748
Thanks for the report, will look into it :)

Comment 5 by eco...@igalia.com, Apr 19 2017

Labels: -OS-Mac OS-All
So the anonymous block created in the first case doesn't take into account the inner text font-size, and instead uses its own font-size for layout, which results in ~20px height, which ends up meaning that the alignment is wrong...

Comment 6 by eco...@igalia.com, Apr 19 2017

So I believe ultimately the problem is that in order to get the baseline position for a given text, we directly call into the parent[1], assuming that the relevant style properties are the same, which is wrong for display: contents.

I'm not familiar at all with that code, so I'm not sure how easy this is to fix.

[1]: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp?l=103&rcl=c9402416a818b487bee3082c53123372cd8cc6fe
Cc: sureshkumari@chromium.org
Labels: Needs-Feedback
Unable to reproduce the issue on Mac-10.12.4, Windows-7 and Linux Ubuntu-14.04 using Chrome stable version 57.0.2987.133 and canary 60.0.3075.0 and reported version 60.0.3074.0 with the provided testcase "http://jsbin.com/xicujadiye/edit?html,css,output" in comment#0.
Please find the attached screen cast and let us know if anything missed here to reproduce the issue.

Thanks.
713019.mov
3.2 MB Download
Project Member

Comment 9 by sheriffbot@chromium.org, Apr 21 2017

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding requester "sureshkumari@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 10 by ajha@chromium.org, Apr 21 2017

Cc: e...@chromium.org eco...@igalia.com
Components: Blink
Labels: M-60
Status: Untriaged (was: Unconfirmed)
Looks like CL is under review hence marking this as Untriaged and cc'ing reviewers for further action.

Comment 11 by bokan@chromium.org, Apr 21 2017

Components: -Blink Blink>Layout
The test case appears to work correctly in 58.0.3029.81 so it looks like it's already been fixed?

Comment 12 by e...@chromium.org, Apr 24 2017

Status: Fixed (was: Untriaged)

Comment 13 by eco...@igalia.com, Apr 24 2017

Labels: -Pri-2 Pri-3
Owner: eco...@igalia.com
Status: Started (was: Fixed)
This is not fixed yet.

The patch hasn't landed (I need to figure out why on mac there are subpixel differences).

It looks good in 58 because display: contents isn't shipped yet.

Comment 14 by e...@chromium.org, Apr 24 2017

Ah, thanks for the clarification.
Owner: futhark@chromium.org
Status: Assigned (was: Started)
Project Member

Comment 17 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