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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 bool childrenAffectedByForwardPositionalRules() const { return hasRestyleFla
g(ChildrenAffectedByForwardPositionalRules); } | 139 bool childrenAffectedByForwardPositionalRules() const { return hasRestyleFla
g(ChildrenAffectedByForwardPositionalRules); } |
140 void setChildrenAffectedByForwardPositionalRules() { setRestyleFlag(Children
AffectedByForwardPositionalRules); } | 140 void setChildrenAffectedByForwardPositionalRules() { setRestyleFlag(Children
AffectedByForwardPositionalRules); } |
141 | 141 |
142 bool childrenAffectedByBackwardPositionalRules() const { return hasRestyleFl
ag(ChildrenAffectedByBackwardPositionalRules); } | 142 bool childrenAffectedByBackwardPositionalRules() const { return hasRestyleFl
ag(ChildrenAffectedByBackwardPositionalRules); } |
143 void setChildrenAffectedByBackwardPositionalRules() { setRestyleFlag(Childre
nAffectedByBackwardPositionalRules); } | 143 void setChildrenAffectedByBackwardPositionalRules() { setRestyleFlag(Childre
nAffectedByBackwardPositionalRules); } |
144 | 144 |
145 // FIXME: These methods should all be renamed to something better than "chec
k", | 145 // FIXME: These methods should all be renamed to something better than "chec
k", |
146 // since it's not clear that they alter the style bits of siblings and child
ren. | 146 // since it's not clear that they alter the style bits of siblings and child
ren. |
147 void checkForChildrenAdjacentRuleChanges(); | 147 void checkForChildrenAdjacentRuleChanges(); |
148 enum SiblingCheckType { FinishedParsingChildren, SiblingRemoved, Other }; | 148 enum SiblingCheckType { FinishedParsingChildren, SiblingElementInserted, Sib
lingElementRemoved }; |
149 void checkForSiblingStyleChanges(SiblingCheckType, Node* nodeBeforeChange, N
ode* nodeAfterChange); | 149 void checkForSiblingStyleChanges(SiblingCheckType, Node* nodeBeforeChange, N
ode* nodeAfterChange); |
150 | 150 |
151 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); } | 151 bool childrenSupportStyleSharing() const { return !hasRestyleFlags(); } |
152 | 152 |
153 // -------------------------------------------------------------------------
---- | 153 // -------------------------------------------------------------------------
---- |
154 // Notification of document structure changes (see core/dom/Node.h for more
notification methods) | 154 // Notification of document structure changes (see core/dom/Node.h for more
notification methods) |
155 | 155 |
156 enum ChildrenChangeType { ChildInserted, ChildRemoved, AllChildrenRemoved, T
extChanged }; | 156 enum ChildrenChangeType { ElementInserted, NonElementInserted, ElementRemove
d, NonElementRemoved, AllChildrenRemoved, TextChanged }; |
157 enum ChildrenChangeSource { ChildrenChangeSourceAPI, ChildrenChangeSourcePar
ser }; | 157 enum ChildrenChangeSource { ChildrenChangeSourceAPI, ChildrenChangeSourcePar
ser }; |
158 struct ChildrenChange { | 158 struct ChildrenChange { |
159 STACK_ALLOCATED(); | 159 STACK_ALLOCATED(); |
160 public: | 160 public: |
| 161 static ChildrenChange forInsertion(Node& node, ChildrenChangeSource byPa
rser) |
| 162 { |
| 163 ChildrenChange change = { |
| 164 node.isElementNode() ? ElementInserted : NonElementInserted, |
| 165 node.previousSibling(), |
| 166 node.nextSibling(), |
| 167 byParser |
| 168 }; |
| 169 return change; |
| 170 } |
| 171 |
| 172 static ChildrenChange forRemoval(Node& node, Node* previousSibling, Node
* nextSibling, ChildrenChangeSource byParser) |
| 173 { |
| 174 ChildrenChange change = { |
| 175 node.isElementNode() ? ElementRemoved : NonElementRemoved, |
| 176 previousSibling, |
| 177 nextSibling, |
| 178 byParser |
| 179 }; |
| 180 return change; |
| 181 } |
| 182 |
| 183 bool isChildInsertion() const { return type == ElementInserted || type =
= NonElementInserted; } |
| 184 bool isChildRemoval() const { return type == ElementRemoved || type == N
onElementRemoved; } |
| 185 bool isChildElementChange() const { return type == ElementInserted || ty
pe == ElementRemoved; } |
| 186 |
161 ChildrenChangeType type; | 187 ChildrenChangeType type; |
162 RawPtrWillBeMember<Node> siblingBeforeChange; | 188 RawPtrWillBeMember<Node> siblingBeforeChange; |
163 RawPtrWillBeMember<Node> siblingAfterChange; | 189 RawPtrWillBeMember<Node> siblingAfterChange; |
164 ChildrenChangeSource byParser; | 190 ChildrenChangeSource byParser; |
165 }; | 191 }; |
166 | 192 |
167 // Notifies the node that it's list of children have changed (either by addi
ng or removing child nodes), or a child | 193 // Notifies the node that it's list of children have changed (either by addi
ng or removing child nodes), or a child |
168 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha
s changed its value. | 194 // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE ha
s changed its value. |
169 virtual void childrenChanged(const ChildrenChange&); | 195 virtual void childrenChanged(const ChildrenChange&); |
170 | 196 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) | 340 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) |
315 { | 341 { |
316 ASSERT(!nodes.size()); | 342 ASSERT(!nodes.size()); |
317 for (Node* child = node.firstChild(); child; child = child->nextSibling()) | 343 for (Node* child = node.firstChild(); child; child = child->nextSibling()) |
318 nodes.append(child); | 344 nodes.append(child); |
319 } | 345 } |
320 | 346 |
321 } // namespace blink | 347 } // namespace blink |
322 | 348 |
323 #endif // ContainerNode_h | 349 #endif // ContainerNode_h |
OLD | NEW |