Index: Source/core/dom/FirstLetterPseudoElement.cpp |
diff --git a/Source/core/dom/FirstLetterPseudoElement.cpp b/Source/core/dom/FirstLetterPseudoElement.cpp |
index 08d3a1c00b881de7a045f75bbd5140ccb52c246d..b79a20da6c8819f116af0a487944363946c52c7a 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/text/icu/UnicodeIcu.h" |
@@ -77,7 +78,8 @@ unsigned FirstLetterPseudoElement::firstLetterLength(const String& text) |
return 0; |
// Account the next character for first letter. |
- length++; |
+ const String substring = text.is8Bit() ? String::make16BitFrom8BitSource(text.substring(length).characters8(), textLength - length) : text.substring(length); |
+ length += countCharactersAndGraphemesInCluster(substring.characters16(), substring.length(), 0, 1).characters; |
// Keep looking for allowed punctuation for the :first-letter. |
for (; length < textLength; ++length) { |