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

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

Issue 2392433002: Avoid showing two dots in ellipsis (Closed)
Patch Set: bug 650083 Created 4 years, 1 month 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. 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 bool ltr = isLeftToRightDirection(); 354 bool ltr = isLeftToRightDirection();
355 if (ltr != flowIsLTR) { 355 if (ltr != flowIsLTR) {
356 // Width in pixels of the visible portion of the box, excluding the 356 // Width in pixels of the visible portion of the box, excluding the
357 // ellipsis. 357 // ellipsis.
358 int visibleBoxWidth = 358 int visibleBoxWidth =
359 (visibleRightEdge - visibleLeftEdge - ellipsisWidth).toInt(); 359 (visibleRightEdge - visibleLeftEdge - ellipsisWidth).toInt();
360 ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth 360 ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth
361 : logicalRight() - visibleBoxWidth; 361 : logicalRight() - visibleBoxWidth;
362 } 362 }
363 363
364 int offset = offsetForPosition(ellipsisX, false); 364 // The box's width includes partial glyphs, so respect that when placing
365 // the ellipsis.
366 int offset = offsetForPosition(ellipsisX);
365 if (offset == 0 && ltr == flowIsLTR) { 367 if (offset == 0 && ltr == flowIsLTR) {
366 // No characters should be laid out. Set ourselves to full truncation and 368 // No characters should be laid out. Set ourselves to full truncation and
367 // place the ellipsis at the min of our start and the ellipsis edge. 369 // place the ellipsis at the min of our start and the ellipsis edge.
368 setTruncation(cFullTruncation); 370 setTruncation(cFullTruncation);
369 truncatedWidth += ellipsisWidth; 371 truncatedWidth += ellipsisWidth;
370 return std::min(ellipsisX, logicalLeft()); 372 return std::min(ellipsisX, logicalLeft());
371 } 373 }
372 374
373 // Set the truncation index on the text run. 375 // Set the truncation index on the text run.
374 setTruncation(offset); 376 setTruncation(offset);
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 const int layoutObjectCharacterOffset = 75; 683 const int layoutObjectCharacterOffset = 75;
682 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) 684 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++)
683 fputc(' ', stderr); 685 fputc(' ', stderr);
684 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), 686 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(),
685 value.utf8().data()); 687 value.utf8().data());
686 } 688 }
687 689
688 #endif 690 #endif
689 691
690 } // namespace blink 692 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/platform/linux/fast/text/ellipsis-rtl-text-in-ltr-flow-underline-expected.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698