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

Side by Side Diff: third_party/WebKit/Source/platform/geometry/LayoutRect.h

Issue 1653673002: Even more explicit LayoutUnit conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@moarConstructors
Patch Set: address comments Created 4 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
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, Google Inc. All rights reserved. 2 * Copyright (c) 2012, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void setWidth(LayoutUnit width) { m_size.setWidth(width); } 86 void setWidth(LayoutUnit width) { m_size.setWidth(width); }
87 void setHeight(LayoutUnit height) { m_size.setHeight(height); } 87 void setHeight(LayoutUnit height) { m_size.setHeight(height); }
88 88
89 ALWAYS_INLINE bool isEmpty() const { return m_size.isEmpty(); } 89 ALWAYS_INLINE bool isEmpty() const { return m_size.isEmpty(); }
90 90
91 // NOTE: The result is rounded to integer values, and thus may be not the ex act 91 // NOTE: The result is rounded to integer values, and thus may be not the ex act
92 // center point. 92 // center point.
93 LayoutPoint center() const { return LayoutPoint(x() + width() / 2, y() + hei ght() / 2); } 93 LayoutPoint center() const { return LayoutPoint(x() + width() / 2, y() + hei ght() / 2); }
94 94
95 void move(const LayoutSize& size) { m_location += size; } 95 void move(const LayoutSize& size) { m_location += size; }
96 void move(const IntSize& size) { m_location.move(size.width(), size.height() ); } 96 void move(const IntSize& size) { m_location.move(LayoutUnit(size.width()), L ayoutUnit(size.height())); }
97 void moveBy(const LayoutPoint& offset) { m_location.move(offset.x(), offset. y()); } 97 void moveBy(const LayoutPoint& offset) { m_location.move(offset.x(), offset. y()); }
98 void moveBy(const IntPoint& offset) { m_location.move(LayoutUnit(offset.x()) , LayoutUnit(offset.y())); }
98 void move(LayoutUnit dx, LayoutUnit dy) { m_location.move(dx, dy); } 99 void move(LayoutUnit dx, LayoutUnit dy) { m_location.move(dx, dy); }
99 100
100 void expand(const LayoutSize& size) { m_size += size; } 101 void expand(const LayoutSize& size) { m_size += size; }
101 void expand(const LayoutRectOutsets& box) 102 void expand(const LayoutRectOutsets& box)
102 { 103 {
103 m_location.move(-box.left(), -box.top()); 104 m_location.move(-box.left(), -box.top());
104 m_size.expand(box.left() + box.right(), box.top() + box.bottom()); 105 m_size.expand(box.left() + box.right(), box.top() + box.bottom());
105 } 106 }
106 void expand(LayoutUnit dw, LayoutUnit dh) { m_size.expand(dw, dh); } 107 void expand(LayoutUnit dw, LayoutUnit dh) { m_size.expand(dw, dh); }
107 void expandEdges(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, Layout Unit left) 108 void expandEdges(LayoutUnit top, LayoutUnit right, LayoutUnit bottom, Layout Unit left)
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location )); 256 return IntRect(roundedIntPoint(location), pixelSnappedIntSize(size, location ));
256 } 257 }
257 258
258 // Redeclared here to avoid ODR issues. 259 // Redeclared here to avoid ODR issues.
259 // See platform/testing/GeometryPrinters.h. 260 // See platform/testing/GeometryPrinters.h.
260 void PrintTo(const LayoutRect&, std::ostream*); 261 void PrintTo(const LayoutRect&, std::ostream*);
261 262
262 } // namespace blink 263 } // namespace blink
263 264
264 #endif // LayoutRect_h 265 #endif // LayoutRect_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2D.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698