X-Git-Url: https://git.webkit.org/?p=WebKit.git;a=blobdiff_plain;f=Source%2FWebCore%2Fdom%2FCustomElementDefinitions.cpp;h=9a6701606b61cb230eb029959b8543755be971e5;hp=9dae68ff0b08601fc045661732d7e82d4911746e;hb=07992f725e344f503948fb3a8d2ed535eef1f156;hpb=2f51aa69103ab5e3183d292533e4a39759405415 diff --git a/Source/WebCore/dom/CustomElementDefinitions.cpp b/Source/WebCore/dom/CustomElementDefinitions.cpp index 9dae68f..9a67016 100644 --- a/Source/WebCore/dom/CustomElementDefinitions.cpp +++ b/Source/WebCore/dom/CustomElementDefinitions.cpp @@ -69,35 +69,35 @@ CustomElementDefinitions::NameStatus CustomElementDefinitions::checkName(const A return NameStatus::Valid; } -bool CustomElementDefinitions::defineElement(const QualifiedName& fullName, Ref&& interface) +void CustomElementDefinitions::addElementDefinition(Ref&& interface) { - ASSERT(!m_nameMap.contains(fullName.localName())); - auto* constructor = interface->constructor(); - m_nameMap.add(fullName.localName(), CustomElementInfo(fullName, WTFMove(interface))); - - auto addResult = m_constructorMap.add(constructor, fullName); - if (!addResult.isNewEntry) - addResult.iterator->value = nullQName(); // The interface has multiple tag names associated with it. - - return true; + AtomicString localName = interface->name().localName(); + ASSERT(!m_nameMap.contains(localName)); + m_constructorMap.add(interface->constructor(), interface.ptr()); + m_nameMap.add(localName, WTFMove(interface)); } JSCustomElementInterface* CustomElementDefinitions::findInterface(const QualifiedName& name) const { auto it = m_nameMap.find(name.localName()); - return it == m_nameMap.end() || it->value.fullName != name ? nullptr : it->value.interface.get(); + return it == m_nameMap.end() || it->value->name() != name ? nullptr : it->value.get(); } JSCustomElementInterface* CustomElementDefinitions::findInterface(const AtomicString& name) const { auto it = m_nameMap.find(name); - return it == m_nameMap.end() ? nullptr : it->value.interface.get(); + return it == m_nameMap.end() ? nullptr : it->value.get(); } -const QualifiedName& CustomElementDefinitions::findName(const JSC::JSObject* constructor) const +JSCustomElementInterface* CustomElementDefinitions::findInterface(const JSC::JSObject* constructor) const { auto it = m_constructorMap.find(constructor); - return it == m_constructorMap.end() ? nullQName() : it->value; + return it->value; +} + +bool CustomElementDefinitions::containsConstructor(const JSC::JSObject* constructor) const +{ + return m_constructorMap.contains(constructor); } }