Chromium Code Reviews| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 88 // Composed tree version of |Node::nodeIndex()|. This function returns a | 88 // Composed tree version of |Node::nodeIndex()|. This function returns a |
| 89 // zero base position number of the specified node in child nodes list, or | 89 // zero base position number of the specified node in child nodes list, or |
| 90 // zero if the specified node has no parent. | 90 // zero if the specified node has no parent. |
| 91 static unsigned index(const Node&); | 91 static unsigned index(const Node&); |
| 92 | 92 |
| 93 // Composed tree version of |ContainerNode::countChildren()|. This function | 93 // Composed tree version of |ContainerNode::countChildren()|. This function |
| 94 // returns the number of the child nodes of the specified node in the | 94 // returns the number of the child nodes of the specified node in the |
| 95 // composed tree. | 95 // composed tree. |
| 96 static unsigned countChildren(const Node&); | 96 static unsigned countChildren(const Node&); |
| 97 | 97 |
| 98 static Node* lastWithin(const Node&); | |
| 99 static Node& lastWithinOrSelf(Node&); | |
|
hayato
2015/03/26 03:28:27
Input |Node&| can't be |const Node&|?
I guess our
hajimehoshi
2015/03/26 03:37:18
As you mentioned, I was worried the case when this
hajimehoshi
2015/03/26 03:43:26
Done.
| |
| 100 | |
| 98 private: | 101 private: |
| 99 enum TraversalDirection { | 102 enum TraversalDirection { |
| 100 TraversalDirectionForward, | 103 TraversalDirectionForward, |
| 101 TraversalDirectionBackward | 104 TraversalDirectionBackward |
| 102 }; | 105 }; |
| 103 | 106 |
| 104 static void assertPrecondition(const Node& node) | 107 static void assertPrecondition(const Node& node) |
| 105 { | 108 { |
| 106 #if ENABLE(ASSERT) | 109 #if ENABLE(ASSERT) |
| 107 ASSERT(node.inDocument() ? !node.document().childNeedsDistributionRecalc () : !node.childNeedsDistributionRecalc()); | 110 ASSERT(node.inDocument() ? !node.document().childNeedsDistributionRecalc () : !node.childNeedsDistributionRecalc()); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 } | 246 } |
| 244 | 247 |
| 245 inline Node* ComposedTreeTraversal::traverseLastChild(const Node& node) | 248 inline Node* ComposedTreeTraversal::traverseLastChild(const Node& node) |
| 246 { | 249 { |
| 247 return traverseChild(node, TraversalDirectionBackward); | 250 return traverseChild(node, TraversalDirectionBackward); |
| 248 } | 251 } |
| 249 | 252 |
| 250 } // namespace | 253 } // namespace |
| 251 | 254 |
| 252 #endif | 255 #endif |
| OLD | NEW |