| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DOMRectReadOnly_h | 5 #ifndef DOMRectReadOnly_h |
| 6 #define DOMRectReadOnly_h | 6 #define DOMRectReadOnly_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class ScriptValue; |
| 15 class ScriptState; |
| 16 |
| 14 class CORE_EXPORT DOMRectReadOnly : public GarbageCollected<DOMRectReadOnly>, | 17 class CORE_EXPORT DOMRectReadOnly : public GarbageCollected<DOMRectReadOnly>, |
| 15 public ScriptWrappable { | 18 public ScriptWrappable { |
| 16 DEFINE_WRAPPERTYPEINFO(); | 19 DEFINE_WRAPPERTYPEINFO(); |
| 17 | 20 |
| 18 public: | 21 public: |
| 19 static DOMRectReadOnly* create(double x, | 22 static DOMRectReadOnly* create(double x, |
| 20 double y, | 23 double y, |
| 21 double width, | 24 double width, |
| 22 double height); | 25 double height); |
| 23 | 26 |
| 24 double x() const { return m_x; } | 27 double x() const { return m_x; } |
| 25 double y() const { return m_y; } | 28 double y() const { return m_y; } |
| 26 double width() const { return m_width; } | 29 double width() const { return m_width; } |
| 27 double height() const { return m_height; } | 30 double height() const { return m_height; } |
| 28 | 31 |
| 29 double top() const { return std::min(m_y, m_y + m_height); } | 32 double top() const { return std::min(m_y, m_y + m_height); } |
| 30 double right() const { return std::max(m_x, m_x + m_width); } | 33 double right() const { return std::max(m_x, m_x + m_width); } |
| 31 double bottom() const { return std::max(m_y, m_y + m_height); } | 34 double bottom() const { return std::max(m_y, m_y + m_height); } |
| 32 double left() const { return std::min(m_x, m_x + m_width); } | 35 double left() const { return std::min(m_x, m_x + m_width); } |
| 33 | 36 |
| 34 DEFINE_INLINE_TRACE() {} | 37 DEFINE_INLINE_TRACE() {} |
| 35 | 38 |
| 39 ScriptValue toJSONForBinding(ScriptState*) const; |
| 40 |
| 36 protected: | 41 protected: |
| 37 DOMRectReadOnly(double x, double y, double width, double height); | 42 DOMRectReadOnly(double x, double y, double width, double height); |
| 38 | 43 |
| 39 double m_x; | 44 double m_x; |
| 40 double m_y; | 45 double m_y; |
| 41 double m_width; | 46 double m_width; |
| 42 double m_height; | 47 double m_height; |
| 43 }; | 48 }; |
| 44 | 49 |
| 45 } // namespace blink | 50 } // namespace blink |
| 46 | 51 |
| 47 #endif | 52 #endif |
| OLD | NEW |