| Index: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
|
| index de36b881bd4f832c2bd2e153a5e7ffca85785c6c..4a7da7df98c098f5ebbc38b764546df452579f0d 100644
|
| --- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
|
| @@ -363,9 +363,10 @@ LayoutUnit InlineTextBox::placeEllipsisBox(bool flowIsLTR,
|
| : logicalRight() - visibleBoxWidth;
|
| }
|
|
|
| - // The box's width includes partial glyphs, so respect that when placing
|
| - // the ellipsis.
|
| - int offset = offsetForPosition(ellipsisX);
|
| + // We measure the text using the second half of the previous character and
|
| + // the first half of the current one when the text is rtl. This gives a
|
| + // more accurate position in rtl text.
|
| + int offset = offsetForPosition(ellipsisX, !ltr);
|
| // Full truncation is only necessary when we're flowing left-to-right.
|
| if (flowIsLTR && offset == 0 && ltr == flowIsLTR) {
|
| // No characters should be laid out. Set ourselves to full truncation and
|
| @@ -375,6 +376,13 @@ LayoutUnit InlineTextBox::placeEllipsisBox(bool flowIsLTR,
|
| return std::min(ellipsisX, logicalLeft());
|
| }
|
|
|
| + // When the text's direction doesn't match the flow's direction we can
|
| + // choose an offset that starts outside the visible box: compensate for that
|
| + // if necessary.
|
| + if (flowIsLTR != ltr && logicalLeft() < 0 && offset >= m_start &&
|
| + positionForOffset(offset) < logicalLeft().abs())
|
| + offset++;
|
| +
|
| // Set the truncation index on the text run.
|
| setTruncation(offset);
|
|
|
|
|