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

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

Issue 18332025: Split CustomElementRegistry into a registration context and a registry. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced to tip. Created 7 years, 5 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.cpp ('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/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index a19778c9984051830cc790acd006da91a0a76bbc..aca7e8ddc93ac78adbaeed15f0d0356a2b9668a6 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -42,8 +42,7 @@
#include "core/dom/Attribute.h"
#include "core/dom/ClientRect.h"
#include "core/dom/ClientRectList.h"
-#include "core/dom/CustomElementCallbackDispatcher.h"
-#include "core/dom/CustomElementRegistry.h"
+#include "core/dom/CustomElementRegistrationContext.h"
#include "core/dom/DatasetDOMStringMap.h"
#include "core/dom/Document.h"
#include "core/dom/DocumentSharedObjectPool.h"
@@ -210,9 +209,8 @@ Element::~Element()
data->clearShadow();
}
- if (isCustomElement() && document() && document()->registry()) {
- document()->registry()->customElementWasDestroyed(this);
- }
+ if (isCustomElement() && document() && document()->registrationContext())
+ document()->registrationContext()->customElementIsBeingDestroyed(this);
if (hasSyntheticAttrChildNodes())
detachAllAttrNodesFromElement();
@@ -948,9 +946,8 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName& name, const AtomicString& newValue, AttributeModificationReason reason)
{
- if (RuntimeEnabledFeatures::customDOMElementsEnabled() && name == isAttr) {
- document()->ensureCustomElementRegistry()->didGiveTypeExtension(this, newValue);
- }
+ if (name == isAttr)
+ document()->registrationContext()->didGiveTypeExtension(this, newValue);
attributeChanged(name, newValue, reason);
}
@@ -1268,10 +1265,8 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode* insertio
if (scope != treeScope())
return InsertionDone;
- if (isUpgradedCustomElement()) {
- RefPtr<CustomElementDefinition> definition = document()->registry()->findFor(this);
- CustomElementCallbackDispatcher::instance().enqueueEnteredDocumentCallback(definition->callbacks(), this);
- }
+ if (isUpgradedCustomElement())
+ document()->registrationContext()->customElementDidEnterDocument(this);
const AtomicString& idValue = getIdAttribute();
if (!idValue.isNull())
@@ -1332,12 +1327,8 @@ void Element::removedFrom(ContainerNode* insertionPoint)
if (hasPendingResources())
document()->accessSVGExtensions()->removeElementFromPendingResources(this);
- if (isUpgradedCustomElement()) {
- if (CustomElementRegistry* registry = document()->registry()) {
- RefPtr<CustomElementDefinition> definition = registry->findFor(this);
- CustomElementCallbackDispatcher::instance().enqueueLeftDocumentCallback(definition->callbacks(), this);
- }
- }
+ if (isUpgradedCustomElement() && document()->registrationContext())
+ document()->registrationContext()->customElementDidLeaveDocument(this);
}
}
@@ -2826,10 +2817,8 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
if (attached() && document()->styleResolver() && document()->styleResolver()->hasSelectorForAttribute(name.localName()))
setNeedsStyleRecalc();
- if (isUpgradedCustomElement()) {
- RefPtr<CustomElementDefinition> definition = document()->registry()->findFor(this);
- CustomElementCallbackDispatcher::instance().enqueueAttributeChangedCallback(definition->callbacks(), this, name.localName(), oldValue, newValue);
- }
+ if (isUpgradedCustomElement())
+ document()->registrationContext()->customElementAttributeDidChange(this, name.localName(), oldValue, newValue);
}
if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(this, name))
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/scripts/make_names.pl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698