| 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 19 matching lines...) Expand all Loading... |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "core/dom/LayoutTreeBuilderTraversal.h" | 32 #include "core/dom/LayoutTreeBuilderTraversal.h" |
| 33 #include "core/dom/shadow/InsertionPoint.h" | 33 #include "core/dom/shadow/InsertionPoint.h" |
| 34 #include "core/dom/shadow/ShadowRoot.h" | 34 #include "core/dom/shadow/ShadowRoot.h" |
| 35 #include "wtf/Allocator.h" | 35 #include "wtf/Allocator.h" |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class ContainerNode; | 39 class ContainerNode; |
| 40 class HTMLSlotElement; |
| 40 class Node; | 41 class Node; |
| 41 | 42 |
| 42 // Composed tree version of |NodeTraversal|. | 43 // Composed tree version of |NodeTraversal|. |
| 43 // | 44 // |
| 44 // None of member functions takes a |ShadowRoot| or an active insertion point, | 45 // None of member functions takes a |ShadowRoot| or an active insertion point, |
| 45 // e.g. roughly speaking <content> and <shadow> in the shadow tree, see | 46 // e.g. roughly speaking <content> and <shadow> in the shadow tree, see |
| 46 // |InsertionPoint::isActive()| for details of active insertion points, since | 47 // |InsertionPoint::isActive()| for details of active insertion points, since |
| 47 // they aren't appeared in the composed tree. |assertPrecondition()| and | 48 // they aren't appeared in the composed tree. |assertPrecondition()| and |
| 48 // |assertPostCondition()| check this condition. | 49 // |assertPostCondition()| check this condition. |
| 49 // | 50 // |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 133 |
| 133 static void assertPostcondition(const Node* node) | 134 static void assertPostcondition(const Node* node) |
| 134 { | 135 { |
| 135 #if ENABLE(ASSERT) | 136 #if ENABLE(ASSERT) |
| 136 if (node) | 137 if (node) |
| 137 assertPrecondition(*node); | 138 assertPrecondition(*node); |
| 138 #endif | 139 #endif |
| 139 } | 140 } |
| 140 | 141 |
| 141 static Node* resolveDistributionStartingAt(const Node*, TraversalDirection); | 142 static Node* resolveDistributionStartingAt(const Node*, TraversalDirection); |
| 143 static Node* v1ResolveDistributionStartingAt(const Node&, TraversalDirection
); |
| 144 static Node* v0ResolveDistributionStartingAt(const Node&, TraversalDirection
); |
| 142 | 145 |
| 143 static Node* traverseNext(const Node&); | 146 static Node* traverseNext(const Node&); |
| 144 static Node* traverseNext(const Node&, const Node* stayWithin); | 147 static Node* traverseNext(const Node&, const Node* stayWithin); |
| 145 static Node* traverseNextSkippingChildren(const Node&, const Node* stayWithi
n); | 148 static Node* traverseNextSkippingChildren(const Node&, const Node* stayWithi
n); |
| 146 static Node* traversePrevious(const Node&); | 149 static Node* traversePrevious(const Node&); |
| 147 | 150 |
| 148 static Node* traverseFirstChild(const Node&); | 151 static Node* traverseFirstChild(const Node&); |
| 149 static Node* traverseLastChild(const Node&); | 152 static Node* traverseLastChild(const Node&); |
| 150 static Node* traverseChild(const Node&, TraversalDirection); | 153 static Node* traverseChild(const Node&, TraversalDirection); |
| 151 | 154 |
| 152 static ContainerNode* traverseParent(const Node&, ParentTraversalDetails* =
0); | 155 static ContainerNode* traverseParent(const Node&, ParentTraversalDetails* =
0); |
| 156 // TODO(hayato): Make ParentTraversalDetails be aware of slot elements too. |
| 157 static ContainerNode* v1TraverseParent(const Node&); |
| 158 static ContainerNode* v0TraverseParent(const Node&, ParentTraversalDetails*
= 0); |
| 153 | 159 |
| 154 static Node* traverseNextSibling(const Node&); | 160 static Node* traverseNextSibling(const Node&); |
| 155 static Node* traversePreviousSibling(const Node&); | 161 static Node* traversePreviousSibling(const Node&); |
| 156 | 162 |
| 157 static Node* traverseSiblings(const Node&, TraversalDirection); | 163 static Node* traverseSiblings(const Node&, TraversalDirection); |
| 164 static Node* v1TraverseSiblings(const Node&, TraversalDirection); |
| 165 static Node* v0TraverseSiblings(const Node&, TraversalDirection); |
| 166 |
| 158 static Node* traverseSiblingsOrShadowInsertionPointSiblings(const Node&, Tra
versalDirection); | 167 static Node* traverseSiblingsOrShadowInsertionPointSiblings(const Node&, Tra
versalDirection); |
| 159 | 168 |
| 160 static ContainerNode* traverseParentOrHost(const Node&); | 169 static ContainerNode* traverseParentOrHost(const Node&); |
| 161 static Node* traverseNextAncestorSibling(const Node&); | 170 static Node* traverseNextAncestorSibling(const Node&); |
| 162 static Node* traversePreviousAncestorSibling(const Node&); | 171 static Node* traversePreviousAncestorSibling(const Node&); |
| 163 }; | 172 }; |
| 164 | 173 |
| 165 inline ContainerNode* ComposedTreeTraversal::parent(const Node& node, ParentTrav
ersalDetails* details) | 174 inline ContainerNode* ComposedTreeTraversal::parent(const Node& node, ParentTrav
ersalDetails* details) |
| 166 { | 175 { |
| 167 assertPrecondition(node); | 176 assertPrecondition(node); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 309 } |
| 301 | 310 |
| 302 inline Node* ComposedTreeTraversal::traverseLastChild(const Node& node) | 311 inline Node* ComposedTreeTraversal::traverseLastChild(const Node& node) |
| 303 { | 312 { |
| 304 return traverseChild(node, TraversalDirectionBackward); | 313 return traverseChild(node, TraversalDirectionBackward); |
| 305 } | 314 } |
| 306 | 315 |
| 307 } // namespace | 316 } // namespace |
| 308 | 317 |
| 309 #endif | 318 #endif |
| OLD | NEW |