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 23 matching lines...) Expand all Loading... |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 static inline ElementShadow* shadowFor(const Node& node) | 36 static inline ElementShadow* shadowFor(const Node& node) |
37 { | 37 { |
38 return node.isElementNode() ? toElement(node).shadow() : 0; | 38 return node.isElementNode() ? toElement(node).shadow() : 0; |
39 } | 39 } |
40 | 40 |
41 Node* ComposedTreeTraversal::traverseChild(const Node& node, TraversalDirection
direction) | 41 Node* ComposedTreeTraversal::traverseChild(const Node& node, TraversalDirection
direction) |
42 { | 42 { |
43 ElementShadow* shadow = shadowFor(node); | 43 ElementShadow* shadow = shadowFor(node); |
44 return shadow ? traverseLightChildren(*shadow->youngestShadowRoot(), directi
on) | 44 return shadow ? traverseLightChildren(shadow->youngestShadowRoot(), directio
n) |
45 : traverseLightChildren(node, direction); | 45 : traverseLightChildren(node, direction); |
46 } | 46 } |
47 | 47 |
48 Node* ComposedTreeTraversal::traverseLightChildren(const Node& node, TraversalDi
rection direction) | 48 Node* ComposedTreeTraversal::traverseLightChildren(const Node& node, TraversalDi
rection direction) |
49 { | 49 { |
50 return traverseSiblings(direction == TraversalDirectionForward ? node.firstC
hild() : node.lastChild(), direction); | 50 return traverseSiblings(direction == TraversalDirectionForward ? node.firstC
hild() : node.lastChild(), direction); |
51 } | 51 } |
52 | 52 |
53 Node* ComposedTreeTraversal::traverseSiblings(const Node* node, TraversalDirecti
on direction) | 53 Node* ComposedTreeTraversal::traverseSiblings(const Node* node, TraversalDirecti
on direction) |
54 { | 54 { |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 Node& ComposedTreeTraversal::lastWithinOrSelf(const Node& node) | 300 Node& ComposedTreeTraversal::lastWithinOrSelf(const Node& node) |
301 { | 301 { |
302 assertPrecondition(node); | 302 assertPrecondition(node); |
303 Node* lastDescendant = lastWithin(node); | 303 Node* lastDescendant = lastWithin(node); |
304 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); | 304 Node& result = lastDescendant ? *lastDescendant : const_cast<Node&>(node); |
305 assertPostcondition(&result); | 305 assertPostcondition(&result); |
306 return result; | 306 return result; |
307 } | 307 } |
308 | 308 |
309 } // namespace | 309 } // namespace |
OLD | NEW |