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 "config.h" | 5 #include "config.h" |
6 #include "core/dom/DOMPoint.h" | 6 #include "core/dom/DOMPoint.h" |
| 7 #include "core/dom/DOMPointInit.h" |
7 | 8 |
8 namespace blink { | 9 namespace blink { |
9 | 10 |
10 DOMPoint* DOMPoint::create(const Dictionary& point) | 11 DOMPoint* DOMPoint::create(const DOMPointInit& point) |
11 { | 12 { |
12 double x = 0; | 13 return new DOMPoint(point.x(), point.y(), point.z(), point.w()); |
13 double y = 0; | |
14 double z = 0; | |
15 double w = 0; | |
16 | |
17 if (!DictionaryHelper::get(point, "x", x)) | |
18 x = 0; | |
19 if (!DictionaryHelper::get(point, "y", y)) | |
20 y = 0; | |
21 if (!DictionaryHelper::get(point, "z", z)) | |
22 z = 0; | |
23 if (!DictionaryHelper::get(point, "w", w)) | |
24 w = 1; | |
25 | |
26 return new DOMPoint(x, y, z, w); | |
27 } | 14 } |
28 | 15 |
29 DOMPoint* DOMPoint::create(double x, double y, double z, double w) | 16 DOMPoint* DOMPoint::create(double x, double y, double z, double w) |
30 { | 17 { |
31 return new DOMPoint(x, y, z, w); | 18 return new DOMPoint(x, y, z, w); |
32 } | 19 } |
33 | 20 |
34 DOMPoint::DOMPoint(double x, double y, double z, double w) | 21 DOMPoint::DOMPoint(double x, double y, double z, double w) |
35 : DOMPointReadOnly(x, y, z, w) | 22 : DOMPointReadOnly(x, y, z, w) |
36 { | 23 { |
37 } | 24 } |
38 | 25 |
39 } // namespace blink | 26 } // namespace blink |
OLD | NEW |