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 #include "core/dom/DOMRectReadOnly.h" |
| 6 |
| 7 #include "bindings/core/v8/ScriptValue.h" |
| 8 #include "bindings/core/v8/V8ObjectBuilder.h" |
| 9 #include "core/dom/DOMRectInit.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 DOMRectReadOnly* DOMRectReadOnly::create(double x, |
| 14 double y, |
| 15 double width, |
| 16 double height) { |
| 17 return new DOMRectReadOnly(x, y, width, height); |
| 18 } |
| 19 |
| 20 ScriptValue DOMRectReadOnly::toJSONForBinding(ScriptState* scriptState) const { |
| 21 V8ObjectBuilder result(scriptState); |
| 22 result.addNumber("x", x()); |
| 23 result.addNumber("y", y()); |
| 24 result.addNumber("width", width()); |
| 25 result.addNumber("height", height()); |
| 26 result.addNumber("top", top()); |
| 27 result.addNumber("right", right()); |
| 28 result.addNumber("bottom", bottom()); |
| 29 result.addNumber("left", left()); |
| 30 return result.scriptValue(); |
| 31 } |
| 32 |
| 33 DOMRectReadOnly* DOMRectReadOnly::fromRect(const DOMRectInit& other) { |
| 34 return new DOMRectReadOnly(other.x(), other.y(), other.width(), other.height()
); |
| 35 } |
| 36 |
| 37 DOMRectReadOnly::DOMRectReadOnly(double x, |
| 38 double y, |
| 39 double width, |
| 40 double height) |
| 41 : m_x(x), m_y(y), m_width(width), m_height(height) {} |
| 42 |
| 43 } // namespace blink |
OLD | NEW |