| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Neither the name of Google Inc. nor the names of its | 10 * * Neither the name of Google Inc. nor the names of its |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 281 } |
| 282 return false; | 282 return false; |
| 283 } | 283 } |
| 284 | 284 |
| 285 Node* FlatTreeTraversal::previousSkippingChildren(const Node& node) { | 285 Node* FlatTreeTraversal::previousSkippingChildren(const Node& node) { |
| 286 if (Node* previousSibling = traversePreviousSibling(node)) | 286 if (Node* previousSibling = traversePreviousSibling(node)) |
| 287 return previousSibling; | 287 return previousSibling; |
| 288 return traversePreviousAncestorSibling(node); | 288 return traversePreviousAncestorSibling(node); |
| 289 } | 289 } |
| 290 | 290 |
| 291 static Node* previousAncestorSiblingPostOrder(const Node& current, | 291 Node* FlatTreeTraversal::previousAncestorSiblingPostOrder( |
| 292 const Node* stayWithin) { | 292 const Node& current, |
| 293 const Node* stayWithin) { |
| 293 DCHECK(!FlatTreeTraversal::previousSibling(current)); | 294 DCHECK(!FlatTreeTraversal::previousSibling(current)); |
| 294 for (Node* parent = FlatTreeTraversal::parent(current); parent; | 295 for (Node* parent = FlatTreeTraversal::parent(current); parent; |
| 295 parent = FlatTreeTraversal::parent(*parent)) { | 296 parent = FlatTreeTraversal::parent(*parent)) { |
| 296 if (parent == stayWithin) | 297 if (parent == stayWithin) |
| 297 return nullptr; | 298 return nullptr; |
| 298 if (Node* previousSibling = FlatTreeTraversal::previousSibling(*parent)) | 299 if (Node* previousSibling = FlatTreeTraversal::previousSibling(*parent)) |
| 299 return previousSibling; | 300 return previousSibling; |
| 300 } | 301 } |
| 301 return nullptr; | 302 return nullptr; |
| 302 } | 303 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 393 |
| 393 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { | 394 Node& FlatTreeTraversal::lastWithinOrSelf(const Node& node) { |
| 394 assertPrecondition(node); | 395 assertPrecondition(node); |
| 395 Node* lastDescendant = lastWithin(node); | 396 Node* lastDescendant = lastWithin(node); |
| 396 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); | 397 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); |
| 397 assertPostcondition(&result); | 398 assertPostcondition(&result); |
| 398 return result; | 399 return result; |
| 399 } | 400 } |
| 400 | 401 |
| 401 } // namespace blink | 402 } // namespace blink |
| OLD | NEW |