Chromium Code Reviews| Index: Source/core/rendering/RenderBlockLineLayout.cpp |
| diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp |
| index dce62643c71da167db71b876470ceadf371e144e..b663c41764be8d5ada7d8e25809d19e652972b62 100644 |
| --- a/Source/core/rendering/RenderBlockLineLayout.cpp |
| +++ b/Source/core/rendering/RenderBlockLineLayout.cpp |
| @@ -1939,14 +1939,34 @@ void RenderBlockFlow::deleteEllipsisLineBoxes() |
| void RenderBlockFlow::checkLinesForTextOverflow() |
| { |
| // Determine the width of the ellipsis using the current font. |
| - // FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP) if horizontal ellipsis is "not renderable" |
| const Font& font = style()->font(); |
| + |
| + const UChar fullStopString[] = {fullstopCharacter, fullstopCharacter, fullstopCharacter}; |
| + DEFINE_STATIC_LOCAL(AtomicString, fullstopCharacterStr, (fullStopString, 3)); |
| DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1)); |
| + |
| const Font& firstLineFont = firstLineStyle()->font(); |
| // FIXME: We should probably not hard-code the direction here. https://crbug.com/333004 |
| TextDirection ellipsisDirection = LTR; |
| - float firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, firstLineFont, &horizontalEllipsis, 1, firstLineStyle(), ellipsisDirection)); |
| - float ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style(), ellipsisDirection)); |
| + float firstLineEllipsisWidth = 0; |
| + float ellipsisWidth = 0; |
| + |
| + // As per CSS3 http://www.w3.org/TR/2003/CR-css3-text-20030514/ sequence of three |
| + // Full Stops (002E) can be used. |
| + if (firstLineFont.primaryFontHasGlyphForCharacter(horizontalEllipsis)) { |
| + firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, firstLineFont, &horizontalEllipsis, 1, firstLineStyle(), ellipsisDirection)); |
| + } else { |
| + ellipsisStr = fullstopCharacterStr; |
|
Dominik Röttsches
2014/12/15 09:37:41
Are you intentionally reassigning the value of the
h.joshi
2014/12/24 06:30:59
Made changes to the code and avoided reassigning.
|
| + firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, firstLineFont, &fullstopCharacter, 1, firstLineStyle(), ellipsisDirection)) * 3; |
|
Dominik Röttsches
2014/12/15 09:37:41
Multiplying by three is not necessarily identical
h.joshi
2014/12/24 06:30:59
Made suggested changes.
|
| + } |
| + ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : 0; |
| + |
| + if (!ellipsisWidth) { |
| + if (font.primaryFontHasGlyphForCharacter(horizontalEllipsis)) |
| + ellipsisWidth = font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style(), ellipsisDirection)); |
| + else |
| + ellipsisWidth = font.width(constructTextRun(this, font, &fullstopCharacter, 1, style(), ellipsisDirection)) * 3; |
|
Dominik Röttsches
2014/12/15 09:37:41
See above.
|
| + } |
| // For LTR text truncation, we want to get the right edge of our padding box, and then we want to see |
| // if the right edge of a line box exceeds that. For RTL, we use the left edge of the padding box and |