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

Side by Side Diff: third_party/WebKit/Source/core/dom/ContainerNode.h

Issue 2089063005: Schedule sibling invalidation sets for sibling insert/remove. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed minDirectAdjacent optimization. Created 4 years, 5 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, 2009, 2010, 2011, 2013 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All r ights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 void setAffectedByFirstChildRules() { setRestyleFlag(AffectedByFirstChildRul es); } 151 void setAffectedByFirstChildRules() { setRestyleFlag(AffectedByFirstChildRul es); }
152 152
153 bool affectedByLastChildRules() const { return hasRestyleFlag(AffectedByLast ChildRules); } 153 bool affectedByLastChildRules() const { return hasRestyleFlag(AffectedByLast ChildRules); }
154 void setAffectedByLastChildRules() { setRestyleFlag(AffectedByLastChildRules ); } 154 void setAffectedByLastChildRules() { setRestyleFlag(AffectedByLastChildRules ); }
155 155
156 bool needsAdjacentStyleRecalc() const; 156 bool needsAdjacentStyleRecalc() const;
157 157
158 // FIXME: These methods should all be renamed to something better than "chec k", 158 // FIXME: These methods should all be renamed to something better than "chec k",
159 // since it's not clear that they alter the style bits of siblings and child ren. 159 // since it's not clear that they alter the style bits of siblings and child ren.
160 enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, Sib lingElementRemoved }; 160 enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, Sib lingElementRemoved };
161 void checkForSiblingStyleChanges(SiblingCheckType, Node* nodeBeforeChange, N ode* nodeAfterChange); 161 void checkForSiblingStyleChanges(SiblingCheckType, Node* changedNode, Node* nodeBeforeChange, Node* nodeAfterChange);
162 void recalcChildStyle(StyleRecalcChange); 162 void recalcChildStyle(StyleRecalcChange);
163 163
164 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); } 164 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); }
165 165
166 // ------------------------------------------------------------------------- ---- 166 // ------------------------------------------------------------------------- ----
167 // Notification of document structure changes (see core/dom/Node.h for more notification methods) 167 // Notification of document structure changes (see core/dom/Node.h for more notification methods)
168 168
169 enum ChildrenChangeType { ElementInserted, NonElementInserted, ElementRemove d, NonElementRemoved, AllChildrenRemoved, TextChanged }; 169 enum ChildrenChangeType { ElementInserted, NonElementInserted, ElementRemove d, NonElementRemoved, AllChildrenRemoved, TextChanged };
170 enum ChildrenChangeSource { ChildrenChangeSourceAPI, ChildrenChangeSourcePar ser }; 170 enum ChildrenChangeSource { ChildrenChangeSourceAPI, ChildrenChangeSourcePar ser };
171 struct ChildrenChange { 171 struct ChildrenChange {
172 STACK_ALLOCATED(); 172 STACK_ALLOCATED();
173 public: 173 public:
174 static ChildrenChange forInsertion(Node& node, ChildrenChangeSource byPa rser) 174 static ChildrenChange forInsertion(Node& node, ChildrenChangeSource byPa rser)
175 { 175 {
176 ChildrenChange change = { 176 ChildrenChange change = {
177 node.isElementNode() ? ElementInserted : NonElementInserted, 177 node.isElementNode() ? ElementInserted : NonElementInserted,
178 &node,
178 node.previousSibling(), 179 node.previousSibling(),
179 node.nextSibling(), 180 node.nextSibling(),
180 byParser 181 byParser
181 }; 182 };
182 return change; 183 return change;
183 } 184 }
184 185
185 static ChildrenChange forRemoval(Node& node, Node* previousSibling, Node * nextSibling, ChildrenChangeSource byParser) 186 static ChildrenChange forRemoval(Node& node, Node* previousSibling, Node * nextSibling, ChildrenChangeSource byParser)
186 { 187 {
187 ChildrenChange change = { 188 ChildrenChange change = {
188 node.isElementNode() ? ElementRemoved : NonElementRemoved, 189 node.isElementNode() ? ElementRemoved : NonElementRemoved,
190 &node,
189 previousSibling, 191 previousSibling,
190 nextSibling, 192 nextSibling,
191 byParser 193 byParser
192 }; 194 };
193 return change; 195 return change;
194 } 196 }
195 197
196 bool isChildInsertion() const { return type == ElementInserted || type = = NonElementInserted; } 198 bool isChildInsertion() const { return type == ElementInserted || type = = NonElementInserted; }
197 bool isChildRemoval() const { return type == ElementRemoved || type == N onElementRemoved; } 199 bool isChildRemoval() const { return type == ElementRemoved || type == N onElementRemoved; }
198 bool isChildElementChange() const { return type == ElementInserted || ty pe == ElementRemoved; } 200 bool isChildElementChange() const { return type == ElementInserted || ty pe == ElementRemoved; }
199 201
200 ChildrenChangeType type; 202 ChildrenChangeType type;
203 Member<Node> siblingChanged;
201 Member<Node> siblingBeforeChange; 204 Member<Node> siblingBeforeChange;
202 Member<Node> siblingAfterChange; 205 Member<Node> siblingAfterChange;
203 ChildrenChangeSource byParser; 206 ChildrenChangeSource byParser;
204 }; 207 };
205 208
206 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child 209 // Notifies the node that it's list of children have changed (either by addi ng or removing child nodes), or a child
207 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value. 210 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha s changed its value.
208 virtual void childrenChanged(const ChildrenChange&); 211 virtual void childrenChanged(const ChildrenChange&);
209 212
210 DECLARE_VIRTUAL_TRACE(); 213 DECLARE_VIRTUAL_TRACE();
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) 338 inline void getChildNodes(ContainerNode& node, NodeVector& nodes)
336 { 339 {
337 DCHECK(!nodes.size()); 340 DCHECK(!nodes.size());
338 for (Node* child = node.firstChild(); child; child = child->nextSibling()) 341 for (Node* child = node.firstChild(); child; child = child->nextSibling())
339 nodes.append(child); 342 nodes.append(child);
340 } 343 }
341 344
342 } // namespace blink 345 } // namespace blink
343 346
344 #endif // ContainerNode_h 347 #endif // ContainerNode_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/CharacterData.cpp ('k') | third_party/WebKit/Source/core/dom/ContainerNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698