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

Unified Diff: third_party/WebKit/Source/core/html/HTMLSlotElement.cpp

Issue 2420043002: Stop re-signaling a slotchange event (Closed)
Patch Set: New slotchange behavior Created 4 years, 2 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/html/HTMLSlotElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
index 1b8b7bfef1748291b272b08414b4104872c304d9..090adb3f9739f3734d7bb08735aeaf5a9fa23403 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -309,20 +309,24 @@ void HTMLSlotElement::lazyReattachDistributedNodesIfNeeded() {
m_oldDistributedNodes.clear();
}
-void HTMLSlotElement::enqueueSlotChangeEvent() {
- if (!m_slotchangeEventEnqueued) {
- Microtask::enqueueMicrotask(WTF::bind(
- &HTMLSlotElement::dispatchSlotChangeEvent, wrapPersistent(this)));
- m_slotchangeEventEnqueued = true;
- }
-
+void HTMLSlotElement::didSlotChange(SlotChangeType slotChangeType) {
+ if (slotChangeType == SlotChangeType::Initial)
+ enqueueSlotChangeEvent();
ShadowRoot* root = containingShadowRoot();
DCHECK(root);
DCHECK(root->isV1());
root->owner()->setNeedsDistributionRecalc();
// Check slotchange recursively since this slotchange may cause another
// slotchange.
- checkSlotChange();
+ checkSlotChange(SlotChangeType::Chained);
+}
+
+void HTMLSlotElement::enqueueSlotChangeEvent() {
+ if (m_slotchangeEventEnqueued)
+ return;
+ Microtask::enqueueMicrotask(WTF::bind(
+ &HTMLSlotElement::dispatchSlotChangeEvent, wrapPersistent(this)));
+ m_slotchangeEventEnqueued = true;
}
bool HTMLSlotElement::hasAssignedNodesSlow() const {

Powered by Google App Engine
This is Rietveld 408576698