OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r
ights reserved. | 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All r
ights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 Element* traverseFirstElement(unsigned& offsetInArray, ContainerNode* root)
const; | 69 Element* traverseFirstElement(unsigned& offsetInArray, ContainerNode* root)
const; |
70 Element* traverseForwardToOffset(unsigned offset, Element* currentElement, u
nsigned& currentOffset, unsigned& offsetInArray, ContainerNode* root) const; | 70 Element* traverseForwardToOffset(unsigned offset, Element* currentElement, u
nsigned& currentOffset, unsigned& offsetInArray, ContainerNode* root) const; |
71 | 71 |
72 virtual void trace(Visitor*); | 72 virtual void trace(Visitor*); |
73 | 73 |
74 protected: | 74 protected: |
75 HTMLCollection(Node* base, CollectionType, ItemAfterOverrideType); | 75 HTMLCollection(Node* base, CollectionType, ItemAfterOverrideType); |
76 | 76 |
77 virtual void updateNameCache() const; | 77 virtual void updateNameCache() const; |
78 | 78 |
79 // FIXME(oilpan): Move NodeList to the heap and visit members in NodeCacheMa
p. | |
80 // See more discussion in https://codereview.chromium.org/23005018/ | |
81 typedef HashMap<AtomicStringImpl*, Member<HeapVector<Member<Element> > > > N
odeCacheMap; | 79 typedef HashMap<AtomicStringImpl*, Member<HeapVector<Member<Element> > > > N
odeCacheMap; |
82 HeapVector<Member<Element> >* idCache(const AtomicString& name) const { retu
rn m_idCache.get(name.impl()); } | 80 HeapVector<Member<Element> >* idCache(const AtomicString& name) const { retu
rn m_idCache.get(name.impl()); } |
83 HeapVector<Member<Element> >* nameCache(const AtomicString& name) const { re
turn m_nameCache.get(name.impl()); } | 81 HeapVector<Member<Element> >* nameCache(const AtomicString& name) const { re
turn m_nameCache.get(name.impl()); } |
84 void appendIdCache(const AtomicString& name, Element* element) const { appen
d(m_idCache, name, element); } | 82 void appendIdCache(const AtomicString& name, Element* element) const { appen
d(m_idCache, name, element); } |
85 void appendNameCache(const AtomicString& name, Element* element) const { app
end(m_nameCache, name, element); } | 83 void appendNameCache(const AtomicString& name, Element* element) const { app
end(m_nameCache, name, element); } |
86 | 84 |
87 private: | 85 private: |
88 bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) c
onst; | 86 bool checkForNameMatch(Element*, bool checkName, const AtomicString& name) c
onst; |
89 Element* traverseNextElement(unsigned& offsetInArray, Element* previous, Con
tainerNode* root) const; | 87 Element* traverseNextElement(unsigned& offsetInArray, Element* previous, Con
tainerNode* root) const; |
90 | 88 |
91 virtual bool isLiveNodeList() const OVERRIDE { ASSERT_NOT_REACHED(); return
true; } | 89 virtual bool isLiveNodeList() const OVERRIDE { ASSERT_NOT_REACHED(); return
true; } |
92 | 90 |
93 static void append(NodeCacheMap&, const AtomicString&, Element*); | 91 static void append(NodeCacheMap&, const AtomicString&, Element*); |
94 | 92 |
95 mutable NodeCacheMap m_idCache; | 93 mutable NodeCacheMap m_idCache; |
96 mutable NodeCacheMap m_nameCache; | 94 mutable NodeCacheMap m_nameCache; |
97 mutable unsigned m_cachedElementsArrayOffset; | 95 mutable unsigned m_cachedElementsArrayOffset; |
98 | 96 |
99 friend class LiveNodeListBase; | 97 friend class LiveNodeListBase; |
100 }; | 98 }; |
101 | 99 |
102 } // namespace | 100 } // namespace |
103 | 101 |
104 #endif | 102 #endif |
OLD | NEW |