| 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 | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010, 2011, 2013 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 }; | 258 }; |
| 259 enum ChildrenChangeSource { | 259 enum ChildrenChangeSource { |
| 260 ChildrenChangeSourceAPI, | 260 ChildrenChangeSourceAPI, |
| 261 ChildrenChangeSourceParser | 261 ChildrenChangeSourceParser |
| 262 }; | 262 }; |
| 263 struct ChildrenChange { | 263 struct ChildrenChange { |
| 264 STACK_ALLOCATED(); | 264 STACK_ALLOCATED(); |
| 265 | 265 |
| 266 public: | 266 public: |
| 267 static ChildrenChange forInsertion(Node& node, | 267 static ChildrenChange forInsertion(Node& node, |
| 268 Node* unchangedPrevious, |
| 269 Node* unchangedNext, |
| 268 ChildrenChangeSource byParser) { | 270 ChildrenChangeSource byParser) { |
| 269 ChildrenChange change = { | 271 ChildrenChange change = { |
| 270 node.isElementNode() ? ElementInserted : NonElementInserted, &node, | 272 node.isElementNode() ? ElementInserted : NonElementInserted, &node, |
| 271 node.previousSibling(), node.nextSibling(), byParser}; | 273 unchangedPrevious, unchangedNext, byParser}; |
| 272 return change; | 274 return change; |
| 273 } | 275 } |
| 274 | 276 |
| 275 static ChildrenChange forRemoval(Node& node, | 277 static ChildrenChange forRemoval(Node& node, |
| 276 Node* previousSibling, | 278 Node* previousSibling, |
| 277 Node* nextSibling, | 279 Node* nextSibling, |
| 278 ChildrenChangeSource byParser) { | 280 ChildrenChangeSource byParser) { |
| 279 ChildrenChange change = { | 281 ChildrenChange change = { |
| 280 node.isElementNode() ? ElementRemoved : NonElementRemoved, &node, | 282 node.isElementNode() ? ElementRemoved : NonElementRemoved, &node, |
| 281 previousSibling, nextSibling, byParser}; | 283 previousSibling, nextSibling, byParser}; |
| 282 return change; | 284 return change; |
| 283 } | 285 } |
| 284 | 286 |
| 285 bool isChildInsertion() const { | 287 bool isChildInsertion() const { |
| 286 return type == ElementInserted || type == NonElementInserted; | 288 return type == ElementInserted || type == NonElementInserted; |
| 287 } | 289 } |
| 288 bool isChildRemoval() const { | 290 bool isChildRemoval() const { |
| 289 return type == ElementRemoved || type == NonElementRemoved; | 291 return type == ElementRemoved || type == NonElementRemoved; |
| 290 } | 292 } |
| 291 bool isChildElementChange() const { | 293 bool isChildElementChange() const { |
| 292 return type == ElementInserted || type == ElementRemoved; | 294 return type == ElementInserted || type == ElementRemoved; |
| 293 } | 295 } |
| 294 | 296 |
| 295 ChildrenChangeType type; | 297 ChildrenChangeType type; |
| 296 Member<Node> siblingChanged; | 298 Member<Node> siblingChanged; |
| 299 // |siblingBeforeChange| is |
| 300 // - siblingChanged.previousSibling before node removal |
| 301 // - siblingChanged.previousSibling after single node insertion |
| 302 // - previousSibling of the first inserted node after multiple node |
| 303 // insertion |
| 297 Member<Node> siblingBeforeChange; | 304 Member<Node> siblingBeforeChange; |
| 305 // |siblingAfterChange| is |
| 306 // - siblingChanged.nextSibling before node removal |
| 307 // - siblingChanged.nextSibling after single node insertion |
| 308 // - nextSibling of the last inserted node after multiple node insertion. |
| 298 Member<Node> siblingAfterChange; | 309 Member<Node> siblingAfterChange; |
| 299 ChildrenChangeSource byParser; | 310 ChildrenChangeSource byParser; |
| 300 }; | 311 }; |
| 301 | 312 |
| 302 // Notifies the node that it's list of children have changed (either by adding | 313 // Notifies the node that it's list of children have changed (either by adding |
| 303 // or removing child nodes), or a child node that is of the type | 314 // or removing child nodes), or a child node that is of the type |
| 304 // CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value. | 315 // CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value. |
| 305 virtual void childrenChanged(const ChildrenChange&); | 316 virtual void childrenChanged(const ChildrenChange&); |
| 306 | 317 |
| 307 DECLARE_VIRTUAL_TRACE(); | 318 DECLARE_VIRTUAL_TRACE(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 471 |
| 461 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) { | 472 inline void getChildNodes(ContainerNode& node, NodeVector& nodes) { |
| 462 DCHECK(!nodes.size()); | 473 DCHECK(!nodes.size()); |
| 463 for (Node* child = node.firstChild(); child; child = child->nextSibling()) | 474 for (Node* child = node.firstChild(); child; child = child->nextSibling()) |
| 464 nodes.push_back(child); | 475 nodes.push_back(child); |
| 465 } | 476 } |
| 466 | 477 |
| 467 } // namespace blink | 478 } // namespace blink |
| 468 | 479 |
| 469 #endif // ContainerNode_h | 480 #endif // ContainerNode_h |
| OLD | NEW |