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

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

Issue 119063002: Have HTMLFormElement's named getter return a RadioNodeList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test style adjustments + const'ify new RadioNodeList field. Created 7 years 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
« no previous file with comments | « Source/core/html/CollectionType.h ('k') | Source/core/html/HTMLFormElement.h » ('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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 case TRCells: 61 case TRCells:
62 case TSectionRows: 62 case TSectionRows:
63 case TableTBodies: 63 case TableTBodies:
64 return true; 64 return true;
65 case ChildNodeListType: 65 case ChildNodeListType:
66 case ClassNodeListType: 66 case ClassNodeListType:
67 case NameNodeListType: 67 case NameNodeListType:
68 case TagNodeListType: 68 case TagNodeListType:
69 case HTMLTagNodeListType: 69 case HTMLTagNodeListType:
70 case RadioNodeListType: 70 case RadioNodeListType:
71 case RadioImgNodeListType:
71 case LabelsNodeListType: 72 case LabelsNodeListType:
72 break; 73 break;
73 } 74 }
74 ASSERT_NOT_REACHED(); 75 ASSERT_NOT_REACHED();
75 return false; 76 return false;
76 } 77 }
77 78
78 static NodeListRootType rootTypeFromCollectionType(CollectionType type) 79 static NodeListRootType rootTypeFromCollectionType(CollectionType type)
79 { 80 {
80 switch (type) { 81 switch (type) {
(...skipping 18 matching lines...) Expand all
99 case SelectedOptions: 100 case SelectedOptions:
100 case DataListOptions: 101 case DataListOptions:
101 case MapAreas: 102 case MapAreas:
102 return NodeListIsRootedAtNode; 103 return NodeListIsRootedAtNode;
103 case ChildNodeListType: 104 case ChildNodeListType:
104 case ClassNodeListType: 105 case ClassNodeListType:
105 case NameNodeListType: 106 case NameNodeListType:
106 case TagNodeListType: 107 case TagNodeListType:
107 case HTMLTagNodeListType: 108 case HTMLTagNodeListType:
108 case RadioNodeListType: 109 case RadioNodeListType:
110 case RadioImgNodeListType:
109 case LabelsNodeListType: 111 case LabelsNodeListType:
110 break; 112 break;
111 } 113 }
112 ASSERT_NOT_REACHED(); 114 ASSERT_NOT_REACHED();
113 return NodeListIsRootedAtNode; 115 return NodeListIsRootedAtNode;
114 } 116 }
115 117
116 static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col lectionType type) 118 static NodeListInvalidationType invalidationTypeExcludingIdAndNameAttributes(Col lectionType type)
117 { 119 {
118 switch (type) { 120 switch (type) {
(...skipping 24 matching lines...) Expand all
143 case DocumentNamedItems: 145 case DocumentNamedItems:
144 return InvalidateOnIdNameAttrChange; 146 return InvalidateOnIdNameAttrChange;
145 case FormControls: 147 case FormControls:
146 return InvalidateForFormControls; 148 return InvalidateForFormControls;
147 case ChildNodeListType: 149 case ChildNodeListType:
148 case ClassNodeListType: 150 case ClassNodeListType:
149 case NameNodeListType: 151 case NameNodeListType:
150 case TagNodeListType: 152 case TagNodeListType:
151 case HTMLTagNodeListType: 153 case HTMLTagNodeListType:
152 case RadioNodeListType: 154 case RadioNodeListType:
155 case RadioImgNodeListType:
153 case LabelsNodeListType: 156 case LabelsNodeListType:
154 break; 157 break;
155 } 158 }
156 ASSERT_NOT_REACHED(); 159 ASSERT_NOT_REACHED();
157 return DoNotInvalidateOnAttributeChanges; 160 return DoNotInvalidateOnAttributeChanges;
158 } 161 }
159 162
160 HTMLCollection::HTMLCollection(Node* ownerNode, CollectionType type, ItemAfterOv errideType itemAfterOverrideType) 163 HTMLCollection::HTMLCollection(Node* ownerNode, CollectionType type, ItemAfterOv errideType itemAfterOverrideType)
161 : LiveNodeListBase(ownerNode, rootTypeFromCollectionType(type), invalidation TypeExcludingIdAndNameAttributes(type), 164 : LiveNodeListBase(ownerNode, rootTypeFromCollectionType(type), invalidation TypeExcludingIdAndNameAttributes(type),
162 WebCore::shouldOnlyIncludeDirectChildren(type), type, itemAfterOverrideT ype) 165 WebCore::shouldOnlyIncludeDirectChildren(type), type, itemAfterOverrideT ype)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 case FormControls: 228 case FormControls:
226 case DocumentNamedItems: 229 case DocumentNamedItems:
227 case TableRows: 230 case TableRows:
228 case WindowNamedItems: 231 case WindowNamedItems:
229 case ChildNodeListType: 232 case ChildNodeListType:
230 case ClassNodeListType: 233 case ClassNodeListType:
231 case NameNodeListType: 234 case NameNodeListType:
232 case TagNodeListType: 235 case TagNodeListType:
233 case HTMLTagNodeListType: 236 case HTMLTagNodeListType:
234 case RadioNodeListType: 237 case RadioNodeListType:
238 case RadioImgNodeListType:
235 case LabelsNodeListType: 239 case LabelsNodeListType:
236 ASSERT_NOT_REACHED(); 240 ASSERT_NOT_REACHED();
237 } 241 }
238 return false; 242 return false;
239 } 243 }
240 244
241 template <> inline bool isMatchingElement(const LiveNodeList* nodeList, Element* element) 245 template <> inline bool isMatchingElement(const LiveNodeList* nodeList, Element* element)
242 { 246 {
243 return nodeList->nodeMatches(element); 247 return nodeList->nodeMatches(element);
244 } 248 }
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 687
684 void HTMLCollection::append(NodeCacheMap& map, const AtomicString& key, Element* element) 688 void HTMLCollection::append(NodeCacheMap& map, const AtomicString& key, Element* element)
685 { 689 {
686 OwnPtr<Vector<Element*> >& vector = map.add(key.impl(), nullptr).iterator->v alue; 690 OwnPtr<Vector<Element*> >& vector = map.add(key.impl(), nullptr).iterator->v alue;
687 if (!vector) 691 if (!vector)
688 vector = adoptPtr(new Vector<Element*>); 692 vector = adoptPtr(new Vector<Element*>);
689 vector->append(element); 693 vector->append(element);
690 } 694 }
691 695
692 } // namespace WebCore 696 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/CollectionType.h ('k') | Source/core/html/HTMLFormElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698