Index: Source/core/dom/custom/CustomElementRegistrationContext.cpp |
diff --git a/Source/core/dom/custom/CustomElementRegistrationContext.cpp b/Source/core/dom/custom/CustomElementRegistrationContext.cpp |
index 678895007f962e9457652206e89b5fc6516491e9..f6ce6c52a1dabfde095eed9afc6239373e261863 100644 |
--- a/Source/core/dom/custom/CustomElementRegistrationContext.cpp |
+++ b/Source/core/dom/custom/CustomElementRegistrationContext.cpp |
@@ -45,6 +45,11 @@ |
namespace WebCore { |
+CustomElementRegistrationContext::CustomElementRegistrationContext() |
+ : m_candidates(CustomElementUpgradeCandidateMap::create()) |
+{ |
+} |
+ |
void CustomElementRegistrationContext::registerElement(Document* document, CustomElementConstructorBuilder* constructorBuilder, const AtomicString& type, CustomElement::NameSet validNames, ExceptionState& exceptionState) |
{ |
CustomElementDefinition* definition = m_registry.registerElement(document, constructorBuilder, type, validNames, exceptionState); |
@@ -53,8 +58,11 @@ void CustomElementRegistrationContext::registerElement(Document* document, Custo |
return; |
// Upgrade elements that were waiting for this definition. |
- const CustomElementUpgradeCandidateMap::ElementSet& upgradeCandidates = m_candidates.takeUpgradeCandidatesFor(definition->descriptor()); |
- for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgradeCandidates.begin(); it != upgradeCandidates.end(); ++it) |
+ const CustomElementUpgradeCandidateMap::ElementSet* upgradeCandidates = m_candidates->takeUpgradeCandidatesFor(definition->descriptor()); |
+ if (!upgradeCandidates) |
+ return; |
+ |
+ for (CustomElementUpgradeCandidateMap::ElementSet::const_iterator it = upgradeCandidates->begin(); it != upgradeCandidates->end(); ++it) |
CustomElement::define(*it, definition); |
} |
@@ -105,15 +113,10 @@ void CustomElementRegistrationContext::resolve(Element* element, const CustomEle |
CustomElement::define(element, definition); |
} else { |
ASSERT(element->customElementState() == Element::WaitingForUpgrade); |
- m_candidates.add(descriptor, element); |
+ m_candidates->add(descriptor, element); |
} |
} |
-PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::create() |
-{ |
- return adoptRef(new CustomElementRegistrationContext()); |
-} |
- |
void CustomElementRegistrationContext::setIsAttributeAndTypeExtension(Element* element, const AtomicString& type) |
{ |
ASSERT(element); |
@@ -150,4 +153,9 @@ void CustomElementRegistrationContext::setTypeExtension(Element* element, const |
context->didGiveTypeExtension(element, type); |
} |
+void CustomElementRegistrationContext::trace(Visitor* visitor) |
+{ |
+ visitor->trace(m_candidates); |
+} |
+ |
} // namespace WebCore |