Index: Source/core/rendering/RenderBlockLineLayout.cpp |
diff --git a/Source/core/rendering/RenderBlockLineLayout.cpp b/Source/core/rendering/RenderBlockLineLayout.cpp |
index b31f46799b50a31d90fbfbaf82731fc63da9c7c3..9918c9a1cbf133d1983db01d1944d40161eef1d3 100644 |
--- a/Source/core/rendering/RenderBlockLineLayout.cpp |
+++ b/Source/core/rendering/RenderBlockLineLayout.cpp |
@@ -1937,14 +1937,40 @@ 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)); |
+ AtomicString& selectedEllipsisStr = ellipsisStr; |
+ |
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; |
+ bool useHorizontalEllipsis = true; |
Dominik Röttsches
2015/01/14 08:18:01
This shouldn't be needed anymore.
h.joshi
2015/01/14 10:17:27
Done.
|
+ |
+ // 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 { |
+ useHorizontalEllipsis = false; |
Dominik Röttsches
2015/01/14 08:18:01
Dito.
h.joshi
2015/01/14 10:17:27
Done.
h.joshi
2015/01/14 10:17:27
Done.
|
+ selectedEllipsisStr = fullstopCharacterStr; |
+ firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, firstLineFont, fullStopString, 1, firstLineStyle(), ellipsisDirection)); |
+ } |
+ ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : 0; |
+ |
+ if (!ellipsisWidth) { |
+ if (font.primaryFontHasGlyphForCharacter(horizontalEllipsis)) { |
+ selectedEllipsisStr = ellipsisStr; |
+ ellipsisWidth = font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style(), ellipsisDirection)); |
+ } else { |
+ selectedEllipsisStr = fullstopCharacterStr; |
+ ellipsisWidth = font.width(constructTextRun(this, font, fullStopString, 1, style(), ellipsisDirection)); |
+ } |
+ } |
// 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 |
@@ -1967,7 +1993,7 @@ void RenderBlockFlow::checkLinesForTextOverflow() |
LayoutUnit width = firstLine ? firstLineEllipsisWidth : ellipsisWidth; |
LayoutUnit blockEdge = ltr ? blockRightEdge : blockLeftEdge; |
if (curr->lineCanAccommodateEllipsis(ltr, blockEdge, lineBoxEdge, width)) { |
- float totalLogicalWidth = curr->placeEllipsis(ellipsisStr, ltr, blockLeftEdge.toFloat(), blockRightEdge.toFloat(), width.toFloat()); |
+ float totalLogicalWidth = curr->placeEllipsis(selectedEllipsisStr, ltr, blockLeftEdge.toFloat(), blockRightEdge.toFloat(), width.toFloat()); |
float logicalLeft = 0; // We are only intersted in the delta from the base position. |
float availableLogicalWidth = (blockRightEdge - blockLeftEdge).toFloat(); |