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

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

Issue 2367423004: Place ellipsis correctly when its at the edge of a box (Closed)
Patch Set: bug 645938 Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2000 Dirk Mueller (mueller@kde.org) 3 * (C) 2000 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // behavior depends both on both the parent and the inline block's direc tionality, we 339 // behavior depends both on both the parent and the inline block's direc tionality, we
340 // must keep track of these separately. 340 // must keep track of these separately.
341 bool ltr = isLeftToRightDirection(); 341 bool ltr = isLeftToRightDirection();
342 if (ltr != flowIsLTR) { 342 if (ltr != flowIsLTR) {
343 // Width in pixels of the visible portion of the box, excluding the ellipsis. 343 // Width in pixels of the visible portion of the box, excluding the ellipsis.
344 int visibleBoxWidth = (visibleRightEdge - visibleLeftEdge - ellipsis Width).toInt(); 344 int visibleBoxWidth = (visibleRightEdge - visibleLeftEdge - ellipsis Width).toInt();
345 ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth : logicalRig ht() - visibleBoxWidth; 345 ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth : logicalRig ht() - visibleBoxWidth;
346 } 346 }
347 347
348 int offset = offsetForPosition(ellipsisX, false); 348 int offset = offsetForPosition(ellipsisX, false);
349 if (offset == 0) { 349 if (offset == 0 && ltr == flowIsLTR) {
350 // No characters should be laid out. Set ourselves to full truncati on and place the ellipsis at the min of our start 350 // No characters should be laid out. Set ourselves to full truncati on and place the ellipsis at the min of our start
351 // and the ellipsis edge. 351 // and the ellipsis edge.
352 setTruncation(cFullTruncation); 352 setTruncation(cFullTruncation);
353 truncatedWidth += ellipsisWidth; 353 truncatedWidth += ellipsisWidth;
354 return std::min(ellipsisX, logicalLeft()); 354 return std::min(ellipsisX, logicalLeft());
355 } 355 }
356 356
357 // Set the truncation index on the text run. 357 // Set the truncation index on the text run.
358 setTruncation(offset); 358 setTruncation(offset);
359 359
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer( )); 626 printedCharacters = fprintf(stderr, "\t%s %p", obj.name(), obj.debugPointer( ));
627 const int layoutObjectCharacterOffset = 75; 627 const int layoutObjectCharacterOffset = 75;
628 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) 628 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++)
629 fputc(' ', stderr); 629 fputc(' ', stderr);
630 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata()); 630 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), value.utf8().d ata());
631 } 631 }
632 632
633 #endif 633 #endif
634 634
635 } // namespace blink 635 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-at-edge-of-rtl-text-in-ltr-flow-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698