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 { |
rune
2016/11/08 13:26:49
Any particular reason you started using class inst
emilio
2016/11/08 15:43:02
Yup, otherwise I needed to `CORE_EXPORT` every fun
| |
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* = 0); |
54 return m_insertionPoint == other.m_insertionPoint; | 61 static Node* firstChild(const Node&); |
62 static Node* nextSibling(const Node&); | |
63 static LayoutObject* parentLayoutObject(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* nextSiblingLayoutObject( | |
69 const Node&, | |
70 int32_t limit = kTraverseAllSiblings); | |
71 static LayoutObject* previousSiblingLayoutObject( | |
72 const Node&, | |
73 int32_t limit = kTraverseAllSiblings); | |
74 static LayoutObject* nextInTopLayer(const Element&); | |
75 | |
76 static inline Element* parentElement(const Node& node) { | |
77 ContainerNode* found = parent(node); | |
78 return found && found->isElementNode() ? toElement(found) : 0; | |
55 } | 79 } |
56 | |
57 private: | |
58 Member<const InsertionPoint> m_insertionPoint; | |
59 }; | 80 }; |
60 | 81 |
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 | 82 } // namespace blink |
82 | 83 |
83 #endif | 84 #endif |
OLD | NEW |