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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index e57717fef0be40072014ca746fcd95b692d725c2..4bef37fe53ea2e62f472c790ac5889fcccf2c741 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -103,6 +103,7 @@
#include "core/html/HTMLFrameOwnerElement.h"
#include "core/html/HTMLOptionsCollection.h"
#include "core/html/HTMLPlugInElement.h"
+#include "core/html/HTMLSlotElement.h"
#include "core/html/HTMLTableRowsCollection.h"
#include "core/html/HTMLTemplateElement.h"
#include "core/html/parser/HTMLParserIdioms.h"
@@ -1140,8 +1141,11 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow, name, newValue))
parentElementShadow->setNeedsDistributionRecalc();
}
- if (name == HTMLNames::slotAttr && isChildOfV1ShadowHost())
+ if (name == HTMLNames::slotAttr && isChildOfV1ShadowHost()) {
parentElementShadow()->setNeedsDistributionRecalc();
+ if (oldValue != newValue)
+ parentElement()->shadowRootIfV1()->assignV1();
+ }
parseAttribute(name, oldValue, newValue);
@@ -1499,6 +1503,12 @@ void Element::removedFrom(ContainerNode* insertionPoint)
if (document().frame())
document().frame()->eventHandler().elementRemoved(this);
+
+ if (HTMLSlotElement* slot = assignedSlot()) {
+ ShadowRoot* root = slot->containingShadowRoot();
+ if (root && root->isV1())
+ root->assignV1();
+ }
}
void Element::attach(const AttachContext& context)
@@ -2074,8 +2084,14 @@ void Element::childrenChanged(const ChildrenChange& change)
if (!change.byParser && change.isChildElementChange())
checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingElementRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAfterChange);
- if (ElementShadow* shadow = this->shadow())
+ if (ElementShadow* shadow = this->shadow()) {
shadow->setNeedsDistributionRecalc();
+ if (document().shadowCascadeOrder() == ShadowCascadeOrder::ShadowCascadeV1) {
+ ShadowRoot* root = isShadowHost(*this) && shadowRoot()->isV1() ? shadowRootIfV1() : isHTMLSlotElement(*this) ? containingShadowRoot() : nullptr;
+ if (root && root->isV1())
+ root->assignV1();
+ }
+ }
}
void Element::finishParsingChildren()
« 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