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

Side by Side 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 26 matching lines...) Expand all
37 #include "core/dom/ChildNodeList.h" 37 #include "core/dom/ChildNodeList.h"
38 #include "core/dom/DOMNodeIds.h" 38 #include "core/dom/DOMNodeIds.h"
39 #include "core/dom/Document.h" 39 #include "core/dom/Document.h"
40 #include "core/dom/DocumentFragment.h" 40 #include "core/dom/DocumentFragment.h"
41 #include "core/dom/DocumentType.h" 41 #include "core/dom/DocumentType.h"
42 #include "core/dom/Element.h" 42 #include "core/dom/Element.h"
43 #include "core/dom/ElementRareData.h" 43 #include "core/dom/ElementRareData.h"
44 #include "core/dom/ElementTraversal.h" 44 #include "core/dom/ElementTraversal.h"
45 #include "core/dom/ExceptionCode.h" 45 #include "core/dom/ExceptionCode.h"
46 #include "core/dom/LayoutTreeBuilderTraversal.h" 46 #include "core/dom/LayoutTreeBuilderTraversal.h"
47 #include "core/dom/Microtask.h"
47 #include "core/dom/NodeRareData.h" 48 #include "core/dom/NodeRareData.h"
48 #include "core/dom/NodeTraversal.h" 49 #include "core/dom/NodeTraversal.h"
49 #include "core/dom/ProcessingInstruction.h" 50 #include "core/dom/ProcessingInstruction.h"
50 #include "core/dom/Range.h" 51 #include "core/dom/Range.h"
51 #include "core/dom/StaticNodeList.h" 52 #include "core/dom/StaticNodeList.h"
52 #include "core/dom/StyleEngine.h" 53 #include "core/dom/StyleEngine.h"
53 #include "core/dom/TemplateContentDocumentFragment.h" 54 #include "core/dom/TemplateContentDocumentFragment.h"
54 #include "core/dom/Text.h" 55 #include "core/dom/Text.h"
55 #include "core/dom/TreeScopeAdopter.h" 56 #include "core/dom/TreeScopeAdopter.h"
56 #include "core/dom/UserActionElementSet.h" 57 #include "core/dom/UserActionElementSet.h"
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 { 684 {
684 ScriptForbiddenScope forbidScriptDuringRawIteration; 685 ScriptForbiddenScope forbidScriptDuringRawIteration;
685 for (Node* node = parentOrShadowHostNode(); node && !node->childNeedsStyleIn validation(); node = node->parentOrShadowHostNode()) 686 for (Node* node = parentOrShadowHostNode(); node && !node->childNeedsStyleIn validation(); node = node->parentOrShadowHostNode())
686 node->setChildNeedsStyleInvalidation(); 687 node->setChildNeedsStyleInvalidation();
687 document().scheduleLayoutTreeUpdateIfNeeded(); 688 document().scheduleLayoutTreeUpdateIfNeeded();
688 } 689 }
689 690
690 void Node::markAncestorsWithChildNeedsDistributionRecalc() 691 void Node::markAncestorsWithChildNeedsDistributionRecalc()
691 { 692 {
692 ScriptForbiddenScope forbidScriptDuringRawIteration; 693 ScriptForbiddenScope forbidScriptDuringRawIteration;
694 if (inDocument() && !document().childNeedsDistributionRecalc()) {
695 // TODO(hayato): Support a non-document composed tree.
696 // TODO(hayato): Enqueue a task only if a 'slotchange' event listner is registered in the document composed tree.
697 Microtask::enqueueMicrotask(WTF::bind(&Document::updateDistribution, Pas sRefPtrWillBeRawPtr<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
698 }
693 for (Node* node = this; node && !node->childNeedsDistributionRecalc(); node = node->parentOrShadowHostNode()) 699 for (Node* node = this; node && !node->childNeedsDistributionRecalc(); node = node->parentOrShadowHostNode())
694 node->setChildNeedsDistributionRecalc(); 700 node->setChildNeedsDistributionRecalc();
695 document().scheduleLayoutTreeUpdateIfNeeded(); 701 document().scheduleLayoutTreeUpdateIfNeeded();
696 } 702 }
697 703
698 inline void Node::setStyleChange(StyleChangeType changeType) 704 inline void Node::setStyleChange(StyleChangeType changeType)
699 { 705 {
700 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType; 706 m_nodeFlags = (m_nodeFlags & ~StyleChangeMask) | changeType;
701 } 707 }
702 708
(...skipping 1722 matching lines...) Expand 10 before | Expand all | Expand 10 after
2425 2431
2426 void showNodePath(const blink::Node* node) 2432 void showNodePath(const blink::Node* node)
2427 { 2433 {
2428 if (node) 2434 if (node)
2429 node->showNodePathForThis(); 2435 node->showNodePathForThis();
2430 else 2436 else
2431 fprintf(stderr, "Cannot showNodePath for (nil)\n"); 2437 fprintf(stderr, "Cannot showNodePath for (nil)\n");
2432 } 2438 }
2433 2439
2434 #endif 2440 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698