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

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1995203002: Rewrite Shadow DOM distribution engine to support partial synchronous distribution for v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No longer FAIL: imported/wpt/shadow-dom/HTMLSlotElement-interface.html Created 4 years, 7 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 092cbd4640ff6db56e8b25f5cb0a8112f1f6de65..ad733eb0c4ddb3bace00238d67d869cb8e823127 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -78,6 +78,7 @@
#include "core/dom/shadow/InsertionPoint.h"
#include "core/dom/shadow/ShadowRoot.h"
#include "core/dom/shadow/ShadowRootInit.h"
+#include "core/dom/shadow/SlotAssignment.h"
#include "core/editing/EditingUtilities.h"
#include "core/editing/FrameSelection.h"
#include "core/editing/iterators/TextIterator.h"
@@ -1145,10 +1146,9 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow, name, newValue))
parentElementShadow->setNeedsDistributionRecalc();
}
- if (name == HTMLNames::slotAttr && isChildOfV1ShadowHost()) {
- parentElementShadow()->setNeedsDistributionRecalc();
- if (oldValue != newValue)
- parentElement()->shadowRootIfV1()->assignV1();
+ if (name == HTMLNames::slotAttr && oldValue != newValue) {
+ if (ShadowRoot* root = v1ShadowRootOfParent())
+ root->ensureSlotAssignment().hostChildSlotNameChanged(oldValue, newValue);
}
parseAttribute(name, oldValue, newValue);
@@ -1507,12 +1507,6 @@ 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)
@@ -2088,14 +2082,9 @@ 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()) {
+ // TODO(hayato): Confirm that we can skip this if a shadow tree is v1.
+ 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