| OLD | NEW |
| 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 17 matching lines...) Expand all Loading... |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef LayoutPoint_h | 31 #ifndef LayoutPoint_h |
| 32 #define LayoutPoint_h | 32 #define LayoutPoint_h |
| 33 | 33 |
| 34 #include "FloatPoint.h" | 34 #include "FloatPoint.h" |
| 35 #include "LayoutSize.h" | 35 #include "LayoutSize.h" |
| 36 #include <wtf/MathExtras.h> | 36 #include <wtf/MathExtras.h> |
| 37 | 37 |
| 38 #if PLATFORM(QT) | |
| 39 #include <qglobal.h> | |
| 40 QT_BEGIN_NAMESPACE | |
| 41 class QPoint; | |
| 42 class QPointF; | |
| 43 QT_END_NAMESPACE | |
| 44 #endif | |
| 45 | |
| 46 namespace WebCore { | 38 namespace WebCore { |
| 47 | 39 |
| 48 class LayoutPoint { | 40 class LayoutPoint { |
| 49 public: | 41 public: |
| 50 LayoutPoint() : m_x(0), m_y(0) { } | 42 LayoutPoint() : m_x(0), m_y(0) { } |
| 51 LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { } | 43 LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { } |
| 52 LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { } | 44 LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { } |
| 53 explicit LayoutPoint(const FloatPoint& size) : m_x(size.x()), m_y(size.y())
{ } | 45 explicit LayoutPoint(const FloatPoint& size) : m_x(size.x()), m_y(size.y())
{ } |
| 54 explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.h
eight()) { } | 46 explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.h
eight()) { } |
| 55 | 47 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 83 void clampNegativeToZero() | 75 void clampNegativeToZero() |
| 84 { | 76 { |
| 85 *this = expandedTo(zero()); | 77 *this = expandedTo(zero()); |
| 86 } | 78 } |
| 87 | 79 |
| 88 LayoutPoint transposedPoint() const | 80 LayoutPoint transposedPoint() const |
| 89 { | 81 { |
| 90 return LayoutPoint(m_y, m_x); | 82 return LayoutPoint(m_y, m_x); |
| 91 } | 83 } |
| 92 | 84 |
| 93 #if PLATFORM(QT) | |
| 94 explicit LayoutPoint(const QPoint&); | |
| 95 explicit LayoutPoint(const QPointF&); | |
| 96 operator QPointF() const; | |
| 97 #endif | |
| 98 | |
| 99 private: | 85 private: |
| 100 LayoutUnit m_x, m_y; | 86 LayoutUnit m_x, m_y; |
| 101 }; | 87 }; |
| 102 | 88 |
| 103 inline LayoutPoint& operator+=(LayoutPoint& a, const LayoutSize& b) | 89 inline LayoutPoint& operator+=(LayoutPoint& a, const LayoutSize& b) |
| 104 { | 90 { |
| 105 a.move(b.width(), b.height()); | 91 a.move(b.width(), b.height()); |
| 106 return a; | 92 return a; |
| 107 } | 93 } |
| 108 | 94 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 195 |
| 210 inline LayoutPoint flooredLayoutPoint(const FloatSize& s) | 196 inline LayoutPoint flooredLayoutPoint(const FloatSize& s) |
| 211 { | 197 { |
| 212 return flooredLayoutPoint(FloatPoint(s)); | 198 return flooredLayoutPoint(FloatPoint(s)); |
| 213 } | 199 } |
| 214 | 200 |
| 215 | 201 |
| 216 } // namespace WebCore | 202 } // namespace WebCore |
| 217 | 203 |
| 218 #endif // LayoutPoint_h | 204 #endif // LayoutPoint_h |
| OLD | NEW |