Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElementsRegistry.h

Issue 2023093003: Upgrade in-document custom elements when an element is defined. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ASAN failure in test helper. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 a3caf352b3e9be83562353246eca2a7683d2b6fb..da65a760ae6833e6924a8387d10a7884487647aa 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*,
@@ -45,25 +48,38 @@ public:
ExceptionState&);
ScriptValue get(const AtomicString& name);
-
- 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>>*);
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

Powered by Google App Engine
This is Rietveld 408576698