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

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

Issue 1695163003: Support slotchange events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor Created 4 years, 10 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/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 832a32753ea3be8d7e1d126a70b68b588392669c..f1caf2f053eeafdd9b5f50f2e675ecbc741f5613 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -44,6 +44,7 @@
#include "core/dom/ElementTraversal.h"
#include "core/dom/ExceptionCode.h"
#include "core/dom/LayoutTreeBuilderTraversal.h"
+#include "core/dom/Microtask.h"
#include "core/dom/NodeRareData.h"
#include "core/dom/NodeTraversal.h"
#include "core/dom/ProcessingInstruction.h"
@@ -690,6 +691,11 @@ void Node::markAncestorsWithChildNeedsStyleInvalidation()
void Node::markAncestorsWithChildNeedsDistributionRecalc()
{
ScriptForbiddenScope forbidScriptDuringRawIteration;
+ if (inDocument() && !document().childNeedsDistributionRecalc()) {
+ // TODO(hayato): Support a non-document composed tree.
+ // TODO(hayato): Enqueue a task only if a 'slotchange' event listner is registered in the document composed tree.
+ Microtask::enqueueMicrotask(WTF::bind(&Document::updateDistribution, PassRefPtrWillBeRawPtr<Document>(&document())));
esprehn 2016/02/18 17:30:43 this means we force a distribution after every DOM
esprehn 2016/02/18 18:07:37 This is also adding an extra microtask every time
+ }
for (Node* node = this; node && !node->childNeedsDistributionRecalc(); node = node->parentOrShadowHostNode())
node->setChildNeedsDistributionRecalc();
document().scheduleLayoutTreeUpdateIfNeeded();

Powered by Google App Engine
This is Rietveld 408576698