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

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

Issue 23009004: Process Custom Elements in post-order. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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: Source/core/dom/CustomElementRegistrationContext.cpp
diff --git a/Source/core/dom/CustomElementRegistrationContext.cpp b/Source/core/dom/CustomElementRegistrationContext.cpp
index 4589e7e1c1c88d6f91b046b6df06e9bc0bbf1980..25293f4fda4341512ff719cae8d3abafd331db16 100644
--- a/Source/core/dom/CustomElementRegistrationContext.cpp
+++ b/Source/core/dom/CustomElementRegistrationContext.cpp
@@ -57,7 +57,7 @@ void CustomElementRegistrationContext::registerElement(Document* document, Custo
didResolveElement(definition, *it);
}
-PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Document* document, const QualifiedName& tagName)
+PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Document* document, const QualifiedName& tagName, CreationMode mode)
{
ASSERT(CustomElement::isCustomTagName(tagName.localName()));
@@ -75,6 +75,8 @@ PassRefPtr<Element> CustomElementRegistrationContext::createCustomTagElement(Doc
return Element::create(tagName, document);
}
+ if (mode == CreatedByParser)
+ CustomElement::setBeingParsed(element.get());
resolve(element.get(), nullAtom);
return element.release();
}
@@ -111,11 +113,6 @@ void CustomElementRegistrationContext::didCreateUnresolvedElement(const CustomEl
m_candidates.add(descriptor, element);
}
-void CustomElementRegistrationContext::customElementWasDestroyed(Element* element)
-{
- m_candidates.remove(element);
-}
-
PassRefPtr<CustomElementRegistrationContext> CustomElementRegistrationContext::create()
{
return adoptRef(new CustomElementRegistrationContext());
@@ -126,10 +123,10 @@ void CustomElementRegistrationContext::setIsAttributeAndTypeExtension(Element* e
ASSERT(element);
ASSERT(!type.isEmpty());
element->setAttribute(HTMLNames::isAttr, type);
- setTypeExtension(element, type);
+ setTypeExtension(element, type, CreatedByDOM);
}
-void CustomElementRegistrationContext::setTypeExtension(Element* element, const AtomicString& type)
+void CustomElementRegistrationContext::setTypeExtension(Element* element, const AtomicString& type, CreationMode mode)
{
if (!element->isHTMLElement() && !element->isSVGElement())
return;
@@ -146,8 +143,12 @@ void CustomElementRegistrationContext::setTypeExtension(Element* element, const
// Custom tags take precedence over type extensions
ASSERT(!CustomElement::isCustomTagName(element->localName()));
- if (CustomElementRegistrationContext* context = element->document()->registrationContext())
+ if (CustomElementRegistrationContext* context = element->document()->registrationContext()) {
+ if (CreatedByParser == mode)
dglazkov 2013/08/13 16:22:06 why'd you flip the condition like that? :)
+ CustomElement::setBeingParsed(element);
+
context->didGiveTypeExtension(element, type);
+ }
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698