OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DOMQuad_h | |
6 #define DOMQuad_h | |
7 | |
8 #include "bindings/core/v8/ScriptValue.h" | |
9 #include "bindings/core/v8/ScriptWrappable.h" | |
10 #include "core/CoreExport.h" | |
11 | |
12 namespace blink { | |
13 | |
14 class DOMPoint; | |
15 class DOMPointInit; | |
16 class DOMQuadInit; | |
17 class DOMRect; | |
18 class DOMRectInit; | |
19 | |
20 class CORE_EXPORT DOMQuad : public GarbageCollected<DOMQuad>, | |
21 public ScriptWrappable { | |
22 DEFINE_WRAPPERTYPEINFO(); | |
23 | |
24 public: | |
25 static DOMQuad* create(const DOMPointInit& p1, | |
26 const DOMPointInit& p2, | |
27 const DOMPointInit& p3, | |
28 const DOMPointInit& p4); | |
29 static DOMQuad* fromRect(const DOMRectInit&); | |
30 static DOMQuad* fromQuad(const DOMQuadInit&); | |
31 | |
32 DOMPoint* p1() const { return m_p1; } | |
33 DOMPoint* p2() const { return m_p2; } | |
34 DOMPoint* p3() const { return m_p3; } | |
35 DOMPoint* p4() const { return m_p4; } | |
36 | |
37 DOMRect* getBounds(); | |
38 | |
39 ScriptValue toJSONForBinding(ScriptState*) const; | |
40 | |
41 DEFINE_INLINE_TRACE() { | |
42 visitor->trace(m_p1); | |
43 visitor->trace(m_p2); | |
44 visitor->trace(m_p3); | |
45 visitor->trace(m_p4); | |
46 } | |
47 | |
48 private: | |
49 DOMQuad(const DOMPointInit& p1, | |
50 const DOMPointInit& p2, | |
51 const DOMPointInit& p3, | |
52 const DOMPointInit& p4); | |
53 DOMQuad(double x, double y, double width, double height); | |
54 | |
55 void calculateBounds(); | |
56 | |
57 Member<DOMPoint> m_p1; | |
58 Member<DOMPoint> m_p2; | |
59 Member<DOMPoint> m_p3; | |
60 Member<DOMPoint> m_p4; | |
61 | |
62 double m_left; | |
63 double m_right; | |
64 double m_top; | |
65 double m_bottom; | |
66 }; | |
67 | |
68 } // namespace blink | |
69 | |
70 #endif | |
OLD | NEW |