| 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 12 matching lines...) Expand all Loading... |
| 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/dom/NodeRenderingTraversal.h" | 28 #include "core/dom/NodeRenderingTraversal.h" |
| 29 | 29 |
| 30 #include "core/HTMLNames.h" | 30 #include "core/HTMLNames.h" |
| 31 #include "core/dom/PseudoElement.h" | 31 #include "core/dom/PseudoElement.h" |
| 32 #include "core/dom/shadow/ComposedTreeTraversal.h" | 32 #include "core/dom/shadow/ComposedTreeTraversal.h" |
| 33 #include "core/rendering/RenderObject.h" | 33 #include "core/layout/LayoutObject.h" |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 namespace NodeRenderingTraversal { | 37 namespace NodeRenderingTraversal { |
| 38 | 38 |
| 39 static bool isRendererReparented(const RenderObject* renderer) | 39 static bool isRendererReparented(const LayoutObject* renderer) |
| 40 { | 40 { |
| 41 if (!renderer->node()->isElementNode()) | 41 if (!renderer->node()->isElementNode()) |
| 42 return false; | 42 return false; |
| 43 if (toElement(renderer->node())->isInTopLayer()) | 43 if (toElement(renderer->node())->isInTopLayer()) |
| 44 return true; | 44 return true; |
| 45 return false; | 45 return false; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void ParentDetails::didTraverseInsertionPoint(const InsertionPoint* insertionPoi
nt) | 48 void ParentDetails::didTraverseInsertionPoint(const InsertionPoint* insertionPoi
nt) |
| 49 { | 49 { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return nextAncestorSibling(node, stayWithin); | 218 return nextAncestorSibling(node, stayWithin); |
| 219 } | 219 } |
| 220 | 220 |
| 221 Node* next(const Node& node, const Node* stayWithin) | 221 Node* next(const Node& node, const Node* stayWithin) |
| 222 { | 222 { |
| 223 if (Node* child = pseudoAwareFirstChild(node)) | 223 if (Node* child = pseudoAwareFirstChild(node)) |
| 224 return child; | 224 return child; |
| 225 return nextSkippingChildren(node, stayWithin); | 225 return nextSkippingChildren(node, stayWithin); |
| 226 } | 226 } |
| 227 | 227 |
| 228 RenderObject* nextSiblingRenderer(const Node& node) | 228 LayoutObject* nextSiblingRenderer(const Node& node) |
| 229 { | 229 { |
| 230 for (Node* sibling = NodeRenderingTraversal::nextSibling(node); sibling; sib
ling = NodeRenderingTraversal::nextSibling(*sibling)) { | 230 for (Node* sibling = NodeRenderingTraversal::nextSibling(node); sibling; sib
ling = NodeRenderingTraversal::nextSibling(*sibling)) { |
| 231 RenderObject* renderer = sibling->renderer(); | 231 LayoutObject* renderer = sibling->renderer(); |
| 232 if (renderer && !isRendererReparented(renderer)) | 232 if (renderer && !isRendererReparented(renderer)) |
| 233 return renderer; | 233 return renderer; |
| 234 } | 234 } |
| 235 return 0; | 235 return 0; |
| 236 } | 236 } |
| 237 | 237 |
| 238 RenderObject* previousSiblingRenderer(const Node& node) | 238 LayoutObject* previousSiblingRenderer(const Node& node) |
| 239 { | 239 { |
| 240 for (Node* sibling = NodeRenderingTraversal::previousSibling(node); sibling;
sibling = NodeRenderingTraversal::previousSibling(*sibling)) { | 240 for (Node* sibling = NodeRenderingTraversal::previousSibling(node); sibling;
sibling = NodeRenderingTraversal::previousSibling(*sibling)) { |
| 241 RenderObject* renderer = sibling->renderer(); | 241 LayoutObject* renderer = sibling->renderer(); |
| 242 if (renderer && !isRendererReparented(renderer)) | 242 if (renderer && !isRendererReparented(renderer)) |
| 243 return renderer; | 243 return renderer; |
| 244 } | 244 } |
| 245 return 0; | 245 return 0; |
| 246 } | 246 } |
| 247 | 247 |
| 248 RenderObject* nextInTopLayer(const Element& element) | 248 LayoutObject* nextInTopLayer(const Element& element) |
| 249 { | 249 { |
| 250 if (!element.isInTopLayer()) | 250 if (!element.isInTopLayer()) |
| 251 return 0; | 251 return 0; |
| 252 const WillBeHeapVector<RefPtrWillBeMember<Element> >& topLayerElements = ele
ment.document().topLayerElements(); | 252 const WillBeHeapVector<RefPtrWillBeMember<Element> >& topLayerElements = ele
ment.document().topLayerElements(); |
| 253 size_t position = topLayerElements.find(&element); | 253 size_t position = topLayerElements.find(&element); |
| 254 ASSERT(position != kNotFound); | 254 ASSERT(position != kNotFound); |
| 255 for (size_t i = position + 1; i < topLayerElements.size(); ++i) { | 255 for (size_t i = position + 1; i < topLayerElements.size(); ++i) { |
| 256 if (RenderObject* renderer = topLayerElements[i]->renderer()) | 256 if (LayoutObject* renderer = topLayerElements[i]->renderer()) |
| 257 return renderer; | 257 return renderer; |
| 258 } | 258 } |
| 259 return 0; | 259 return 0; |
| 260 } | 260 } |
| 261 | 261 |
| 262 } | 262 } |
| 263 | 263 |
| 264 } // namespace | 264 } // namespace |
| OLD | NEW |