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

Unified Diff: Source/core/dom/Document.cpp

Issue 14776002: Create wrappers for unresolved Custom Elements at the correct type (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use toV8 in the constructor. Remove unused variable. Created 7 years, 8 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
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/scripts/make_names.pl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index d5280d4b485c73b8164fa50ebcd95f1712cb3c5e..66f0cf4d37d7d4640ffcd7f51710b07c0cedc3af 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -775,16 +775,14 @@ PassRefPtr<Element> Document::createElement(const AtomicString& localName, const
RefPtr<Element> element;
- if (m_registry)
- element = m_registry->tryToCreateCustomTagElement(QualifiedName(nullAtom, localName, xhtmlNamespaceURI));
-
- if (!element)
+ if (CustomElementRegistry::isCustomTagName(localName))
+ element = ensureCustomElementRegistry()->createCustomTagElement(QualifiedName(nullAtom, localName, xhtmlNamespaceURI));
+ else
element = createElement(localName, ec);
if (!typeExtension.isNull()) {
setTypeExtension(element.get(), typeExtension);
- if (m_registry)
- m_registry->didGiveTypeExtension(element.get());
+ ensureCustomElementRegistry()->didGiveTypeExtension(element.get());
}
return element;
@@ -803,17 +801,14 @@ PassRefPtr<Element> Document::createElementNS(const AtomicString& namespaceURI,
}
RefPtr<Element> element;
-
- if (m_registry)
- element = m_registry->tryToCreateCustomTagElement(qName);
-
- if (!element)
+ if (CustomElementRegistry::isCustomTagName(qName.localName()))
+ element = ensureCustomElementRegistry()->createCustomTagElement(qName);
+ else
element = createElementNS(namespaceURI, qualifiedName, ec);
if (!typeExtension.isNull()) {
setTypeExtension(element.get(), typeExtension);
- if (m_registry)
- m_registry->didGiveTypeExtension(element.get());
+ ensureCustomElementRegistry()->didGiveTypeExtension(element.get());
}
return element;
@@ -831,9 +826,16 @@ PassRefPtr<CustomElementConstructor> Document::registerElement(WebCore::ScriptSt
return 0;
}
- if (!m_registry)
+ return ensureCustomElementRegistry()->registerElement(state, name, options, ec);
+}
+
+CustomElementRegistry* Document::ensureCustomElementRegistry()
+{
+ if (!m_registry) {
+ ASSERT(isHTMLDocument() || isXHTMLDocument());
m_registry = adoptRef(new CustomElementRegistry(this));
- return m_registry->registerElement(state, name, options, ec);
+ }
+ return m_registry.get();
}
PassRefPtr<DocumentFragment> Document::createDocumentFragment()
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/scripts/make_names.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698