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

Issue 723848 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug


Show other hotlists

Hotlists containing this issue:
Hotlist-1


Sign in to add a comment

::first-letter pseudo element breaks surrogate pairs

Reported by su...@mavenclinic.com, May 17 2017

Issue description

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

Steps to reproduce the problem:
1. Html element where value starts with an emoji example: <h3>🤔😱</h3>
2. Set text-transform: capitalize on CSS ::first-letter. example: h3::first-letter { text-transform: capitalize;}

What is the expected behavior?
Emoji should render

What went wrong?
Emoji is not rendered/displays as unicode question mark.

When applying text-transform:capitalize to whole element (vs just ::first-letter pseudo-element) the emoji render correctly.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 58.0.3029.96  Channel: stable
OS Version: OS X 10.11.6
Flash Version:
 
Screen Shot 2017-05-17 at 5.42.40 PM.png
160 KB View Download
Screen Shot 2017-05-17 at 5.43.29 PM.png
114 KB View Download
Components: -Blink>CSS Blink>Fonts>Emoji
Labels: Needs-Bisect Hotlist-Interop
Status: Available (was: Unconfirmed)
Created test case.
https://jsfiddle.net/1a5owrmc/

This test passes in Firefox.

Comment 2 by ajha@chromium.org, May 19 2017

Labels: Needs-Triage-M58
Cc: sureshkumari@chromium.org
Labels: -Needs-Bisect M-60 OS-Linux OS-Windows
Able to reproduce the issue on Windows-7,Mac-10.12.4 and Linux Ubuntu-14.04 using chrome stable version 58.0.3029.110 and canary 60.0.3104.0 with the provided test case in comment#1.
This is non regression issue, observed from M47 #47.0.2491.0 and confirming this issue for further investigation.

Note: M46 and earlier versions doesn't display Emojis. Please find the attached screenshot for reference.

Thanks.

723848(M46).PNG
23.9 KB View Download
723848 (M60).png
79.4 KB View Download
Possibly a subcase of this Webkit bug which Chromium still has:

https://bugs.webkit.org/show_bug.cgi?id=3409#c25

TL;DR: for :first-* psuedo-elements, text-transform doesn't work. 

(eg, p:first-letter { text-transform: capitalize; } also fails)
I think :first-letter cannot work with Emoji in Chromium at all. Even a invalid "display" can break the Emoji.

Test link: https://jsbin.com/nevaxovoxe/edit?html,css,output

My Chrome version:

59.0.3071.115 (Stable) (64bit)
3cf8514bb1239453fd15ff1f7efee389ac9df8ba-refs/branch-heads/3071@{#820}
Mac OS X
V8 5.9.211.38

I attached two screenshots, one is in Chrome and the other one is in Safari.

Safari version:
10.1.1 (12603.2.4)
emoji.png
130 KB View Download
emoji-expected.png
122 KB View Download
Components: -Blink>Fonts>Emoji Blink>DOM
Owner: xiaoche...@chromium.org
Status: Assigned (was: Available)
Summary: ::first-letter pseudo element breaks surrogate pairs (was: text-transform: capitalize breaks emoji rendering when used with ::first-letter pseudo-element)
The root cause is that, FirstLetterPseudoElement::FirstLetterLength() doesn't recognize surrogate pairs. It simply stops at the first non-punctuation code unit in the input string.

On input "\uD83D\uDE31\uD83D\uDE31" (😱😱), it returns 1, while the correct answer should be 2.

Comment 7 by hayato@chromium.org, Aug 16 2017

Components: -Blink>DOM Blink>CSS
Labels: Update-Quarterly
Project Member

Comment 9 by bugdroid1@chromium.org, Aug 16 2017

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

commit 02d9bf5911935920465f10eac7b62b718851b401
Author: Xiaocheng Hu <xiaochengh@chromium.org>
Date: Wed Aug 16 20:18:44 2017

Stop ::first-letter from breaking surrogate pairs

This patch makes FirstLetterPseudoElement::FirstLetterLength() consider
surrogate pairs, to stop surrogate pairs broken between first letter and
remaining text.

Bug:  723848 
Change-Id: I62753b82d324c163ede45d96a9a4e7c1a3601e45
Reviewed-on: https://chromium-review.googlesource.com/616462
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Reviewed-by: Koji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#494921}
[modify] https://crrev.com/02d9bf5911935920465f10eac7b62b718851b401/third_party/WebKit/Source/core/BUILD.gn
[modify] https://crrev.com/02d9bf5911935920465f10eac7b62b718851b401/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.cpp
[modify] https://crrev.com/02d9bf5911935920465f10eac7b62b718851b401/third_party/WebKit/Source/core/dom/FirstLetterPseudoElement.h
[add] https://crrev.com/02d9bf5911935920465f10eac7b62b718851b401/third_party/WebKit/Source/core/dom/FirstLetterPseudoElementTest.cpp

Status: Fixed (was: Assigned)

Sign in to add a comment