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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2058823002: Implement callback reactions for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stack-ce
Patch Set: dominicc review Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. All rights reserved.
8 * (C) 2007 Eric Seidel (eric@webkit.org) 8 * (C) 2007 Eric Seidel (eric@webkit.org)
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 return InsertionDone; 1417 return InsertionDone;
1418 1418
1419 if (hasRareData()) { 1419 if (hasRareData()) {
1420 ElementRareData* rareData = elementRareData(); 1420 ElementRareData* rareData = elementRareData();
1421 rareData->clearClassListValueForQuirksMode(); 1421 rareData->clearClassListValueForQuirksMode();
1422 if (rareData->intersectionObserverData()) 1422 if (rareData->intersectionObserverData())
1423 rareData->intersectionObserverData()->activateValidIntersectionObser vers(*this); 1423 rareData->intersectionObserverData()->activateValidIntersectionObser vers(*this);
1424 } 1424 }
1425 1425
1426 if (inShadowIncludingDocument()) { 1426 if (inShadowIncludingDocument()) {
1427 if (getCustomElementState() != CustomElementState::Custom && CustomEleme nt::descriptorMayMatch(*this)) { 1427 if (getCustomElementState() == CustomElementState::Custom) {
1428 CustomElement::enqueueConnectedCallback(this);
1429 } else if (isUpgradedV0CustomElement()) {
1430 V0CustomElement::didAttach(this, document());
1431 } else if (getCustomElementState() == CustomElementState::Undefined) {
1428 if (CustomElementsRegistry* registry = CustomElement::registry(*this )) 1432 if (CustomElementsRegistry* registry = CustomElement::registry(*this ))
1429 registry->addCandidate(this); 1433 registry->addCandidate(this);
1430 } 1434 }
1431 if (isUpgradedV0CustomElement())
1432 V0CustomElement::didAttach(this, document());
1433 } 1435 }
1434 1436
1435 TreeScope& scope = insertionPoint->treeScope(); 1437 TreeScope& scope = insertionPoint->treeScope();
1436 if (scope != treeScope()) 1438 if (scope != treeScope())
1437 return InsertionDone; 1439 return InsertionDone;
1438 1440
1439 const AtomicString& idValue = getIdAttribute(); 1441 const AtomicString& idValue = getIdAttribute();
1440 if (!idValue.isNull()) 1442 if (!idValue.isNull())
1441 updateId(scope, nullAtom, idValue); 1443 updateId(scope, nullAtom, idValue);
1442 1444
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 } 1485 }
1484 1486
1485 ContainerNode::removedFrom(insertionPoint); 1487 ContainerNode::removedFrom(insertionPoint);
1486 if (wasInDocument) { 1488 if (wasInDocument) {
1487 if (this == document().cssTarget()) 1489 if (this == document().cssTarget())
1488 document().setCSSTarget(nullptr); 1490 document().setCSSTarget(nullptr);
1489 1491
1490 if (hasPendingResources()) 1492 if (hasPendingResources())
1491 document().accessSVGExtensions().removeElementFromPendingResources(t his); 1493 document().accessSVGExtensions().removeElementFromPendingResources(t his);
1492 1494
1493 if (isUpgradedV0CustomElement()) 1495 if (getCustomElementState() == CustomElementState::Custom)
1496 CustomElement::enqueueDisconnectedCallback(this);
1497 else if (isUpgradedV0CustomElement())
1494 V0CustomElement::didDetach(this, insertionPoint->document()); 1498 V0CustomElement::didDetach(this, insertionPoint->document());
1495 1499
1496 if (needsStyleInvalidation()) 1500 if (needsStyleInvalidation())
1497 document().styleEngine().styleInvalidator().clearInvalidation(*this) ; 1501 document().styleEngine().styleInvalidator().clearInvalidation(*this) ;
1498 } 1502 }
1499 1503
1500 document().removeFromTopLayer(this); 1504 document().removeFromTopLayer(this);
1501 1505
1502 clearElementFlag(IsInCanvasSubtree); 1506 clearElementFlag(IsInCanvasSubtree);
1503 1507
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 } 3186 }
3183 3187
3184 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue) 3188 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
3185 { 3189 {
3186 if (name == HTMLNames::nameAttr) { 3190 if (name == HTMLNames::nameAttr) {
3187 updateName(oldValue, newValue); 3191 updateName(oldValue, newValue);
3188 } 3192 }
3189 3193
3190 if (oldValue != newValue) { 3194 if (oldValue != newValue) {
3191 document().styleEngine().attributeChangedForElement(name, *this); 3195 document().styleEngine().attributeChangedForElement(name, *this);
3192 if (isUpgradedV0CustomElement()) 3196 if (getCustomElementState() == CustomElementState::Custom)
3197 CustomElement::enqueueAttributeChangedCallback(this, name, oldValue, newValue);
3198 else if (isUpgradedV0CustomElement())
3193 V0CustomElement::attributeDidChange(this, name.localName(), oldValue , newValue); 3199 V0CustomElement::attributeDidChange(this, name.localName(), oldValue , newValue);
3194 } 3200 }
3195 3201
3196 if (MutationObserverInterestGroup* recipients = MutationObserverInterestGrou p::createForAttributesMutation(*this, name)) 3202 if (MutationObserverInterestGroup* recipients = MutationObserverInterestGrou p::createForAttributesMutation(*this, name))
3197 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue)); 3203 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
3198 3204
3199 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue); 3205 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue);
3200 } 3206 }
3201 3207
3202 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue) 3208 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue)
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 3723
3718 DEFINE_TRACE_WRAPPERS(Element) 3724 DEFINE_TRACE_WRAPPERS(Element)
3719 { 3725 {
3720 if (hasRareData()) { 3726 if (hasRareData()) {
3721 visitor->traceWrappers(elementRareData()); 3727 visitor->traceWrappers(elementRareData());
3722 } 3728 }
3723 ContainerNode::traceWrappers(visitor); 3729 ContainerNode::traceWrappers(visitor);
3724 } 3730 }
3725 3731
3726 } // namespace blink 3732 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/dom/custom/CustomElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698