Index: Source/core/dom/DOMRectReadOnly.h |
diff --git a/Source/core/dom/DOMRectReadOnly.h b/Source/core/dom/DOMRectReadOnly.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e82bb3c71824941f8991f4d66c85cdac6545684a |
--- /dev/null |
+++ b/Source/core/dom/DOMRectReadOnly.h |
@@ -0,0 +1,39 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DOMRectReadOnly_h |
+#define DOMRectReadOnly_h |
+ |
+#include "platform/heap/Handle.h" |
+ |
+namespace WebCore { |
+ |
+class DOMRectReadOnly : public GarbageCollected<DOMRectReadOnly> { |
+public: |
+ static DOMRectReadOnly* create(double x, double y, double width, double height); |
+ |
+ double x() const { return m_x; } |
+ double y() const { return m_y; } |
+ double width() const { return m_width; } |
+ double height() const { return m_height; } |
+ |
+ double top() const { return std::min(m_y, m_y + m_height); } |
+ double right() const { return std::max(m_x, m_x + m_width); } |
+ double bottom() const { return std::max(m_y, m_y + m_height); } |
+ double left() const { return std::min(m_x, m_x + m_width); } |
+ |
+ void trace(Visitor*) { } |
+ |
+protected: |
+ DOMRectReadOnly(double x, double y, double width, double height); |
+ |
+ double m_x; |
+ double m_y; |
+ double m_width; |
+ double m_height; |
+}; |
+ |
+} // namespace WebCore |
+ |
+#endif |