OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ScriptCustomElementDefinition_h | 5 #ifndef ScriptCustomElementDefinition_h |
6 #define ScriptCustomElementDefinition_h | 6 #define ScriptCustomElementDefinition_h |
7 | 7 |
8 #include "bindings/core/v8/ScopedPersistent.h" | 8 #include "bindings/core/v8/ScopedPersistent.h" |
9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 static ScriptCustomElementDefinition* forConstructor( | 26 static ScriptCustomElementDefinition* forConstructor( |
27 ScriptState*, | 27 ScriptState*, |
28 CustomElementRegistry*, | 28 CustomElementRegistry*, |
29 const v8::Local<v8::Value>& constructor); | 29 const v8::Local<v8::Value>& constructor); |
30 | 30 |
31 static ScriptCustomElementDefinition* create( | 31 static ScriptCustomElementDefinition* create( |
32 ScriptState*, | 32 ScriptState*, |
33 CustomElementRegistry*, | 33 CustomElementRegistry*, |
34 const CustomElementDescriptor&, | 34 const CustomElementDescriptor&, |
35 const v8::Local<v8::Object>& constructor, | 35 const v8::Local<v8::Object>& constructor, |
36 const v8::Local<v8::Object>& prototype, | |
37 const v8::Local<v8::Function>& connectedCallback, | 36 const v8::Local<v8::Function>& connectedCallback, |
38 const v8::Local<v8::Function>& disconnectedCallback, | 37 const v8::Local<v8::Function>& disconnectedCallback, |
39 const v8::Local<v8::Function>& adoptedCallback, | 38 const v8::Local<v8::Function>& adoptedCallback, |
40 const v8::Local<v8::Function>& attributeChangedCallback, | 39 const v8::Local<v8::Function>& attributeChangedCallback, |
41 const HashSet<AtomicString>& observedAttributes); | 40 const HashSet<AtomicString>& observedAttributes); |
42 | 41 |
43 virtual ~ScriptCustomElementDefinition() = default; | 42 virtual ~ScriptCustomElementDefinition() = default; |
44 | 43 |
45 v8::Local<v8::Object> constructor() const; | 44 v8::Local<v8::Object> constructor() const; |
46 v8::Local<v8::Object> prototype() const; | |
47 | 45 |
48 HTMLElement* createElementSync(Document&, const QualifiedName&) override; | 46 HTMLElement* createElementSync(Document&, const QualifiedName&) override; |
49 | 47 |
50 bool hasConnectedCallback() const override; | 48 bool hasConnectedCallback() const override; |
51 bool hasDisconnectedCallback() const override; | 49 bool hasDisconnectedCallback() const override; |
52 bool hasAdoptedCallback() const override; | 50 bool hasAdoptedCallback() const override; |
53 | 51 |
54 void runConnectedCallback(Element*) override; | 52 void runConnectedCallback(Element*) override; |
55 void runDisconnectedCallback(Element*) override; | 53 void runDisconnectedCallback(Element*) override; |
56 void runAdoptedCallback(Element*, | 54 void runAdoptedCallback(Element*, |
57 Document* oldOwner, | 55 Document* oldOwner, |
58 Document* newOwner) override; | 56 Document* newOwner) override; |
59 void runAttributeChangedCallback(Element*, | 57 void runAttributeChangedCallback(Element*, |
60 const QualifiedName&, | 58 const QualifiedName&, |
61 const AtomicString& oldValue, | 59 const AtomicString& oldValue, |
62 const AtomicString& newValue) override; | 60 const AtomicString& newValue) override; |
63 | 61 |
64 private: | 62 private: |
65 ScriptCustomElementDefinition( | 63 ScriptCustomElementDefinition( |
66 ScriptState*, | 64 ScriptState*, |
67 const CustomElementDescriptor&, | 65 const CustomElementDescriptor&, |
68 const v8::Local<v8::Object>& constructor, | 66 const v8::Local<v8::Object>& constructor, |
69 const v8::Local<v8::Object>& prototype, | |
70 const v8::Local<v8::Function>& connectedCallback, | 67 const v8::Local<v8::Function>& connectedCallback, |
71 const v8::Local<v8::Function>& disconnectedCallback, | 68 const v8::Local<v8::Function>& disconnectedCallback, |
72 const v8::Local<v8::Function>& adoptedCallback, | 69 const v8::Local<v8::Function>& adoptedCallback, |
73 const v8::Local<v8::Function>& attributeChangedCallback, | 70 const v8::Local<v8::Function>& attributeChangedCallback, |
74 const HashSet<AtomicString>& observedAttributes); | 71 const HashSet<AtomicString>& observedAttributes); |
75 | 72 |
76 // Implementations of |CustomElementDefinition| | 73 // Implementations of |CustomElementDefinition| |
77 ScriptValue getConstructorForScript() final; | 74 ScriptValue getConstructorForScript() final; |
78 bool runConstructor(Element*) override; | 75 bool runConstructor(Element*) override; |
79 Element* runConstructor(); | 76 Element* runConstructor(); |
80 | 77 |
81 void runCallback(v8::Local<v8::Function>, | 78 void runCallback(v8::Local<v8::Function>, |
82 Element*, | 79 Element*, |
83 int argc = 0, | 80 int argc = 0, |
84 v8::Local<v8::Value> argv[] = nullptr); | 81 v8::Local<v8::Value> argv[] = nullptr); |
85 | 82 |
86 HTMLElement* handleCreateElementSyncException(Document&, | 83 HTMLElement* handleCreateElementSyncException(Document&, |
87 const QualifiedName& tagName, | 84 const QualifiedName& tagName, |
88 v8::Isolate*, | 85 v8::Isolate*, |
89 ExceptionState&); | 86 ExceptionState&); |
90 | 87 |
91 RefPtr<ScriptState> m_scriptState; | 88 RefPtr<ScriptState> m_scriptState; |
92 ScopedPersistent<v8::Object> m_constructor; | 89 ScopedPersistent<v8::Object> m_constructor; |
93 ScopedPersistent<v8::Object> m_prototype; | |
94 ScopedPersistent<v8::Function> m_connectedCallback; | 90 ScopedPersistent<v8::Function> m_connectedCallback; |
95 ScopedPersistent<v8::Function> m_disconnectedCallback; | 91 ScopedPersistent<v8::Function> m_disconnectedCallback; |
96 ScopedPersistent<v8::Function> m_adoptedCallback; | 92 ScopedPersistent<v8::Function> m_adoptedCallback; |
97 ScopedPersistent<v8::Function> m_attributeChangedCallback; | 93 ScopedPersistent<v8::Function> m_attributeChangedCallback; |
98 }; | 94 }; |
99 | 95 |
100 } // namespace blink | 96 } // namespace blink |
101 | 97 |
102 #endif // ScriptCustomElementDefinition_h | 98 #endif // ScriptCustomElementDefinition_h |
OLD | NEW |