OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NthIndexCache_h | 5 #ifndef NthIndexCache_h |
6 #define NthIndexCache_h | 6 #define NthIndexCache_h |
7 | 7 |
| 8 #include "core/CoreExport.h" |
8 #include "core/dom/Element.h" | 9 #include "core/dom/Element.h" |
9 #include "core/dom/ElementTraversal.h" | 10 #include "core/dom/ElementTraversal.h" |
10 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
11 #include "wtf/HashMap.h" | 12 #include "wtf/HashMap.h" |
12 #include "wtf/OwnPtr.h" | 13 #include "wtf/OwnPtr.h" |
13 #include "wtf/RefPtr.h" | 14 #include "wtf/RefPtr.h" |
14 | 15 |
15 namespace blink { | 16 namespace blink { |
16 | 17 |
17 class Document; | 18 class Document; |
18 | 19 |
19 class NthIndexCache final { | 20 class CORE_EXPORT NthIndexCache final { |
20 STACK_ALLOCATED(); | 21 STACK_ALLOCATED(); |
21 WTF_MAKE_NONCOPYABLE(NthIndexCache); | 22 WTF_MAKE_NONCOPYABLE(NthIndexCache); |
22 public: | 23 public: |
23 explicit NthIndexCache(Document&); | 24 explicit NthIndexCache(Document&); |
24 ~NthIndexCache(); | 25 ~NthIndexCache(); |
25 | 26 |
26 inline unsigned nthChildIndex(Element&); | 27 inline unsigned nthChildIndex(Element&); |
27 inline unsigned nthLastChildIndex(Element&); | 28 inline unsigned nthLastChildIndex(Element&); |
28 | 29 |
29 private: | 30 private: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 83 |
83 inline unsigned NthIndexCache::nthLastChildIndex(Element& element) | 84 inline unsigned NthIndexCache::nthLastChildIndex(Element& element) |
84 { | 85 { |
85 ASSERT(element.parentNode()); | 86 ASSERT(element.parentNode()); |
86 return ensureNthIndexDataFor(*element.parentNode()).nthLastIndex(element); | 87 return ensureNthIndexDataFor(*element.parentNode()).nthLastIndex(element); |
87 } | 88 } |
88 | 89 |
89 } // namespace blink | 90 } // namespace blink |
90 | 91 |
91 #endif // NthIndexCache_h | 92 #endif // NthIndexCache_h |
OLD | NEW |