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

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

Issue 1660863002: Force all LayoutUnit construction to be explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also fix LayoutRectTest.cpp 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 28 matching lines...) Expand all
39 #include "wtf/MathExtras.h" 39 #include "wtf/MathExtras.h"
40 #include <algorithm> 40 #include <algorithm>
41 41
42 namespace blink { 42 namespace blink {
43 43
44 class LayoutPoint { 44 class LayoutPoint {
45 DISALLOW_NEW(); 45 DISALLOW_NEW();
46 public: 46 public:
47 LayoutPoint() { } 47 LayoutPoint() { }
48 LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { } 48 LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { }
49 LayoutPoint(int x, int y) : m_x(LayoutUnit(x)), m_y(LayoutUnit(y)) { }
49 LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { } 50 LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { }
50 explicit LayoutPoint(const FloatPoint& point) : m_x(point.x()), m_y(point.y( )) { } 51 explicit LayoutPoint(const FloatPoint& point) : m_x(point.x()), m_y(point.y( )) { }
51 explicit LayoutPoint(const DoublePoint& point) : m_x(point.x()), m_y(point.y ()) { } 52 explicit LayoutPoint(const DoublePoint& point) : m_x(point.x()), m_y(point.y ()) { }
52 explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.h eight()) { } 53 explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.h eight()) { }
53 54
54 static LayoutPoint zero() { return LayoutPoint(); } 55 static LayoutPoint zero() { return LayoutPoint(); }
55 56
56 LayoutUnit x() const { return m_x; } 57 LayoutUnit x() const { return m_x; }
57 LayoutUnit y() const { return m_y; } 58 LayoutUnit y() const { return m_y; }
58 59
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 240 }
240 241
241 inline LayoutPoint flooredLayoutPoint(const FloatSize& s) 242 inline LayoutPoint flooredLayoutPoint(const FloatSize& s)
242 { 243 {
243 return flooredLayoutPoint(FloatPoint(s)); 244 return flooredLayoutPoint(FloatPoint(s));
244 } 245 }
245 246
246 } // namespace blink 247 } // namespace blink
247 248
248 #endif // LayoutPoint_h 249 #endif // LayoutPoint_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/LengthFunctions.cpp ('k') | third_party/WebKit/Source/platform/geometry/LayoutRect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698