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/DOMPointReadOnly.h" | 5 #include "core/geometry/DOMPointReadOnly.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
9 #include "bindings/core/v8/V8ObjectBuilder.h" | 9 #include "bindings/core/v8/V8ObjectBuilder.h" |
10 #include "core/dom/DOMMatrixInit.h" | 10 #include "core/geometry/DOMMatrixInit.h" |
11 #include "core/dom/DOMMatrixReadOnly.h" | 11 #include "core/geometry/DOMMatrixReadOnly.h" |
12 #include "core/dom/DOMPoint.h" | 12 #include "core/geometry/DOMPoint.h" |
13 #include "core/dom/DOMPointInit.h" | 13 #include "core/geometry/DOMPointInit.h" |
14 | 14 |
15 namespace blink { | 15 namespace blink { |
16 | 16 |
17 DOMPointReadOnly* DOMPointReadOnly::create(double x, | 17 DOMPointReadOnly* DOMPointReadOnly::create(double x, |
18 double y, | 18 double y, |
19 double z, | 19 double z, |
20 double w) { | 20 double w) { |
21 return new DOMPointReadOnly(x, y, z, w); | 21 return new DOMPointReadOnly(x, y, z, w); |
22 } | 22 } |
23 | 23 |
24 ScriptValue DOMPointReadOnly::toJSONForBinding( | 24 ScriptValue DOMPointReadOnly::toJSONForBinding(ScriptState* scriptState) const { |
25 ScriptState* scriptState) const { | |
26 V8ObjectBuilder result(scriptState); | 25 V8ObjectBuilder result(scriptState); |
27 result.addNumber("x", x()); | 26 result.addNumber("x", x()); |
28 result.addNumber("y", y()); | 27 result.addNumber("y", y()); |
29 result.addNumber("z", z()); | 28 result.addNumber("z", z()); |
30 result.addNumber("w", w()); | 29 result.addNumber("w", w()); |
31 return result.scriptValue(); | 30 return result.scriptValue(); |
32 } | 31 } |
33 | 32 |
34 DOMPointReadOnly* DOMPointReadOnly::fromPoint(const DOMPointInit& other) { | 33 DOMPointReadOnly* DOMPointReadOnly::fromPoint(const DOMPointInit& other) { |
35 return new DOMPointReadOnly(other.x(), other.y(), other.z(), other.w()); | 34 return new DOMPointReadOnly(other.x(), other.y(), other.z(), other.w()); |
(...skipping 21 matching lines...) Expand all Loading... |
57 double transformedW = x() * matrix->m14() + y() * matrix->m24() + | 56 double transformedW = x() * matrix->m14() + y() * matrix->m24() + |
58 z() * matrix->m34() + w() * matrix->m44(); | 57 z() * matrix->m34() + w() * matrix->m44(); |
59 return DOMPoint::create(transformedX, transformedY, transformedZ, | 58 return DOMPoint::create(transformedX, transformedY, transformedZ, |
60 transformedW); | 59 transformedW); |
61 } | 60 } |
62 | 61 |
63 DOMPointReadOnly::DOMPointReadOnly(double x, double y, double z, double w) | 62 DOMPointReadOnly::DOMPointReadOnly(double x, double y, double z, double w) |
64 : m_x(x), m_y(y), m_z(z), m_w(w) {} | 63 : m_x(x), m_y(y), m_z(z), m_w(w) {} |
65 | 64 |
66 } // namespace blink | 65 } // namespace blink |
OLD | NEW |