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

Side by Side Diff: third_party/WebKit/Source/core/layout/line/InlineBox.h

Issue 2261663002: Disallow cast/implicit conversion from LayoutUnit to int/unsigned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: - Created 4 years, 4 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, 2009, 2010, 2011 Apple Inc. All r ights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2010, 2011 Apple Inc. All r ights 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // The logicalLeft position is the left edge of the line box in a horizontal line and the top edge in a vertical line. 204 // The logicalLeft position is the left edge of the line box in a horizontal line and the top edge in a vertical line.
205 LayoutUnit logicalLeft() const { return isHorizontal() ? m_topLeft.x() : m_t opLeft.y(); } 205 LayoutUnit logicalLeft() const { return isHorizontal() ? m_topLeft.x() : m_t opLeft.y(); }
206 LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); } 206 LayoutUnit logicalRight() const { return logicalLeft() + logicalWidth(); }
207 void setLogicalLeft(LayoutUnit left) 207 void setLogicalLeft(LayoutUnit left)
208 { 208 {
209 if (isHorizontal()) 209 if (isHorizontal())
210 setX(left); 210 setX(left);
211 else 211 else
212 setY(left); 212 setY(left);
213 } 213 }
214 int pixelSnappedLogicalLeft() const { return logicalLeft(); } 214 int pixelSnappedLogicalLeft() const { return logicalLeft().toInt(); }
215 int pixelSnappedLogicalRight() const { return logicalRight().ceil(); } 215 int pixelSnappedLogicalRight() const { return logicalRight().ceil(); }
216 int pixelSnappedLogicalTop() const { return logicalTop(); } 216 int pixelSnappedLogicalTop() const { return logicalTop().toInt(); }
217 int pixelSnappedLogicalBottom() const { return logicalBottom().ceil(); } 217 int pixelSnappedLogicalBottom() const { return logicalBottom().ceil(); }
218 218
219 // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line. 219 // The logicalTop[ position is the top edge of the line box in a horizontal line and the left edge in a vertical line.
220 LayoutUnit logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_to pLeft.x(); } 220 LayoutUnit logicalTop() const { return isHorizontal() ? m_topLeft.y() : m_to pLeft.x(); }
221 LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); } 221 LayoutUnit logicalBottom() const { return logicalTop() + logicalHeight(); }
222 void setLogicalTop(LayoutUnit top) 222 void setLogicalTop(LayoutUnit top)
223 { 223 {
224 if (isHorizontal()) 224 if (isHorizontal())
225 setY(top); 225 setY(top);
226 else 226 else
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 455
456 } // namespace blink 456 } // namespace blink
457 457
458 #ifndef NDEBUG 458 #ifndef NDEBUG
459 // Outside the WebCore namespace for ease of invocation from gdb. 459 // Outside the WebCore namespace for ease of invocation from gdb.
460 void showTree(const blink::InlineBox*); 460 void showTree(const blink::InlineBox*);
461 void showLineTree(const blink::InlineBox*); 461 void showLineTree(const blink::InlineBox*);
462 #endif 462 #endif
463 463
464 #endif // InlineBox_h 464 #endif // InlineBox_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/line/EllipsisBox.cpp ('k') | third_party/WebKit/Source/core/layout/line/InlineBox.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698