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

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

Issue 1648573002: Transition to explicit constructors in LayoutUnit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove int constructors for size/point... they result in incorrect conversions until LayoutUnit is … 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 LayoutUnit x() const { return m_x; } 55 LayoutUnit x() const { return m_x; }
56 LayoutUnit y() const { return m_y; } 56 LayoutUnit y() const { return m_y; }
57 57
58 void setX(LayoutUnit x) { m_x = x; } 58 void setX(LayoutUnit x) { m_x = x; }
59 void setY(LayoutUnit y) { m_y = y; } 59 void setY(LayoutUnit y) { m_y = y; }
60 60
61 void move(const LayoutSize& s) { move(s.width(), s.height()); } 61 void move(const LayoutSize& s) { move(s.width(), s.height()); }
62 void move(const IntSize& s) { move(s.width(), s.height()); } 62 void move(const IntSize& s) { move(s.width(), s.height()); }
63 void moveBy(const LayoutPoint& offset) { move(offset.x(), offset.y()); } 63 void moveBy(const LayoutPoint& offset) { move(offset.x(), offset.y()); }
64 void move(int dx, int dy) { move(LayoutUnit(dx), LayoutUnit(dy)); }
64 void move(LayoutUnit dx, LayoutUnit dy) { m_x += dx; m_y += dy; } 65 void move(LayoutUnit dx, LayoutUnit dy) { m_x += dx; m_y += dy; }
65 void scale(float sx, float sy) 66 void scale(float sx, float sy)
66 { 67 {
67 m_x *= sx; 68 m_x *= sx;
68 m_y *= sy; 69 m_y *= sy;
69 } 70 }
70 71
71 LayoutPoint expandedTo(const LayoutPoint& other) const 72 LayoutPoint expandedTo(const LayoutPoint& other) const
72 { 73 {
73 return LayoutPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y)); 74 return LayoutPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y));
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 235
235 inline LayoutPoint flooredLayoutPoint(const FloatSize& s) 236 inline LayoutPoint flooredLayoutPoint(const FloatSize& s)
236 { 237 {
237 return flooredLayoutPoint(FloatPoint(s)); 238 return flooredLayoutPoint(FloatPoint(s));
238 } 239 }
239 240
240 241
241 } // namespace blink 242 } // namespace blink
242 243
243 #endif // LayoutPoint_h 244 #endif // LayoutPoint_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698