Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Unified Diff: third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp

Issue 2880653002: Display ellipsis correctly in inline blocks adjacent to floats (Closed)
Patch Set: bug 720377 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 e4d74e82c235958022d425020c91596b0d0241fc..55c2ebe5430807f7c892d985e054ae61ad5dc9a5 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineTextBox.cpp
@@ -383,14 +383,9 @@ LayoutUnit InlineTextBox::PlaceEllipsisBox(bool flow_is_ltr,
LayoutUnit ellipsis_x = flow_is_ltr ? visible_right_edge - ellipsis_width
: visible_left_edge + ellipsis_width;
- if (IsLeftToRightDirection() == flow_is_ltr && !flow_is_ltr &&
- logical_left_offset < 0)
- ellipsis_x -= logical_left_offset;
-
bool ltr_full_truncation = flow_is_ltr && ellipsis_x <= adjusted_logical_left;
bool rtl_full_truncation =
- !flow_is_ltr &&
- ellipsis_x > adjusted_logical_left + LogicalWidth() + ellipsis_width;
+ !flow_is_ltr && ellipsis_x > adjusted_logical_left + LogicalWidth();
if (ltr_full_truncation || rtl_full_truncation) {
// Too far. Just set full truncation, but return -1 and let the ellipsis
// just be placed at the edge of the box.
@@ -419,9 +414,14 @@ LayoutUnit InlineTextBox::PlaceEllipsisBox(bool flow_is_ltr,
: LogicalRight() - visible_box_width;
}
+ // OffsetForPosition() expects the position relative to the root box.
+ if (ltr == flow_is_ltr && !flow_is_ltr && logical_left_offset < 0)
+ ellipsis_x -= logical_left_offset;
+
// 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.
+ // TODO(crbug.com/722043: This doesn't always give the best results.
int offset = OffsetForPosition(ellipsis_x, !ltr);
// Full truncation is only necessary when we're flowing left-to-right.
if (flow_is_ltr && offset == 0 && ltr == flow_is_ltr) {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBlockFlowLine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698