Chromium Code Reviews| Index: Source/core/dom/FirstLetterPseudoElement.cpp |
| diff --git a/Source/core/dom/FirstLetterPseudoElement.cpp b/Source/core/dom/FirstLetterPseudoElement.cpp |
| index d47a521eba3c9acb4c8cc2dc9c3489c14df10b4c..082e5da9268bae51b18151f19a8de542960e8204 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,11 @@ unsigned FirstLetterPseudoElement::firstLetterLength(const String& text) |
| return 0; |
| // Account the next character for first letter. |
| - length++; |
| + String substring = text.substring(length); |
| + const bool is8Bit = substring.is8Bit(); |
| + if (is8Bit) |
| + substring = String::make16BitFrom8BitSource(text.substring(length).characters8(), substring.length()); |
| + length += countCharactersAndGraphemesInCluster(substring.characters16(), substring.length(), 0, 1).characters; |
|
changseok
2015/06/01 17:47:47
Here the endIndex 1 doesn't work for a special cha
|
| // Keep looking for allowed punctuation for the :first-letter. |
| for (; length < textLength; ++length) { |