Chromium Code Reviews| 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 isElementChange() const { return type == ElementInserted || type == ElementRemoved; } | |
|
esprehn
2014/07/28 22:02:30
I don't think this is correct, if everything was r
Inactive
2014/07/28 22:23:28
You are right that in case all children were remov
| |
| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 inline void getChildNodes(Node& node, NodeVector& nodes) | 345 inline void getChildNodes(Node& node, NodeVector& nodes) |
| 320 { | 346 { |
| 321 ASSERT(!nodes.size()); | 347 ASSERT(!nodes.size()); |
| 322 for (Node* child = node.firstChild(); child; child = child->nextSibling()) | 348 for (Node* child = node.firstChild(); child; child = child->nextSibling()) |
| 323 nodes.append(child); | 349 nodes.append(child); |
| 324 } | 350 } |
| 325 | 351 |
| 326 } // namespace WebCore | 352 } // namespace WebCore |
| 327 | 353 |
| 328 #endif // ContainerNode_h | 354 #endif // ContainerNode_h |
| OLD | NEW |