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

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

Issue 1899653002: Support slotchange event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Bug fix Created 4 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 #include "core/html/ClassList.h" 96 #include "core/html/ClassList.h"
97 #include "core/html/HTMLCanvasElement.h" 97 #include "core/html/HTMLCanvasElement.h"
98 #include "core/html/HTMLCollection.h" 98 #include "core/html/HTMLCollection.h"
99 #include "core/html/HTMLDocument.h" 99 #include "core/html/HTMLDocument.h"
100 #include "core/html/HTMLElement.h" 100 #include "core/html/HTMLElement.h"
101 #include "core/html/HTMLFormControlsCollection.h" 101 #include "core/html/HTMLFormControlsCollection.h"
102 #include "core/html/HTMLFrameElementBase.h" 102 #include "core/html/HTMLFrameElementBase.h"
103 #include "core/html/HTMLFrameOwnerElement.h" 103 #include "core/html/HTMLFrameOwnerElement.h"
104 #include "core/html/HTMLOptionsCollection.h" 104 #include "core/html/HTMLOptionsCollection.h"
105 #include "core/html/HTMLPlugInElement.h" 105 #include "core/html/HTMLPlugInElement.h"
106 #include "core/html/HTMLSlotElement.h"
106 #include "core/html/HTMLTableRowsCollection.h" 107 #include "core/html/HTMLTableRowsCollection.h"
107 #include "core/html/HTMLTemplateElement.h" 108 #include "core/html/HTMLTemplateElement.h"
108 #include "core/html/parser/HTMLParserIdioms.h" 109 #include "core/html/parser/HTMLParserIdioms.h"
109 #include "core/input/EventHandler.h" 110 #include "core/input/EventHandler.h"
110 #include "core/inspector/InspectorInstrumentation.h" 111 #include "core/inspector/InspectorInstrumentation.h"
111 #include "core/layout/LayoutTextFragment.h" 112 #include "core/layout/LayoutTextFragment.h"
112 #include "core/layout/api/LayoutBoxItem.h" 113 #include "core/layout/api/LayoutBoxItem.h"
113 #include "core/layout/api/LayoutViewItem.h" 114 #include "core/layout/api/LayoutViewItem.h"
114 #include "core/loader/DocumentLoader.h" 115 #include "core/loader/DocumentLoader.h"
115 #include "core/page/ChromeClient.h" 116 #include "core/page/ChromeClient.h"
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 return value.lowerASCII(); 1134 return value.lowerASCII();
1134 return value; 1135 return value;
1135 } 1136 }
1136 1137
1137 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol dValue, const AtomicString& newValue, AttributeModificationReason reason) 1138 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol dValue, const AtomicString& newValue, AttributeModificationReason reason)
1138 { 1139 {
1139 if (ElementShadow* parentElementShadow = shadowWhereNodeCanBeDistributed(*th is)) { 1140 if (ElementShadow* parentElementShadow = shadowWhereNodeCanBeDistributed(*th is)) {
1140 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow , name, newValue)) 1141 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow , name, newValue))
1141 parentElementShadow->setNeedsDistributionRecalc(); 1142 parentElementShadow->setNeedsDistributionRecalc();
1142 } 1143 }
1143 if (name == HTMLNames::slotAttr && isChildOfV1ShadowHost()) 1144 if (name == HTMLNames::slotAttr && isChildOfV1ShadowHost()) {
1144 parentElementShadow()->setNeedsDistributionRecalc(); 1145 parentElementShadow()->setNeedsDistributionRecalc();
1146 if (oldValue != newValue)
1147 parentElement()->shadowRootIfV1()->assignV1();
1148 }
1145 1149
1146 parseAttribute(name, oldValue, newValue); 1150 parseAttribute(name, oldValue, newValue);
1147 1151
1148 document().incDOMTreeVersion(); 1152 document().incDOMTreeVersion();
1149 1153
1150 if (name == HTMLNames::idAttr) { 1154 if (name == HTMLNames::idAttr) {
1151 AtomicString oldId = elementData()->idForStyleResolution(); 1155 AtomicString oldId = elementData()->idForStyleResolution();
1152 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui rksMode()); 1156 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui rksMode());
1153 if (newId != oldId) { 1157 if (newId != oldId) {
1154 elementData()->setIdForStyleResolution(newId); 1158 elementData()->setIdForStyleResolution(newId);
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 1496
1493 if (ElementAnimations* elementAnimations = data->elementAnimations()) 1497 if (ElementAnimations* elementAnimations = data->elementAnimations())
1494 elementAnimations->cssAnimations().cancel(); 1498 elementAnimations->cssAnimations().cancel();
1495 1499
1496 if (data->intersectionObserverData()) 1500 if (data->intersectionObserverData())
1497 data->intersectionObserverData()->deactivateAllIntersectionObservers (*this); 1501 data->intersectionObserverData()->deactivateAllIntersectionObservers (*this);
1498 } 1502 }
1499 1503
1500 if (document().frame()) 1504 if (document().frame())
1501 document().frame()->eventHandler().elementRemoved(this); 1505 document().frame()->eventHandler().elementRemoved(this);
1506
1507 if (HTMLSlotElement* slot = assignedSlot()) {
1508 ShadowRoot* root = slot->containingShadowRoot();
1509 if (root && root->isV1())
1510 root->assignV1();
1511 }
1502 } 1512 }
1503 1513
1504 void Element::attach(const AttachContext& context) 1514 void Element::attach(const AttachContext& context)
1505 { 1515 {
1506 DCHECK(document().inStyleRecalc()); 1516 DCHECK(document().inStyleRecalc());
1507 1517
1508 // We've already been through detach when doing an attach, but we might 1518 // We've already been through detach when doing an attach, but we might
1509 // need to clear any state that's been added since then. 1519 // need to clear any state that's been added since then.
1510 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) { 1520 if (hasRareData() && getStyleChangeType() == NeedsReattachStyleChange) {
1511 ElementRareData* data = elementRareData(); 1521 ElementRareData* data = elementRareData();
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 } 2077 }
2068 2078
2069 void Element::childrenChanged(const ChildrenChange& change) 2079 void Element::childrenChanged(const ChildrenChange& change)
2070 { 2080 {
2071 ContainerNode::childrenChanged(change); 2081 ContainerNode::childrenChanged(change);
2072 2082
2073 checkForEmptyStyleChange(); 2083 checkForEmptyStyleChange();
2074 if (!change.byParser && change.isChildElementChange()) 2084 if (!change.byParser && change.isChildElementChange())
2075 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf terChange); 2085 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf terChange);
2076 2086
2077 if (ElementShadow* shadow = this->shadow()) 2087 if (ElementShadow* shadow = this->shadow()) {
2078 shadow->setNeedsDistributionRecalc(); 2088 shadow->setNeedsDistributionRecalc();
2089 if (document().shadowCascadeOrder() == ShadowCascadeOrder::ShadowCascade V1) {
2090 ShadowRoot* root = isShadowHost(*this) && shadowRoot()->isV1() ? sha dowRootIfV1() : isHTMLSlotElement(*this) ? containingShadowRoot() : nullptr;
2091 if (root && root->isV1())
2092 root->assignV1();
2093 }
2094 }
2079 } 2095 }
2080 2096
2081 void Element::finishParsingChildren() 2097 void Element::finishParsingChildren()
2082 { 2098 {
2083 setIsFinishedParsingChildren(true); 2099 setIsFinishedParsingChildren(true);
2084 checkForEmptyStyleChange(); 2100 checkForEmptyStyleChange();
2085 checkForSiblingStyleChanges(FinishedParsingChildren, lastChild(), nullptr); 2101 checkForSiblingStyleChanges(FinishedParsingChildren, lastChild(), nullptr);
2086 } 2102 }
2087 2103
2088 #ifndef NDEBUG 2104 #ifndef NDEBUG
(...skipping 1590 matching lines...) Expand 10 before | Expand all | Expand 10 after
3679 3695
3680 DEFINE_TRACE(Element) 3696 DEFINE_TRACE(Element)
3681 { 3697 {
3682 if (hasRareData()) 3698 if (hasRareData())
3683 visitor->trace(elementRareData()); 3699 visitor->trace(elementRareData());
3684 visitor->trace(m_elementData); 3700 visitor->trace(m_elementData);
3685 ContainerNode::trace(visitor); 3701 ContainerNode::trace(visitor);
3686 } 3702 }
3687 3703
3688 } // namespace blink 3704 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Element.h ('k') | third_party/WebKit/Source/core/dom/Node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698