OLD | NEW |
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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 void setAffectedByFirstChildRules() { setRestyleFlag(AffectedByFirstChildRul
es); } | 152 void setAffectedByFirstChildRules() { setRestyleFlag(AffectedByFirstChildRul
es); } |
153 | 153 |
154 bool affectedByLastChildRules() const { return hasRestyleFlag(AffectedByLast
ChildRules); } | 154 bool affectedByLastChildRules() const { return hasRestyleFlag(AffectedByLast
ChildRules); } |
155 void setAffectedByLastChildRules() { setRestyleFlag(AffectedByLastChildRules
); } | 155 void setAffectedByLastChildRules() { setRestyleFlag(AffectedByLastChildRules
); } |
156 | 156 |
157 bool needsAdjacentStyleRecalc() const; | 157 bool needsAdjacentStyleRecalc() const; |
158 | 158 |
159 // FIXME: These methods should all be renamed to something better than "chec
k", | 159 // FIXME: These methods should all be renamed to something better than "chec
k", |
160 // since it's not clear that they alter the style bits of siblings and child
ren. | 160 // since it's not clear that they alter the style bits of siblings and child
ren. |
161 enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, Sib
lingElementRemoved }; | 161 enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, Sib
lingElementRemoved }; |
162 void checkForSiblingStyleChanges(SiblingCheckType, Node* nodeBeforeChange, N
ode* nodeAfterChange); | 162 void checkForSiblingStyleChanges(SiblingCheckType, Node* changedNode, Node*
nodeBeforeChange, Node* nodeAfterChange); |
163 void recalcChildStyle(StyleRecalcChange); | 163 void recalcChildStyle(StyleRecalcChange); |
164 | 164 |
165 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); } | 165 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); } |
166 | 166 |
167 // -------------------------------------------------------------------------
---- | 167 // -------------------------------------------------------------------------
---- |
168 // Notification of document structure changes (see core/dom/Node.h for more
notification methods) | 168 // Notification of document structure changes (see core/dom/Node.h for more
notification methods) |
169 | 169 |
170 enum ChildrenChangeType { ElementInserted, NonElementInserted, ElementRemove
d, NonElementRemoved, AllChildrenRemoved, TextChanged }; | 170 enum ChildrenChangeType { ElementInserted, NonElementInserted, ElementRemove
d, NonElementRemoved, AllChildrenRemoved, TextChanged }; |
171 enum ChildrenChangeSource { ChildrenChangeSourceAPI, ChildrenChangeSourcePar
ser }; | 171 enum ChildrenChangeSource { ChildrenChangeSourceAPI, ChildrenChangeSourcePar
ser }; |
172 struct ChildrenChange { | 172 struct ChildrenChange { |
173 STACK_ALLOCATED(); | 173 STACK_ALLOCATED(); |
174 public: | 174 public: |
175 static ChildrenChange forInsertion(Node& node, ChildrenChangeSource byPa
rser) | 175 static ChildrenChange forInsertion(Node& node, ChildrenChangeSource byPa
rser) |
176 { | 176 { |
177 ChildrenChange change = { | 177 ChildrenChange change = { |
178 node.isElementNode() ? ElementInserted : NonElementInserted, | 178 node.isElementNode() ? ElementInserted : NonElementInserted, |
| 179 &node, |
179 node.previousSibling(), | 180 node.previousSibling(), |
180 node.nextSibling(), | 181 node.nextSibling(), |
181 byParser | 182 byParser |
182 }; | 183 }; |
183 return change; | 184 return change; |
184 } | 185 } |
185 | 186 |
186 static ChildrenChange forRemoval(Node& node, Node* previousSibling, Node
* nextSibling, ChildrenChangeSource byParser) | 187 static ChildrenChange forRemoval(Node& node, Node* previousSibling, Node
* nextSibling, ChildrenChangeSource byParser) |
187 { | 188 { |
188 ChildrenChange change = { | 189 ChildrenChange change = { |
189 node.isElementNode() ? ElementRemoved : NonElementRemoved, | 190 node.isElementNode() ? ElementRemoved : NonElementRemoved, |
| 191 &node, |
190 previousSibling, | 192 previousSibling, |
191 nextSibling, | 193 nextSibling, |
192 byParser | 194 byParser |
193 }; | 195 }; |
194 return change; | 196 return change; |
195 } | 197 } |
196 | 198 |
197 bool isChildInsertion() const { return type == ElementInserted || type =
= NonElementInserted; } | 199 bool isChildInsertion() const { return type == ElementInserted || type =
= NonElementInserted; } |
198 bool isChildRemoval() const { return type == ElementRemoved || type == N
onElementRemoved; } | 200 bool isChildRemoval() const { return type == ElementRemoved || type == N
onElementRemoved; } |
199 bool isChildElementChange() const { return type == ElementInserted || ty
pe == ElementRemoved; } | 201 bool isChildElementChange() const { return type == ElementInserted || ty
pe == ElementRemoved; } |
200 | 202 |
201 ChildrenChangeType type; | 203 ChildrenChangeType type; |
| 204 Member<Node> siblingChanged; |
202 Member<Node> siblingBeforeChange; | 205 Member<Node> siblingBeforeChange; |
203 Member<Node> siblingAfterChange; | 206 Member<Node> siblingAfterChange; |
204 ChildrenChangeSource byParser; | 207 ChildrenChangeSource byParser; |
205 }; | 208 }; |
206 | 209 |
207 // Notifies the node that it's list of children have changed (either by addi
ng or removing child nodes), or a child | 210 // Notifies the node that it's list of children have changed (either by addi
ng or removing child nodes), or a child |
208 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha
s changed its value. | 211 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha
s changed its value. |
209 virtual void childrenChanged(const ChildrenChange&); | 212 virtual void childrenChanged(const ChildrenChange&); |
210 | 213 |
211 DECLARE_VIRTUAL_TRACE(); | 214 DECLARE_VIRTUAL_TRACE(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) | 339 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) |
337 { | 340 { |
338 DCHECK(!nodes.size()); | 341 DCHECK(!nodes.size()); |
339 for (Node* child = node.firstChild(); child; child = child->nextSibling()) | 342 for (Node* child = node.firstChild(); child; child = child->nextSibling()) |
340 nodes.append(child); | 343 nodes.append(child); |
341 } | 344 } |
342 | 345 |
343 } // namespace blink | 346 } // namespace blink |
344 | 347 |
345 #endif // ContainerNode_h | 348 #endif // ContainerNode_h |
OLD | NEW |