| 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 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 #include "core/CoreExport.h" | 30 #include "core/CoreExport.h" |
| 31 #include "core/dom/Element.h" | 31 #include "core/dom/Element.h" |
| 32 #include "core/dom/shadow/InsertionPoint.h" | 32 #include "core/dom/shadow/InsertionPoint.h" |
| 33 #include <cstdint> | 33 #include <cstdint> |
| 34 | 34 |
| 35 namespace blink { | 35 namespace blink { |
| 36 | 36 |
| 37 class LayoutObject; | 37 class LayoutObject; |
| 38 | 38 |
| 39 namespace LayoutTreeBuilderTraversal { | 39 class CORE_EXPORT LayoutTreeBuilderTraversal { |
| 40 public: |
| 41 static const int32_t kTraverseAllSiblings = -2; |
| 42 class ParentDetails { |
| 43 STACK_ALLOCATED(); |
| 40 | 44 |
| 41 const int32_t kTraverseAllSiblings = -2; | 45 public: |
| 46 ParentDetails() : m_insertionPoint(nullptr) {} |
| 42 | 47 |
| 43 class ParentDetails { | 48 const InsertionPoint* insertionPoint() const { return m_insertionPoint; } |
| 44 STACK_ALLOCATED(); | |
| 45 | 49 |
| 46 public: | 50 void didTraverseInsertionPoint(const InsertionPoint*); |
| 47 ParentDetails() : m_insertionPoint(nullptr) {} | |
| 48 | 51 |
| 49 const InsertionPoint* insertionPoint() const { return m_insertionPoint; } | 52 bool operator==(const ParentDetails& other) { |
| 53 return m_insertionPoint == other.m_insertionPoint; |
| 54 } |
| 50 | 55 |
| 51 void didTraverseInsertionPoint(const InsertionPoint*); | 56 private: |
| 57 Member<const InsertionPoint> m_insertionPoint; |
| 58 }; |
| 52 | 59 |
| 53 bool operator==(const ParentDetails& other) { | 60 static ContainerNode* parent(const Node&, ParentDetails* = nullptr); |
| 54 return m_insertionPoint == other.m_insertionPoint; | 61 static ContainerNode* layoutParent(const Node&, ParentDetails* = nullptr); |
| 62 static Node* firstChild(const Node&); |
| 63 static Node* nextSibling(const Node&); |
| 64 static Node* previousSibling(const Node&); |
| 65 static Node* previous(const Node&, const Node* stayWithin); |
| 66 static Node* next(const Node&, const Node* stayWithin); |
| 67 static Node* nextSkippingChildren(const Node&, const Node* stayWithin); |
| 68 static LayoutObject* parentLayoutObject(const Node&); |
| 69 static LayoutObject* nextSiblingLayoutObject( |
| 70 const Node&, |
| 71 int32_t limit = kTraverseAllSiblings); |
| 72 static LayoutObject* previousSiblingLayoutObject( |
| 73 const Node&, |
| 74 int32_t limit = kTraverseAllSiblings); |
| 75 static LayoutObject* nextInTopLayer(const Element&); |
| 76 |
| 77 static inline Element* parentElement(const Node& node) { |
| 78 ContainerNode* found = parent(node); |
| 79 return found && found->isElementNode() ? toElement(found) : 0; |
| 55 } | 80 } |
| 56 | |
| 57 private: | |
| 58 Member<const InsertionPoint> m_insertionPoint; | |
| 59 }; | 81 }; |
| 60 | 82 |
| 61 CORE_EXPORT ContainerNode* parent(const Node&, ParentDetails* = 0); | |
| 62 CORE_EXPORT Node* firstChild(const Node&); | |
| 63 CORE_EXPORT Node* nextSibling(const Node&); | |
| 64 Node* previousSibling(const Node&); | |
| 65 Node* previous(const Node&, const Node* stayWithin); | |
| 66 Node* next(const Node&, const Node* stayWithin); | |
| 67 Node* nextSkippingChildren(const Node&, const Node* stayWithin); | |
| 68 LayoutObject* nextSiblingLayoutObject(const Node&, | |
| 69 int32_t limit = kTraverseAllSiblings); | |
| 70 LayoutObject* previousSiblingLayoutObject(const Node&, | |
| 71 int32_t limit = kTraverseAllSiblings); | |
| 72 LayoutObject* nextInTopLayer(const Element&); | |
| 73 | |
| 74 inline Element* parentElement(const Node& node) { | |
| 75 ContainerNode* found = parent(node); | |
| 76 return found && found->isElementNode() ? toElement(found) : 0; | |
| 77 } | |
| 78 | |
| 79 } // namespace LayoutTreeBuilderTraversal | |
| 80 | |
| 81 } // namespace blink | 83 } // namespace blink |
| 82 | 84 |
| 83 #endif | 85 #endif |
| OLD | NEW |