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