| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void ParentDetails::didTraverseInsertionPoint(const InsertionPoint* insertionPoi
nt) | 47 void ParentDetails::didTraverseInsertionPoint(const InsertionPoint* insertionPoi
nt) |
| 48 { | 48 { |
| 49 if (!m_insertionPoint) { | 49 if (!m_insertionPoint) { |
| 50 m_insertionPoint = insertionPoint; | 50 m_insertionPoint = insertionPoint; |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 | 53 |
| 54 ContainerNode* parent(const Node& node, ParentDetails* details) | 54 ContainerNode* parent(const Node& node, ParentDetails* details) |
| 55 { | 55 { |
| 56 // TODO(hayato): Uncomment this once we can be sure LayoutTreeBuilderTravers
al::parent() is used only for a node in a document. | 56 // TODO(hayato): Uncomment this once we can be sure LayoutTreeBuilderTravers
al::parent() is used only for a node in a document. |
| 57 // ASSERT(node.inShadowIncludingDocument()); | 57 // DCHECK(node.inShadowIncludingDocument()); |
| 58 return FlatTreeTraversal::parent(node, details); | 58 return FlatTreeTraversal::parent(node, details); |
| 59 } | 59 } |
| 60 | 60 |
| 61 Node* nextSibling(const Node& node) | 61 Node* nextSibling(const Node& node) |
| 62 { | 62 { |
| 63 if (node.isBeforePseudoElement()) { | 63 if (node.isBeforePseudoElement()) { |
| 64 if (Node* next = FlatTreeTraversal::firstChild(*FlatTreeTraversal::paren
t(node))) | 64 if (Node* next = FlatTreeTraversal::firstChild(*FlatTreeTraversal::paren
t(node))) |
| 65 return next; | 65 return next; |
| 66 } else { | 66 } else { |
| 67 if (Node* next = FlatTreeTraversal::nextSibling(node)) | 67 if (Node* next = FlatTreeTraversal::nextSibling(node)) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (!first) | 179 if (!first) |
| 180 first = currentElement.pseudoElement(PseudoIdAfter); | 180 first = currentElement.pseudoElement(PseudoIdAfter); |
| 181 return first; | 181 return first; |
| 182 } | 182 } |
| 183 | 183 |
| 184 return firstChild(node); | 184 return firstChild(node); |
| 185 } | 185 } |
| 186 | 186 |
| 187 static Node* nextAncestorSibling(const Node& node, const Node* stayWithin) | 187 static Node* nextAncestorSibling(const Node& node, const Node* stayWithin) |
| 188 { | 188 { |
| 189 ASSERT(!pseudoAwareNextSibling(node)); | 189 DCHECK(!pseudoAwareNextSibling(node)); |
| 190 ASSERT(node != stayWithin); | 190 DCHECK_NE(node, stayWithin); |
| 191 for (Node* parentNode = parent(node); parentNode; parentNode = parent(*paren
tNode)) { | 191 for (Node* parentNode = parent(node); parentNode; parentNode = parent(*paren
tNode)) { |
| 192 if (parentNode == stayWithin) | 192 if (parentNode == stayWithin) |
| 193 return 0; | 193 return 0; |
| 194 if (Node* nextNode = pseudoAwareNextSibling(*parentNode)) | 194 if (Node* nextNode = pseudoAwareNextSibling(*parentNode)) |
| 195 return nextNode; | 195 return nextNode; |
| 196 } | 196 } |
| 197 return 0; | 197 return 0; |
| 198 } | 198 } |
| 199 | 199 |
| 200 Node* nextSkippingChildren(const Node& node, const Node* stayWithin) | 200 Node* nextSkippingChildren(const Node& node, const Node* stayWithin) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 return 0; | 233 return 0; |
| 234 } | 234 } |
| 235 | 235 |
| 236 LayoutObject* nextInTopLayer(const Element& element) | 236 LayoutObject* nextInTopLayer(const Element& element) |
| 237 { | 237 { |
| 238 if (!element.isInTopLayer()) | 238 if (!element.isInTopLayer()) |
| 239 return 0; | 239 return 0; |
| 240 const HeapVector<Member<Element>>& topLayerElements = element.document().top
LayerElements(); | 240 const HeapVector<Member<Element>>& topLayerElements = element.document().top
LayerElements(); |
| 241 size_t position = topLayerElements.find(&element); | 241 size_t position = topLayerElements.find(&element); |
| 242 ASSERT(position != kNotFound); | 242 DCHECK_NE(position, kNotFound); |
| 243 for (size_t i = position + 1; i < topLayerElements.size(); ++i) { | 243 for (size_t i = position + 1; i < topLayerElements.size(); ++i) { |
| 244 if (LayoutObject* layoutObject = topLayerElements[i]->layoutObject()) | 244 if (LayoutObject* layoutObject = topLayerElements[i]->layoutObject()) |
| 245 return layoutObject; | 245 return layoutObject; |
| 246 } | 246 } |
| 247 return 0; | 247 return 0; |
| 248 } | 248 } |
| 249 | 249 |
| 250 } // namespace LayoutTreeBuilderTraversal | 250 } // namespace LayoutTreeBuilderTraversal |
| 251 | 251 |
| 252 } // namespace blink | 252 } // namespace blink |
| OLD | NEW |