Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Unified Diff: Source/core/dom/FirstLetterPseudoElement.cpp

Issue 1133853006: Elements whose contents start with an astral Unicode symbol disappear when CSS `::first-letter` is … Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/platform/text/TextBreakIterator.h » ('j') | Source/platform/text/TextBreakIterator.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/FirstLetterPseudoElement.cpp
diff --git a/Source/core/dom/FirstLetterPseudoElement.cpp b/Source/core/dom/FirstLetterPseudoElement.cpp
index d47a521eba3c9acb4c8cc2dc9c3489c14df10b4c..3fc0c394093667a0ac2f3bf4e8a652089250522c 100644
--- a/Source/core/dom/FirstLetterPseudoElement.cpp
+++ b/Source/core/dom/FirstLetterPseudoElement.cpp
@@ -30,6 +30,7 @@
#include "core/layout/LayoutObjectInlines.h"
#include "core/layout/LayoutText.h"
#include "core/layout/LayoutTextFragment.h"
+#include "platform/text/TextBreakIterator.h"
#include "wtf/TemporaryChange.h"
#include "wtf/text/WTFString.h"
#include "wtf/unicode/icu/UnicodeIcu.h"
@@ -77,7 +78,7 @@ unsigned FirstLetterPseudoElement::firstLetterLength(const String& text)
return 0;
// Account the next character for first letter.
- length++;
+ length += numCharactersInGraphemeClusters(text.substring(length), 1);
// Keep looking for allowed punctuation for the :first-letter.
for (; length < textLength; ++length) {
« no previous file with comments | « no previous file | Source/platform/text/TextBreakIterator.h » ('j') | Source/platform/text/TextBreakIterator.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698