| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef DOMRectReadOnly_h | |
| 6 #define DOMRectReadOnly_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | |
| 9 #include "core/CoreExport.h" | |
| 10 #include "platform/heap/Handle.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class DOMRectInit; | |
| 15 class ScriptValue; | |
| 16 class ScriptState; | |
| 17 | |
| 18 class CORE_EXPORT DOMRectReadOnly : public GarbageCollected<DOMRectReadOnly>, | |
| 19 public ScriptWrappable { | |
| 20 DEFINE_WRAPPERTYPEINFO(); | |
| 21 | |
| 22 public: | |
| 23 static DOMRectReadOnly* create(double x, | |
| 24 double y, | |
| 25 double width, | |
| 26 double height); | |
| 27 static DOMRectReadOnly* fromRect(const DOMRectInit&); | |
| 28 | |
| 29 double x() const { return m_x; } | |
| 30 double y() const { return m_y; } | |
| 31 double width() const { return m_width; } | |
| 32 double height() const { return m_height; } | |
| 33 | |
| 34 double top() const { return std::min(m_y, m_y + m_height); } | |
| 35 double right() const { return std::max(m_x, m_x + m_width); } | |
| 36 double bottom() const { return std::max(m_y, m_y + m_height); } | |
| 37 double left() const { return std::min(m_x, m_x + m_width); } | |
| 38 | |
| 39 DEFINE_INLINE_TRACE() {} | |
| 40 | |
| 41 ScriptValue toJSONForBinding(ScriptState*) const; | |
| 42 | |
| 43 protected: | |
| 44 DOMRectReadOnly(double x, double y, double width, double height); | |
| 45 | |
| 46 double m_x; | |
| 47 double m_y; | |
| 48 double m_width; | |
| 49 double m_height; | |
| 50 }; | |
| 51 | |
| 52 } // namespace blink | |
| 53 | |
| 54 #endif | |
| OLD | NEW |