New issue
Advanced search Search tips

Issue 739800 link

Starred by 7 users

Issue metadata

Status: Duplicate
Merged: issue 507757
Owner:
Closed: Jul 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

:first-letter styling broken in some cases

Project Member Reported by duga@google.com, Jul 6 2017

Issue description

Chrome Version       : 59.0.3071.115
OS Version: OS X 10.12.5
URLs (if applicable) : https://jsfiddle.net/Lhprsdf8/
Other browsers tested:
  Add OK or FAIL after other browsers where you have tested this issue:
     Safari 5: OK
  Firefox 4.x: OK

What steps will reproduce the problem?
1. Open the fiddle
2. Observe the rendering (Properly formatted large text of "Examples"
3. Hover over the word "Examples"

What is the expected result?
Same formatting with color change


What happens instead of that?
The first letter is drawn below where it should be


Please provide any additional information below. Attach a screenshot if
possible.

See screenshots. Note that this is impacting Google Play Books on Android and Web, as some content from publishers uses :first-letter. There may be additional issues with rendering, but this was the simplest example I could come up with. It is possible this problem started at or around Chrome 41.

Also attached simple source file that shows the problem.

UserAgentString: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36



 
correct.png
60.4 KB View Download
shifted.png
62.2 KB View Download
shimy.html
300 bytes View Download
Components: Blink>CSS
Components: -Blink>CSS Blink>Layout
Labels: OS-Linux
Status: Untriaged (was: Unconfirmed)
Labels: Needs-Triage-M59 Needs-Bisect OS-Windows
Able to reproduce this issue on Chrome stable#59.0.3071.115.

Comment 4 by ajha@chromium.org, Jul 10 2017

Cc: ajha@chromium.org
Labels: -Pri-3 -Needs-Bisect -Needs-Triage-M59 M-61 Pri-2
Able to reproduce the issue on the latest canary(61.0.3153.0) on Windows-10, Mac OS 10.12.5 and Linux Ubuntu 14.04. This is non-regression issue as similar behavior is observed on the older chrome  version: 45.0.2450.0.

Triaging this for further investigation of this.
Confirming that we've been seeing this issue in Bootstrap for quite a while https://github.com/twbs/bootstrap/issues/21771
Curious why this was made restricted - if it was a mistake, could it be opened up again? No worries if not possible.

Comment 7 by duga@google.com, Jul 11 2017

I think restricting is the default for internally submitted bugs. I seem to have no ability to un-restrict, but if someone with such power would like to I have no objections. I expect more eoub reading systems running on Chrome will have this problem near term due to some changes in styling expected to hit the ebook world.

On a technical note, this seems to have something to do with ::first-letter being applied to the element above the element that has the text. So, moving the ::first-letter style to the span in my fiddle fixes the problem. We are using that at the moment as a work around, but it won't always be possible.
Project Member

Comment 8 by sheriffbot@chromium.org, Jul 11 2017

Labels: Hotlist-Google

Comment 9 by e...@chromium.org, Jul 11 2017

Labels: allpublic
Status: Available (was: Untriaged)

Comment 10 by kojii@chromium.org, Jul 27 2017

Cc: kojii@chromium.org
On Canary, I don't even need to hover, layout is just broken.

Comment 11 by kojii@chromium.org, Jul 28 2017

Owner: kojii@chromium.org
Status: Assigned (was: Available)

Comment 12 by kojii@chromium.org, Jul 29 2017

Mergedinto: 507757
Status: Duplicate (was: Assigned)
Project Member

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

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

commit 48bdfcea704e04a68f326992545530e7e149da09
Author: Koji Ishii <kojii@chromium.org>
Date: Sun Jul 30 22:23:39 2017

Fix :first-letter pseudo element to inherit correctly

The :first-letter pseudo element may not be a child of the element in
style/box tree.

For example:
  <div><span>text</span></div>
creates:
  <div>
    <span>
      <div:first-letter>t</div:first-letter>
      ext
    </span>
  </div>

FirstLetterPseudoElement computes this correctly on creation, but
inherited from <div> on RecalcStyle(). This patch fixes the inheritance
on RecalcStyle() too.

Inline layout code assumes that a text box has the same style as its
parent inline box. The incorrect style on FirstLetterPseudoElement
breaks this assumption.

Bug:  450002 ,  507757 ,  739800 
Change-Id: Icda675f5ffbb705c4b87f9d23cca34f24c4763ee
Reviewed-on: https://chromium-review.googlesource.com/593067
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490692}
[add] https://crrev.com/48bdfcea704e04a68f326992545530e7e149da09/third_party/WebKit/LayoutTests/fast/css/first-letter-recalc-style-expected.html
[add] https://crrev.com/48bdfcea704e04a68f326992545530e7e149da09/third_party/WebKit/LayoutTests/fast/css/first-letter-recalc-style.html
[delete] https://crrev.com/26f38f3f2c001ff2d3ca31354cd88a7a5817c4c8/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-first-letter-first-line-hover-expected.txt
[modify] https://crrev.com/48bdfcea704e04a68f326992545530e7e149da09/third_party/WebKit/LayoutTests/fast/css/getComputedStyle/getComputedStyle-first-letter-first-line-hover.html
[modify] https://crrev.com/48bdfcea704e04a68f326992545530e7e149da09/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp

Project Member

Comment 14 by bugdroid1@chromium.org, Aug 15 2017

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

commit 67626ab20075007a6dced82ad2886390bd4c4aff
Author: Koji Ishii <kojii@chromium.org>
Date: Tue Aug 15 16:32:00 2017

Fix InlineBoxWrapper to stay in sync when :first-letter is changed to floats

There is a case where applying float to a :first-letter pseudo element
does not cause reattaching the layout tree.

The original purpose of r490692 (CL:593067) is to ensure LayoutText has
the same style as its parent inline box. This patch changes the fix
applied only when the pseudo style is inline.

Bug:  751147 ,  450002 ,  507757 ,  739800 
Change-Id: I38c44dfbfffae114af89d545d7b2e9cf5b4f7b30
Reviewed-on: https://chromium-review.googlesource.com/612222
Reviewed-by: Emil A Eklund <eae@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#494405}
[add] https://crrev.com/67626ab20075007a6dced82ad2886390bd4c4aff/third_party/WebKit/LayoutTests/fast/css/first-letter-float-crash-expected.txt
[add] https://crrev.com/67626ab20075007a6dced82ad2886390bd4c4aff/third_party/WebKit/LayoutTests/fast/css/first-letter-float-crash.html
[modify] https://crrev.com/67626ab20075007a6dced82ad2886390bd4c4aff/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp

Sign in to add a comment