| 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 26 matching lines...) Expand all Loading... |
| 37 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
| 38 #include "wtf/MathExtras.h" | 38 #include "wtf/MathExtras.h" |
| 39 #include <algorithm> | 39 #include <algorithm> |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class LayoutPoint { | 43 class LayoutPoint { |
| 44 DISALLOW_NEW(); | 44 DISALLOW_NEW(); |
| 45 public: | 45 public: |
| 46 LayoutPoint() { } | 46 LayoutPoint() { } |
| 47 LayoutPoint(int x, int y) : m_x(LayoutUnit(x)), m_y(LayoutUnit(y)) { } |
| 47 LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { } | 48 LayoutPoint(LayoutUnit x, LayoutUnit y) : m_x(x), m_y(y) { } |
| 48 LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { } | 49 LayoutPoint(const IntPoint& point) : m_x(point.x()), m_y(point.y()) { } |
| 49 explicit LayoutPoint(const FloatPoint& point) : m_x(point.x()), m_y(point.y(
)) { } | 50 explicit LayoutPoint(const FloatPoint& point) : m_x(point.x()), m_y(point.y(
)) { } |
| 50 explicit LayoutPoint(const DoublePoint& point) : m_x(point.x()), m_y(point.y
()) { } | 51 explicit LayoutPoint(const DoublePoint& point) : m_x(point.x()), m_y(point.y
()) { } |
| 51 explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.h
eight()) { } | 52 explicit LayoutPoint(const LayoutSize& size) : m_x(size.width()), m_y(size.h
eight()) { } |
| 52 | 53 |
| 53 static LayoutPoint zero() { return LayoutPoint(); } | 54 static LayoutPoint zero() { return LayoutPoint(); } |
| 54 | 55 |
| 55 LayoutUnit x() const { return m_x; } | 56 LayoutUnit x() const { return m_x; } |
| 56 LayoutUnit y() const { return m_y; } | 57 LayoutUnit y() const { return m_y; } |
| 57 | 58 |
| 58 void setX(LayoutUnit x) { m_x = x; } | 59 void setX(LayoutUnit x) { m_x = x; } |
| 59 void setY(LayoutUnit y) { m_y = y; } | 60 void setY(LayoutUnit y) { m_y = y; } |
| 60 | 61 |
| 61 void move(const LayoutSize& s) { move(s.width(), s.height()); } | 62 void move(const LayoutSize& s) { move(s.width(), s.height()); } |
| 62 void move(const IntSize& s) { move(s.width(), s.height()); } | 63 void move(const IntSize& s) { move(s.width(), s.height()); } |
| 63 void moveBy(const LayoutPoint& offset) { move(offset.x(), offset.y()); } | 64 void moveBy(const LayoutPoint& offset) { move(offset.x(), offset.y()); } |
| 65 void move(int dx, int dy) { move(LayoutUnit(dx), LayoutUnit(dy)); } |
| 64 void move(LayoutUnit dx, LayoutUnit dy) { m_x += dx; m_y += dy; } | 66 void move(LayoutUnit dx, LayoutUnit dy) { m_x += dx; m_y += dy; } |
| 65 void scale(float sx, float sy) | 67 void scale(float sx, float sy) |
| 66 { | 68 { |
| 67 m_x *= sx; | 69 m_x *= sx; |
| 68 m_y *= sy; | 70 m_y *= sy; |
| 69 } | 71 } |
| 70 | 72 |
| 71 LayoutPoint expandedTo(const LayoutPoint& other) const | 73 LayoutPoint expandedTo(const LayoutPoint& other) const |
| 72 { | 74 { |
| 73 return LayoutPoint(std::max(m_x, other.m_x), std::max(m_y, other.m_y)); | 75 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 Loading... |
| 234 | 236 |
| 235 inline LayoutPoint flooredLayoutPoint(const FloatSize& s) | 237 inline LayoutPoint flooredLayoutPoint(const FloatSize& s) |
| 236 { | 238 { |
| 237 return flooredLayoutPoint(FloatPoint(s)); | 239 return flooredLayoutPoint(FloatPoint(s)); |
| 238 } | 240 } |
| 239 | 241 |
| 240 | 242 |
| 241 } // namespace blink | 243 } // namespace blink |
| 242 | 244 |
| 243 #endif // LayoutPoint_h | 245 #endif // LayoutPoint_h |
| OLD | NEW |