OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef DOMQuad_h | 5 #ifndef DOMQuad_h |
6 #define DOMQuad_h | 6 #define DOMQuad_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class DOMPoint; | 14 class DOMPoint; |
15 class DOMPointInit; | 15 class DOMPointInit; |
| 16 class DOMRectInit; |
16 | 17 |
17 class CORE_EXPORT DOMQuad : public GarbageCollected<DOMQuad>, | 18 class CORE_EXPORT DOMQuad : public GarbageCollected<DOMQuad>, |
18 public ScriptWrappable { | 19 public ScriptWrappable { |
19 DEFINE_WRAPPERTYPEINFO(); | 20 DEFINE_WRAPPERTYPEINFO(); |
20 | 21 |
21 public: | 22 public: |
22 static DOMQuad* create(const DOMPointInit& p1, | 23 static DOMQuad* create(const DOMPointInit& p1, |
23 const DOMPointInit& p2, | 24 const DOMPointInit& p2, |
24 const DOMPointInit& p3, | 25 const DOMPointInit& p3, |
25 const DOMPointInit& p4); | 26 const DOMPointInit& p4); |
| 27 static DOMQuad* fromRect(const DOMRectInit&); |
26 | 28 |
27 DOMPoint* p1() const { return m_p1; } | 29 DOMPoint* p1() const { return m_p1; } |
28 DOMPoint* p2() const { return m_p2; } | 30 DOMPoint* p2() const { return m_p2; } |
29 DOMPoint* p3() const { return m_p3; } | 31 DOMPoint* p3() const { return m_p3; } |
30 DOMPoint* p4() const { return m_p4; } | 32 DOMPoint* p4() const { return m_p4; } |
31 | 33 |
32 ScriptValue toJSONForBinding(ScriptState*) const; | 34 ScriptValue toJSONForBinding(ScriptState*) const; |
33 | 35 |
34 DEFINE_INLINE_TRACE() { | 36 DEFINE_INLINE_TRACE() { |
35 visitor->trace(m_p1); | 37 visitor->trace(m_p1); |
36 visitor->trace(m_p2); | 38 visitor->trace(m_p2); |
37 visitor->trace(m_p3); | 39 visitor->trace(m_p3); |
38 visitor->trace(m_p4); | 40 visitor->trace(m_p4); |
39 } | 41 } |
40 | 42 |
41 private: | 43 private: |
42 DOMQuad(const DOMPointInit& p1, | 44 DOMQuad(const DOMPointInit& p1, |
43 const DOMPointInit& p2, | 45 const DOMPointInit& p2, |
44 const DOMPointInit& p3, | 46 const DOMPointInit& p3, |
45 const DOMPointInit& p4); | 47 const DOMPointInit& p4); |
| 48 DOMQuad(double x, double y, double width, double height); |
46 | 49 |
47 Member<DOMPoint> m_p1; | 50 Member<DOMPoint> m_p1; |
48 Member<DOMPoint> m_p2; | 51 Member<DOMPoint> m_p2; |
49 Member<DOMPoint> m_p3; | 52 Member<DOMPoint> m_p3; |
50 Member<DOMPoint> m_p4; | 53 Member<DOMPoint> m_p4; |
51 }; | 54 }; |
52 | 55 |
53 } // namespace blink | 56 } // namespace blink |
54 | 57 |
55 #endif | 58 #endif |
OLD | NEW |