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 * 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. |
11 * | 11 * |
12 * This library is distributed in the hope that it will be useful, | 12 * This library is distributed in the hope that it will be useful, |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 * Library General Public License for more details. | 15 * Library General Public License for more details. |
16 * | 16 * |
17 * You should have received a copy of the GNU Library General Public License | 17 * You should have received a copy of the GNU Library General Public License |
18 * along with this library; see the file COPYING.LIB. If not, write to | 18 * along with this library; see the file COPYING.LIB. If not, write to |
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 * Boston, MA 02110-1301, USA. | 20 * Boston, MA 02110-1301, USA. |
21 * | 21 * |
22 */ | 22 */ |
23 | 23 |
24 #ifndef HTMLCollection_h | 24 #ifndef HTMLCollection_h |
25 #define HTMLCollection_h | 25 #define HTMLCollection_h |
26 | 26 |
| 27 #include "bindings/core/v8/Iterable.h" |
27 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
28 #include "core/dom/LiveNodeListBase.h" | 29 #include "core/dom/LiveNodeListBase.h" |
29 #include "core/html/CollectionItemsCache.h" | 30 #include "core/html/CollectionItemsCache.h" |
30 #include "core/html/CollectionType.h" | 31 #include "core/html/CollectionType.h" |
31 #include "wtf/Forward.h" | 32 #include "wtf/Forward.h" |
32 | 33 |
33 namespace blink { | 34 namespace blink { |
34 | 35 |
35 class CORE_EXPORT HTMLCollection : public RefCountedWillBeGarbageCollectedFinali
zed<HTMLCollection>, public ScriptWrappable, public LiveNodeListBase { | 36 class CORE_EXPORT HTMLCollection : public RefCountedWillBeGarbageCollectedFinali
zed<HTMLCollection>, public ScriptWrappable, public ValueIterable<Element*>, pub
lic LiveNodeListBase { |
36 DEFINE_WRAPPERTYPEINFO(); | 37 DEFINE_WRAPPERTYPEINFO(); |
37 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLCollection); | 38 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLCollection); |
38 public: | 39 public: |
39 enum ItemAfterOverrideType { | 40 enum ItemAfterOverrideType { |
40 OverridesItemAfter, | 41 OverridesItemAfter, |
41 DoesNotOverrideItemAfter, | 42 DoesNotOverrideItemAfter, |
42 }; | 43 }; |
43 | 44 |
44 static PassRefPtrWillBeRawPtr<HTMLCollection> create(ContainerNode& base, Co
llectionType); | 45 static PassRefPtrWillBeRawPtr<HTMLCollection> create(ContainerNode& base, Co
llectionType); |
45 virtual ~HTMLCollection(); | 46 virtual ~HTMLCollection(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 141 |
141 m_namedItemCache.clear(); | 142 m_namedItemCache.clear(); |
142 } | 143 } |
143 | 144 |
144 void unregisterIdNameCacheFromDocument(Document& document) const | 145 void unregisterIdNameCacheFromDocument(Document& document) const |
145 { | 146 { |
146 ASSERT(hasValidIdNameCache()); | 147 ASSERT(hasValidIdNameCache()); |
147 document.unregisterNodeListWithIdNameCache(this); | 148 document.unregisterNodeListWithIdNameCache(this); |
148 } | 149 } |
149 | 150 |
| 151 IterationSource* startIteration(ScriptState*, ExceptionState&) override; |
| 152 |
150 const unsigned m_overridesItemAfter : 1; | 153 const unsigned m_overridesItemAfter : 1; |
151 const unsigned m_shouldOnlyIncludeDirectChildren : 1; | 154 const unsigned m_shouldOnlyIncludeDirectChildren : 1; |
152 mutable OwnPtrWillBeMember<NamedItemCache> m_namedItemCache; | 155 mutable OwnPtrWillBeMember<NamedItemCache> m_namedItemCache; |
153 mutable CollectionItemsCache<HTMLCollection, Element> m_collectionItemsCache
; | 156 mutable CollectionItemsCache<HTMLCollection, Element> m_collectionItemsCache
; |
154 }; | 157 }; |
155 | 158 |
156 DEFINE_TYPE_CASTS(HTMLCollection, LiveNodeListBase, collection, isHTMLCollection
Type(collection->type()), isHTMLCollectionType(collection.type())); | 159 DEFINE_TYPE_CASTS(HTMLCollection, LiveNodeListBase, collection, isHTMLCollection
Type(collection->type()), isHTMLCollectionType(collection.type())); |
157 | 160 |
158 inline void HTMLCollection::invalidateCacheForAttribute(const QualifiedName* att
rName) const | 161 inline void HTMLCollection::invalidateCacheForAttribute(const QualifiedName* att
rName) const |
159 { | 162 { |
160 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *
attrName)) | 163 if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *
attrName)) |
161 invalidateCache(); | 164 invalidateCache(); |
162 else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr) | 165 else if (*attrName == HTMLNames::idAttr || *attrName == HTMLNames::nameAttr) |
163 invalidateIdNameCacheMaps(); | 166 invalidateIdNameCacheMaps(); |
164 } | 167 } |
165 | 168 |
166 } // namespace blink | 169 } // namespace blink |
167 | 170 |
168 #endif // HTMLCollection_h | 171 #endif // HTMLCollection_h |
OLD | NEW |