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

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

Issue 2420043002: Stop re-signaling a slotchange event (Closed)
Patch Set: rebased Created 4 years, 1 month 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/html/HTMLSlotElement.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fa40b92faffe18c27fb4c67dfe67fbe4188eb9fd..3ad1a64ad692537fc98a1b86b66f62f634a5e636 100644
--- a/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLSlotElement.cpp
@@ -315,13 +315,9 @@ 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();
// TODO(hayato): Relax this check if slots in non-shadow trees are well
// supported.
@@ -330,7 +326,15 @@ void HTMLSlotElement::enqueueSlotChangeEvent() {
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 {
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLSlotElement.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698