| Index: third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
|
| diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
|
| index 292f86bed06af745541b05496ea41a545bdde531..79becbcb538dd4cd74e246c542015ec8eafaf15b 100644
|
| --- a/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
|
| +++ b/third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef CustomElementsRegistry_h
|
| #define CustomElementsRegistry_h
|
|
|
| +#include "base/gtest_prod_util.h"
|
| #include "bindings/core/v8/ScriptWrappable.h"
|
| #include "core/CoreExport.h"
|
| #include "platform/heap/Handle.h"
|
| @@ -16,6 +17,9 @@ namespace blink {
|
|
|
| class CustomElementDefinition;
|
| class CustomElementDefinitionBuilder;
|
| +class CustomElementDescriptor;
|
| +class Document;
|
| +class Element;
|
| class ElementRegistrationOptions;
|
| class ExceptionState;
|
| class ScriptState;
|
| @@ -28,8 +32,7 @@ class CORE_EXPORT CustomElementsRegistry final
|
| DEFINE_WRAPPERTYPEINFO();
|
| WTF_MAKE_NONCOPYABLE(CustomElementsRegistry);
|
| public:
|
| - static CustomElementsRegistry* create(
|
| - V0CustomElementRegistrationContext*);
|
| + static CustomElementsRegistry* create(Document*);
|
|
|
| void define(
|
| ScriptState*,
|
| @@ -44,24 +47,49 @@ public:
|
| const ElementRegistrationOptions&,
|
| ExceptionState&);
|
|
|
| - bool nameIsDefined(const AtomicString& name) const
|
| - {
|
| - return m_definitions.contains(name);
|
| - }
|
| + bool nameIsDefined(const AtomicString& name) const;
|
|
|
| CustomElementDefinition* definitionForName(const AtomicString& name) const;
|
|
|
| + // TODO(dominicc): Consider broadening this API when type extensions are
|
| + // implemented.
|
| + void addCandidate(Element*);
|
| +
|
| DECLARE_TRACE();
|
|
|
| private:
|
| - CustomElementsRegistry(const V0CustomElementRegistrationContext*);
|
| - bool v0NameIsDefined(const AtomicString&) const;
|
| + friend class CustomElementsRegistryTestBase;
|
| +
|
| + CustomElementsRegistry(Document*);
|
| +
|
| + V0CustomElementRegistrationContext* v0();
|
| + bool v0NameIsDefined(const AtomicString& name);
|
| +
|
| + void collectCandidates(
|
| + const CustomElementDescriptor&,
|
| + HeapVector<Member<Element>>*);
|
| +
|
| + // TODO(dominicc): This should use virtuals on
|
| + // CustomElementDefinition to do upgrade.
|
| +
|
| + // TODO(dominicc): This should retrieve the constructor from the
|
| + // definition instead of being passed the constructor, when there is
|
| + // a mapping from definition to constructor.
|
| + void upgrade(
|
| + CustomElementDefinition*,
|
| + Element*);
|
|
|
| using DefinitionMap =
|
| HeapHashMap<AtomicString, Member<CustomElementDefinition>>;
|
| DefinitionMap m_definitions;
|
|
|
| - Member<const V0CustomElementRegistrationContext> m_v0;
|
| + Member<Document> m_document;
|
| +
|
| + using UpgradeCandidateSet = HeapHashSet<WeakMember<Element>>;
|
| + using UpgradeCandidateMap = HeapHashMap<
|
| + AtomicString,
|
| + Member<UpgradeCandidateSet>>;
|
| + Member<UpgradeCandidateMap> m_upgradeCandidates;
|
| };
|
|
|
| } // namespace blink
|
|
|