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

Unified Diff: third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp

Issue 1952893003: Implement custom element construction and some 'define' checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove defunct stuff. 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/V0CustomElementRegistry.cpp
diff --git a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp b/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp
index 2ecc455436fc31c9a4b2539d45094f9b81ccd7f3..f8c8b04bfccb8d0381522f2d03a34ffc29247914 100644
--- a/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/V0CustomElementRegistry.cpp
@@ -31,10 +31,14 @@
#include "core/dom/custom/V0CustomElementRegistry.h"
#include "bindings/core/v8/V0CustomElementConstructorBuilder.h"
+#include "bindings/core/v8/V8Binding.h"
#include "core/HTMLNames.h"
#include "core/SVGNames.h"
+#include "core/dom/Document.h"
+#include "core/dom/custom/CustomElementsRegistry.h"
#include "core/dom/custom/V0CustomElementException.h"
#include "core/dom/custom/V0CustomElementRegistrationContext.h"
+#include "core/frame/LocalDOMWindow.h"
namespace blink {
@@ -52,7 +56,7 @@ V0CustomElementDefinition* V0CustomElementRegistry::registerElement(Document* do
return 0;
}
- if (m_registeredTypeNames.contains(type)) {
+ if (m_registeredTypeNames.contains(type) || v1NameIsDefined(type)) {
V0CustomElementException::throwException(V0CustomElementException::TypeAlreadyRegistered, type, exceptionState);
return 0;
}
@@ -96,9 +100,26 @@ V0CustomElementDefinition* V0CustomElementRegistry::find(const V0CustomElementDe
return m_definitions.get(descriptor);
}
+bool V0CustomElementRegistry::nameIsDefined(const AtomicString& name) const
+{
+ return m_registeredTypeNames.contains(name);
+}
+
+void V0CustomElementRegistry::setV1(const CustomElementsRegistry* v1)
+{
+ DCHECK(!m_v1.get());
+ m_v1 = v1;
+}
+
+bool V0CustomElementRegistry::v1NameIsDefined(const AtomicString& name) const
+{
+ return m_v1.get() && m_v1->nameIsDefined(name);
+}
+
DEFINE_TRACE(V0CustomElementRegistry)
{
visitor->trace(m_definitions);
+ visitor->trace(m_v1);
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698