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