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

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: wip 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
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 85e2bbf37d39955ef10d7416e4aa1b38dcf0d795..5b07788cfeac79624f1c6ace850360edb67f3b35 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()

Powered by Google App Engine
This is Rietveld 408576698