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

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

Issue 2702043002: Use LayoutUnit for positioning ellipses (Closed)
Patch Set: bug 693905-2 Created 3 years, 10 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. 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (ltrEllipsisWithinBox || rtlEllipsisWithinBox) { 347 if (ltrEllipsisWithinBox || rtlEllipsisWithinBox) {
348 foundBox = true; 348 foundBox = true;
349 349
350 // The inline box may have different directionality than it's parent. Since 350 // The inline box may have different directionality than it's parent. Since
351 // truncation behavior depends both on both the parent and the inline 351 // truncation behavior depends both on both the parent and the inline
352 // block's directionality, we must keep track of these separately. 352 // block's directionality, we must keep track of these separately.
353 bool ltr = isLeftToRightDirection(); 353 bool ltr = isLeftToRightDirection();
354 if (ltr != flowIsLTR) { 354 if (ltr != flowIsLTR) {
355 // Width in pixels of the visible portion of the box, excluding the 355 // Width in pixels of the visible portion of the box, excluding the
356 // ellipsis. 356 // ellipsis.
357 int visibleBoxWidth = 357 LayoutUnit visibleBoxWidth =
358 (visibleRightEdge - visibleLeftEdge - ellipsisWidth).toInt(); 358 visibleRightEdge - visibleLeftEdge - ellipsisWidth;
359 ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth 359 ellipsisX = flowIsLTR ? logicalLeft() + visibleBoxWidth
360 : logicalRight() - visibleBoxWidth; 360 : logicalRight() - visibleBoxWidth;
361 } 361 }
362 362
363 // The box's width includes partial glyphs, so respect that when placing 363 // The box's width includes partial glyphs, so respect that when placing
364 // the ellipsis. 364 // the ellipsis.
365 int offset = offsetForPosition(ellipsisX); 365 int offset = offsetForPosition(ellipsisX);
366 if (offset == 0 && ltr == flowIsLTR) { 366 if (offset == 0 && ltr == flowIsLTR) {
367 // No characters should be laid out. Set ourselves to full truncation and 367 // No characters should be laid out. Set ourselves to full truncation and
368 // place the ellipsis at the min of our start and the ellipsis edge. 368 // place the ellipsis at the min of our start and the ellipsis edge.
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 const int layoutObjectCharacterOffset = 75; 688 const int layoutObjectCharacterOffset = 75;
689 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++) 689 for (; printedCharacters < layoutObjectCharacterOffset; printedCharacters++)
690 fputc(' ', stderr); 690 fputc(' ', stderr);
691 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(), 691 fprintf(stderr, "(%d,%d) \"%s\"\n", start(), start() + len(),
692 value.utf8().data()); 692 value.utf8().data());
693 } 693 }
694 694
695 #endif 695 #endif
696 696
697 } // namespace blink 697 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698