| 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/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/ElementTraversal.h" | 9 #include "core/dom/ElementTraversal.h" |
| 10 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 unsigned cacheNthIndices(Element&); | 39 unsigned cacheNthIndices(Element&); |
| 40 | 40 |
| 41 WillBeHeapHashMap<RawPtrWillBeMember<Element>, unsigned> m_elementIndexM
ap; | 41 WillBeHeapHashMap<RawPtrWillBeMember<Element>, unsigned> m_elementIndexM
ap; |
| 42 unsigned m_count = 0; | 42 unsigned m_count = 0; |
| 43 | 43 |
| 44 DECLARE_TRACE(); | 44 DECLARE_TRACE(); |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 NthIndexData& ensureNthIndexDataFor(Node&); | 47 NthIndexData& ensureNthIndexDataFor(Node&); |
| 48 inline unsigned nthIndex(Element&); | |
| 49 | 48 |
| 50 using ParentMap = WillBeHeapHashMap<RefPtrWillBeMember<Node>, OwnPtrWillBeMe
mber<NthIndexData>>; | 49 using ParentMap = WillBeHeapHashMap<RefPtrWillBeMember<Node>, OwnPtrWillBeMe
mber<NthIndexData>>; |
| 51 | 50 |
| 52 OwnPtrWillBeMember<ParentMap> m_parentMap; | 51 OwnPtrWillBeMember<ParentMap> m_parentMap; |
| 53 RawPtrWillBeMember<Document> m_document; | 52 RawPtrWillBeMember<Document> m_document; |
| 54 uint64_t m_domTreeVersion; | 53 uint64_t m_domTreeVersion; |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 inline unsigned NthIndexCache::NthIndexData::nthIndex(Element& element) | 56 inline unsigned NthIndexCache::NthIndexData::nthIndex(Element& element) |
| 58 { | 57 { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 82 | 81 |
| 83 inline unsigned NthIndexCache::nthLastChildIndex(Element& element) | 82 inline unsigned NthIndexCache::nthLastChildIndex(Element& element) |
| 84 { | 83 { |
| 85 ASSERT(element.parentNode()); | 84 ASSERT(element.parentNode()); |
| 86 return ensureNthIndexDataFor(*element.parentNode()).nthLastIndex(element); | 85 return ensureNthIndexDataFor(*element.parentNode()).nthLastIndex(element); |
| 87 } | 86 } |
| 88 | 87 |
| 89 } // namespace blink | 88 } // namespace blink |
| 90 | 89 |
| 91 #endif // NthIndexCache_h | 90 #endif // NthIndexCache_h |
| OLD | NEW |