| 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 CustomElementDefinition_h | 5 #ifndef CustomElementDefinition_h |
| 6 #define CustomElementDefinition_h | 6 #define CustomElementDefinition_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
| 9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
| 10 #include "core/dom/custom/CustomElementDescriptor.h" | 10 #include "core/dom/custom/CustomElementDescriptor.h" |
| 11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
| 12 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 | 15 |
| 16 class ScriptState; | |
| 17 class Element; | 16 class Element; |
| 17 class HTMLElement; |
| 18 class QualifiedName; |
| 18 | 19 |
| 19 class CORE_EXPORT CustomElementDefinition | 20 class CORE_EXPORT CustomElementDefinition |
| 20 : public GarbageCollectedFinalized<CustomElementDefinition> { | 21 : public GarbageCollectedFinalized<CustomElementDefinition> { |
| 21 WTF_MAKE_NONCOPYABLE(CustomElementDefinition); | 22 WTF_MAKE_NONCOPYABLE(CustomElementDefinition); |
| 22 public: | 23 public: |
| 23 CustomElementDefinition(const CustomElementDescriptor&); | 24 CustomElementDefinition(const CustomElementDescriptor&); |
| 24 virtual ~CustomElementDefinition(); | 25 virtual ~CustomElementDefinition(); |
| 25 | 26 |
| 26 DECLARE_VIRTUAL_TRACE(); | 27 DECLARE_VIRTUAL_TRACE(); |
| 27 | 28 |
| 28 const CustomElementDescriptor& descriptor() { return m_descriptor; } | 29 const CustomElementDescriptor& descriptor() { return m_descriptor; } |
| 29 | 30 |
| 30 // TODO(yosin): To support Web Modules, introduce an abstract | 31 // TODO(yosin): To support Web Modules, introduce an abstract |
| 31 // class |CustomElementConstructor| to allow us to have JavaScript | 32 // class |CustomElementConstructor| to allow us to have JavaScript |
| 32 // and C++ constructors and ask the binding layer to convert | 33 // and C++ constructors and ask the binding layer to convert |
| 33 // |CustomElementConstructor| to |ScriptValue|. Replace | 34 // |CustomElementConstructor| to |ScriptValue|. Replace |
| 34 // |getConstructorForScript()| by |getConstructor() -> | 35 // |getConstructorForScript()| by |getConstructor() -> |
| 35 // CustomElementConstructor|. | 36 // CustomElementConstructor|. |
| 36 virtual ScriptValue getConstructorForScript() = 0; | 37 virtual ScriptValue getConstructorForScript() = 0; |
| 37 | 38 |
| 38 using ConstructionStack = HeapVector<Member<Element>, 1>; | 39 using ConstructionStack = HeapVector<Member<Element>, 1>; |
| 39 ConstructionStack& constructionStack() | 40 ConstructionStack& constructionStack() |
| 40 { | 41 { |
| 41 return m_constructionStack; | 42 return m_constructionStack; |
| 42 } | 43 } |
| 43 | 44 |
| 45 virtual HTMLElement* createCustomElement(Document&, const QualifiedName&) =
0; |
| 46 virtual HTMLElement* createCustomElementIgnoringErrors(Document&, const Qual
ifiedName&) = 0; |
| 47 |
| 44 void upgrade(Element*); | 48 void upgrade(Element*); |
| 45 | 49 |
| 46 protected: | 50 protected: |
| 47 virtual bool runConstructor(Element*) = 0; | 51 virtual bool runConstructor(Element*) = 0; |
| 48 | 52 |
| 49 private: | 53 private: |
| 50 const CustomElementDescriptor m_descriptor; | 54 const CustomElementDescriptor m_descriptor; |
| 51 ConstructionStack m_constructionStack; | 55 ConstructionStack m_constructionStack; |
| 52 }; | 56 }; |
| 53 | 57 |
| 54 } // namespace blink | 58 } // namespace blink |
| 55 | 59 |
| 56 #endif // CustomElementDefinition_h | 60 #endif // CustomElementDefinition_h |
| OLD | NEW |