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

Unified Diff: sky/engine/core/dom/Element.cpp

Issue 943013002: Implement Custom Elements (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: attributeChanged***d***Callback Created 5 years, 10 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: sky/engine/core/dom/Element.cpp
diff --git a/sky/engine/core/dom/Element.cpp b/sky/engine/core/dom/Element.cpp
index be09a955fea0b63bf5ca1320e8b364b3f5274a00..a321c149edd8a47e7a9120bb242bd409677c2f11 100644
--- a/sky/engine/core/dom/Element.cpp
+++ b/sky/engine/core/dom/Element.cpp
@@ -56,8 +56,7 @@
#include "sky/engine/core/dom/SelectorQuery.h"
#include "sky/engine/core/dom/StyleEngine.h"
#include "sky/engine/core/dom/Text.h"
-#include "sky/engine/core/dom/custom/CustomElement.h"
-#include "sky/engine/core/dom/custom/CustomElementRegistrationContext.h"
+#include "sky/engine/core/dom/custom2/new_custom_element.h"
#include "sky/engine/core/dom/shadow/InsertionPoint.h"
#include "sky/engine/core/dom/shadow/ShadowRoot.h"
#include "sky/engine/core/editing/FrameSelection.h"
@@ -79,6 +78,7 @@
#include "sky/engine/core/rendering/RenderLayer.h"
#include "sky/engine/core/rendering/RenderView.h"
#include "sky/engine/platform/EventDispatchForbiddenScope.h"
+#include "sky/engine/tonic/dart_state.h"
#include "sky/engine/wtf/BitVector.h"
#include "sky/engine/wtf/HashFunctions.h"
#include "sky/engine/wtf/text/CString.h"
@@ -87,6 +87,15 @@
namespace blink {
+PassRefPtr<Element> Element::create(Document& document, const AtomicString& tagName)
+{
+ DCHECK(DartState::Current()) << "This function should be used only by the bindings";
+ RefPtr<Element> element = create(QualifiedName(tagName), &document);
+ element->setCustomElementState(Element::WaitingForUpgrade);
+ element->setCustomElementState(Element::Upgraded);
ojan 2015/02/20 23:09:34 Presumablye we should add a TODO to get rid of the
abarth-chromium 2015/02/21 00:00:45 Done.
+ return element.release();
+}
+
PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new Element(tagName, document, CreateElement));
@@ -105,9 +114,6 @@ Element::~Element()
#if !ENABLE(OILPAN)
if (hasRareData())
elementRareData()->clearShadow();
-
- if (isCustomElement())
- CustomElement::wasDestroyed(this);
#endif
}
@@ -639,7 +645,7 @@ void Element::insertedInto(ContainerNode* insertionPoint)
return;
if (isUpgradedCustomElement() && inDocument())
- CustomElement::didAttach(this, document());
+ NewCustomElement::DidAttach(this, document());
TreeScope& scope = insertionPoint->treeScope();
if (scope != treeScope())
@@ -663,7 +669,7 @@ void Element::removedFrom(ContainerNode* insertionPoint)
ContainerNode::removedFrom(insertionPoint);
if (wasInDocument) {
if (isUpgradedCustomElement())
- CustomElement::didDetach(this, insertionPoint->document());
+ NewCustomElement::DidDetach(this, insertionPoint->document());
}
}
@@ -1301,7 +1307,7 @@ void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
setNeedsStyleRecalc(LocalStyleChange);
if (isUpgradedCustomElement())
- CustomElement::attributeDidChange(this, name.localName(), oldValue, newValue);
+ NewCustomElement::AttributeDidChange(this, name.localName(), oldValue, newValue);
if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(*this, name))
recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));

Powered by Google App Engine
This is Rietveld 408576698