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

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

Issue 157013006: Update HTMLFormControlsCollection's named getter to behave according to spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove legacycaller 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
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 * Copyright (C) 2014 Samsung Electronics. All rights reserved. 5 * Copyright (C) 2014 Samsung Electronics. All rights reserved.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 Element* itemBefore(const Element* previousItem) const; 60 Element* itemBefore(const Element* previousItem) const;
61 Element* traverseToFirstElement(const ContainerNode& root) const; 61 Element* traverseToFirstElement(const ContainerNode& root) const;
62 Element* traverseForwardToOffset(unsigned offset, Element& currentElement, u nsigned& currentOffset, const ContainerNode& root) const; 62 Element* traverseForwardToOffset(unsigned offset, Element& currentElement, u nsigned& currentOffset, const ContainerNode& root) const;
63 63
64 protected: 64 protected:
65 HTMLCollection(ContainerNode* base, CollectionType, ItemAfterOverrideType); 65 HTMLCollection(ContainerNode* base, CollectionType, ItemAfterOverrideType);
66 66
67 bool overridesItemAfter() const { return m_overridesItemAfter; } 67 bool overridesItemAfter() const { return m_overridesItemAfter; }
68 virtual Element* virtualItemAfter(Element*) const; 68 virtual Element* virtualItemAfter(Element*) const;
69 bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDir ectChildren; } 69 bool shouldOnlyIncludeDirectChildren() const { return m_shouldOnlyIncludeDir ectChildren; }
70 virtual void supportedPropertyNames(Vector<String>& names);
70 71
71 virtual void updateNameCache() const; 72 virtual void updateNameCache() const;
72 bool hasNameCache() const { return m_isNameCacheValid; } 73 bool hasNameCache() const { return m_isNameCacheValid; }
73 void setHasNameCache() const { m_isNameCacheValid = true; } 74 void setHasNameCache() const { m_isNameCacheValid = true; }
74 75
75 typedef HashMap<StringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap; 76 typedef HashMap<StringImpl*, OwnPtr<Vector<Element*> > > NodeCacheMap;
76 Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache .get(name.impl()); } 77 Vector<Element*>* idCache(const AtomicString& name) const { return m_idCache .get(name.impl()); }
77 Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameC ache.get(name.impl()); } 78 Vector<Element*>* nameCache(const AtomicString& name) const { return m_nameC ache.get(name.impl()); }
78 void appendIdCache(const AtomicString& name, Element* element) const { appen d(m_idCache, name, element); } 79 void appendIdCache(const AtomicString& name, Element* element) const { appen d(m_idCache, name, element); }
79 void appendNameCache(const AtomicString& name, Element* element) const { app end(m_nameCache, name, element); } 80 void appendNameCache(const AtomicString& name, Element* element) const { app end(m_nameCache, name, element); }
80 81
81 private: 82 private:
82 Element* traverseNextElement(Element& previous, const ContainerNode& root) c onst; 83 Element* traverseNextElement(Element& previous, const ContainerNode& root) c onst;
83 virtual void supportedPropertyNames(Vector<String>& names);
84 84
85 static void append(NodeCacheMap&, const AtomicString&, Element*); 85 static void append(NodeCacheMap&, const AtomicString&, Element*);
86 void invalidateIdNameCacheMaps() const 86 void invalidateIdNameCacheMaps() const
87 { 87 {
88 m_idCache.clear(); 88 m_idCache.clear();
89 m_nameCache.clear(); 89 m_nameCache.clear();
90 m_isNameCacheValid = false; 90 m_isNameCacheValid = false;
91 } 91 }
92 92
93 const unsigned m_overridesItemAfter : 1; 93 const unsigned m_overridesItemAfter : 1;
94 const unsigned m_shouldOnlyIncludeDirectChildren : 1; 94 const unsigned m_shouldOnlyIncludeDirectChildren : 1;
95 mutable unsigned m_isNameCacheValid : 1; 95 mutable unsigned m_isNameCacheValid : 1;
96 mutable NodeCacheMap m_idCache; 96 mutable NodeCacheMap m_idCache;
97 mutable NodeCacheMap m_nameCache; 97 mutable NodeCacheMap m_nameCache;
98 mutable CollectionIndexCache<HTMLCollection, Element> m_collectionIndexCache ; 98 mutable CollectionIndexCache<HTMLCollection, Element> m_collectionIndexCache ;
99 99
100 friend class LiveNodeListBase; 100 friend class LiveNodeListBase;
101 }; 101 };
102 102
103 } // namespace 103 } // namespace
104 104
105 #endif 105 #endif
OLDNEW
« no previous file with comments | « Source/bindings/v8/custom/V8HTMLFormControlsCollectionCustom.cpp ('k') | Source/core/html/HTMLCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698