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

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: Minor cleanup 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 if (CustomElementsRegistry* registry = CustomElement::registry(*this )) 1428 CustomElement::enqueueConnectedCallback(this);
1429 registry->addCandidate(this); 1429 } else {
1430 if (getCustomElementState() == CustomElementState::Undefined) {
1431 if (CustomElementsRegistry* registry = CustomElement::registry(* this))
1432 registry->addCandidate(this);
1433 }
1434 if (isUpgradedV0CustomElement())
dominicc (has gone to gerrit) 2016/06/13 07:59:01 Maybe this case should come before if (getCustomEl
1435 V0CustomElement::didAttach(this, document());
1430 } 1436 }
1431 if (isUpgradedV0CustomElement())
1432 V0CustomElement::didAttach(this, document());
1433 } 1437 }
1434 1438
1435 TreeScope& scope = insertionPoint->treeScope(); 1439 TreeScope& scope = insertionPoint->treeScope();
1436 if (scope != treeScope()) 1440 if (scope != treeScope())
1437 return InsertionDone; 1441 return InsertionDone;
1438 1442
1439 const AtomicString& idValue = getIdAttribute(); 1443 const AtomicString& idValue = getIdAttribute();
1440 if (!idValue.isNull()) 1444 if (!idValue.isNull())
1441 updateId(scope, nullAtom, idValue); 1445 updateId(scope, nullAtom, idValue);
1442 1446
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 } 1487 }
1484 1488
1485 ContainerNode::removedFrom(insertionPoint); 1489 ContainerNode::removedFrom(insertionPoint);
1486 if (wasInDocument) { 1490 if (wasInDocument) {
1487 if (this == document().cssTarget()) 1491 if (this == document().cssTarget())
1488 document().setCSSTarget(nullptr); 1492 document().setCSSTarget(nullptr);
1489 1493
1490 if (hasPendingResources()) 1494 if (hasPendingResources())
1491 document().accessSVGExtensions().removeElementFromPendingResources(t his); 1495 document().accessSVGExtensions().removeElementFromPendingResources(t his);
1492 1496
1493 if (isUpgradedV0CustomElement()) 1497 if (getCustomElementState() == CustomElementState::Custom)
1498 CustomElement::enqueueDisconnectedCallback(this);
1499 else if (isUpgradedV0CustomElement())
1494 V0CustomElement::didDetach(this, insertionPoint->document()); 1500 V0CustomElement::didDetach(this, insertionPoint->document());
1495 1501
1496 if (needsStyleInvalidation()) 1502 if (needsStyleInvalidation())
1497 document().styleEngine().styleInvalidator().clearInvalidation(*this) ; 1503 document().styleEngine().styleInvalidator().clearInvalidation(*this) ;
1498 } 1504 }
1499 1505
1500 document().removeFromTopLayer(this); 1506 document().removeFromTopLayer(this);
1501 1507
1502 clearElementFlag(IsInCanvasSubtree); 1508 clearElementFlag(IsInCanvasSubtree);
1503 1509
(...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3182 } 3188 }
3183 3189
3184 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue) 3190 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue)
3185 { 3191 {
3186 if (name == HTMLNames::nameAttr) { 3192 if (name == HTMLNames::nameAttr) {
3187 updateName(oldValue, newValue); 3193 updateName(oldValue, newValue);
3188 } 3194 }
3189 3195
3190 if (oldValue != newValue) { 3196 if (oldValue != newValue) {
3191 document().styleEngine().attributeChangedForElement(name, *this); 3197 document().styleEngine().attributeChangedForElement(name, *this);
3192 if (isUpgradedV0CustomElement()) 3198 if (getCustomElementState() == CustomElementState::Custom)
3199 CustomElement::enqueueAttributeChangedCallback(this, name, oldValue, newValue);
3200 else if (isUpgradedV0CustomElement())
3193 V0CustomElement::attributeDidChange(this, name.localName(), oldValue , newValue); 3201 V0CustomElement::attributeDidChange(this, name.localName(), oldValue , newValue);
3194 } 3202 }
3195 3203
3196 if (MutationObserverInterestGroup* recipients = MutationObserverInterestGrou p::createForAttributesMutation(*this, name)) 3204 if (MutationObserverInterestGroup* recipients = MutationObserverInterestGrou p::createForAttributesMutation(*this, name))
3197 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue)); 3205 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue));
3198 3206
3199 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue); 3207 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue);
3200 } 3208 }
3201 3209
3202 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue) 3210 void Element::didAddAttribute(const QualifiedName& name, const AtomicString& val ue)
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
3717 3725
3718 DEFINE_TRACE_WRAPPERS(Element) 3726 DEFINE_TRACE_WRAPPERS(Element)
3719 { 3727 {
3720 if (hasRareData()) { 3728 if (hasRareData()) {
3721 visitor->traceWrappers(elementRareData()); 3729 visitor->traceWrappers(elementRareData());
3722 } 3730 }
3723 ContainerNode::traceWrappers(visitor); 3731 ContainerNode::traceWrappers(visitor);
3724 } 3732 }
3725 3733
3726 } // namespace blink 3734 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698