Chromium Code Reviews| Index: Source/core/rendering/RenderBlock.cpp |
| diff --git a/Source/core/rendering/RenderBlock.cpp b/Source/core/rendering/RenderBlock.cpp |
| index 2604be6e70be9b2c8f0059ad47f3d9cd4ea90254..b1ee0e6eb70355229bb1b7df602f130c3eb0d683 100644 |
| --- a/Source/core/rendering/RenderBlock.cpp |
| +++ b/Source/core/rendering/RenderBlock.cpp |
| @@ -3634,6 +3634,9 @@ static inline unsigned firstLetterLength(const String& text) |
| unsigned length = 0; |
| unsigned textLength = text.length(); |
| + if (textLength == 0) |
| + return length; |
| + |
| // Account for leading spaces first. |
| while (length < textLength && isSpaceForFirstLetter(text[length])) |
| length++; |
| @@ -3643,7 +3646,7 @@ static inline unsigned firstLetterLength(const String& text) |
| length++; |
| // Bail if we didn't find a letter before the end of the text or before a space. |
| - if (isSpaceForFirstLetter(text[length]) || (textLength && length == textLength)) |
| + if (isSpaceForFirstLetter(text[length]) || length == textLength) |
| return 0; |
| // Account the next character for first letter. |
| @@ -3658,8 +3661,6 @@ static inline unsigned firstLetterLength(const String& text) |
| length = scanLength + 1; |
| } |
| - |
| - // FIXME: If textLength is 0, length may still be 1! |
| return length; |
| } |
| @@ -3732,7 +3733,7 @@ void RenderBlock::updateFirstLetter() |
| // FIXME: If there is leading punctuation in a different RenderText than |
| // the first letter, we'll not apply the correct style to it. |
| length = firstLetterLength(toRenderText(currChild)->originalText()); |
| - if (length) |
| + if (length || (currChild->isBR() || (currChild->isText() && toRenderText(currChild)->isWordBreak()))) |
|
leviw_travelin_and_unemployed
2014/10/29 20:26:52
Can you extract these cases into a static named fu
dsinclair
2014/10/30 14:07:27
Done.
|
| break; |
| currChild = currChild->nextSibling(); |
| } else if (currChild->isListMarker()) { |