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