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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/InlineBox.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 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 InlineBox* InlineBox::prevLeafChildIgnoringLineBreak() const { 298 InlineBox* InlineBox::prevLeafChildIgnoringLineBreak() const {
299 InlineBox* leaf = prevLeafChild(); 299 InlineBox* leaf = prevLeafChild();
300 return (leaf && leaf->isLineBreak()) ? nullptr : leaf; 300 return (leaf && leaf->isLineBreak()) ? nullptr : leaf;
301 } 301 }
302 302
303 SelectionState InlineBox::getSelectionState() const { 303 SelectionState InlineBox::getSelectionState() const {
304 return getLineLayoutItem().getSelectionState(); 304 return getLineLayoutItem().getSelectionState();
305 } 305 }
306 306
307 bool InlineBox::canAccommodateEllipsis(bool ltr, 307 bool InlineBox::canAccommodateEllipsis(bool ltr,
308 int blockEdge, 308 LayoutUnit blockEdge,
309 int ellipsisWidth) const { 309 LayoutUnit ellipsisWidth) const {
310 // Non-atomic inline-level elements can always accommodate an ellipsis. 310 // Non-atomic inline-level elements can always accommodate an ellipsis.
311 // Skip list markers and try the next box. 311 // Skip list markers and try the next box.
312 if (!getLineLayoutItem().isAtomicInlineLevel() || 312 if (!getLineLayoutItem().isAtomicInlineLevel() ||
313 getLineLayoutItem().isListMarker()) 313 getLineLayoutItem().isListMarker())
314 return true; 314 return true;
315 315
316 IntRect boxRect(x().toInt(), 0, m_logicalWidth.toInt(), 10); 316 LayoutRect boxRect(x(), LayoutUnit(), m_logicalWidth, LayoutUnit(10));
317 IntRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge, 0, 317 LayoutRect ellipsisRect(ltr ? blockEdge - ellipsisWidth : blockEdge,
318 ellipsisWidth, 10); 318 LayoutUnit(), ellipsisWidth, LayoutUnit(10));
319 return !(boxRect.intersects(ellipsisRect)); 319 return !(boxRect.intersects(ellipsisRect));
320 } 320 }
321 321
322 LayoutUnit InlineBox::placeEllipsisBox(bool, 322 LayoutUnit InlineBox::placeEllipsisBox(bool,
323 LayoutUnit, 323 LayoutUnit,
324 LayoutUnit, 324 LayoutUnit,
325 LayoutUnit, 325 LayoutUnit,
326 LayoutUnit& truncatedWidth, 326 LayoutUnit& truncatedWidth,
327 bool&) { 327 bool&) {
328 // Use -1 to mean "we didn't set the position." 328 // Use -1 to mean "we didn't set the position."
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 401
402 void showLineTree(const blink::InlineBox* b) { 402 void showLineTree(const blink::InlineBox* b) {
403 if (b) 403 if (b)
404 b->showLineTreeForThis(); 404 b->showLineTreeForThis();
405 else 405 else
406 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n"); 406 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n");
407 } 407 }
408 408
409 #endif 409 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/InlineBox.h ('k') | third_party/WebKit/Source/core/layout/line/InlineFlowBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698