Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(477)

Side by Side Diff: Source/core/html/HTMLCollection.h

Issue 136783008: Move m_shouldOnlyIncludeDirectChildren member from LiveNodeListBase to HTMLCollection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/LiveNodeList.h ('k') | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 bool canTraverseBackward() const { return !overridesItemAfter(); } 56 bool canTraverseBackward() const { return !overridesItemAfter(); }
57 Element* itemBefore(const Element* previousItem) const; 57 Element* itemBefore(const Element* previousItem) const;
58 Element* traverseToFirstElement(const ContainerNode& root) const; 58 Element* traverseToFirstElement(const ContainerNode& root) const;
59 Element* traverseForwardToOffset(unsigned offset, Element& currentElement, u nsigned& currentOffset, const ContainerNode& root) const; 59 Element* traverseForwardToOffset(unsigned offset, Element& currentElement, u nsigned& currentOffset, const ContainerNode& root) const;
60 60
61 protected: 61 protected:
62 HTMLCollection(ContainerNode* base, CollectionType, ItemAfterOverrideType); 62 HTMLCollection(ContainerNode* base, CollectionType, ItemAfterOverrideType);
63 63
64 bool overridesItemAfter() const { return m_overridesItemAfter; } 64 bool overridesItemAfter() const { return m_overridesItemAfter; }
65 virtual Element* virtualItemAfter(Element*) const; 65 virtual Element* virtualItemAfter(Element*) const;
66 bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDir ectChildren; }
66 67
67 virtual void updateNameCache() const; 68 virtual void updateNameCache() const;
68 bool hasNameCache() const { return m_isNameCacheValid; } 69 bool hasNameCache() const { return m_isNameCacheValid; }
69 void setHasNameCache() const { m_isNameCacheValid = true; } 70 void setHasNameCache() const { m_isNameCacheValid = true; }
70 71
71 typedef HashMap<StringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap; 72 typedef HashMap<StringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap;
72 Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache .get(name.impl()); } 73 Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache .get(name.impl()); }
73 Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameC ache.get(name.impl()); } 74 Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameC ache.get(name.impl()); }
74 void appendIdCache(const AtomicString& name, Element* element) const { appen d(m_idCache, name, element); } 75 void appendIdCache(const AtomicString& name, Element* element) const { appen d(m_idCache, name, element); }
75 void appendNameCache(const AtomicString& name, Element* element) const { app end(m_nameCache, name, element); } 76 void appendNameCache(const AtomicString& name, Element* element) const { app end(m_nameCache, name, element); }
76 77
77 private: 78 private:
78 Element* traverseNextElement(Element& previous, const ContainerNode& root) c onst; 79 Element* traverseNextElement(Element& previous, const ContainerNode& root) c onst;
79 80
80 static void append(NodeCacheMap&, const AtomicString&, Element*); 81 static void append(NodeCacheMap&, const AtomicString&, Element*);
81 void invalidateIdNameCacheMaps() const 82 void invalidateIdNameCacheMaps() const
82 { 83 {
83 m_idCache.clear(); 84 m_idCache.clear();
84 m_nameCache.clear(); 85 m_nameCache.clear();
85 m_isNameCacheValid = false; 86 m_isNameCacheValid = false;
86 } 87 }
87 88
88 const unsigned m_overridesItemAfter : 1; 89 const unsigned m_overridesItemAfter : 1;
90 const unsigned m_shouldOnlyIncludeDirectChildren : 1;
89 mutable unsigned m_isNameCacheValid : 1; 91 mutable unsigned m_isNameCacheValid : 1;
90 mutable NodeCacheMap m_idCache; 92 mutable NodeCacheMap m_idCache;
91 mutable NodeCacheMap m_nameCache; 93 mutable NodeCacheMap m_nameCache;
92 mutable CollectionIndexCache<HTMLCollection, Element> m_collectionIndexCache ; 94 mutable CollectionIndexCache<HTMLCollection, Element> m_collectionIndexCache ;
93 95
94 friend class LiveNodeListBase; 96 friend class LiveNodeListBase;
95 }; 97 };
96 98
97 } // namespace 99 } // namespace
98 100
99 #endif 101 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/LiveNodeList.h ('k') | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698