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

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

Issue 148013008: Use stricter typing for HTMLCollection named getter (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
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
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, 2010, 2011, 2012 Apple Inc. All r ights reserved. 4 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2010, 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 HTMLImageElement* element = (*imageElementsArray)[i]; 127 HTMLImageElement* element = (*imageElementsArray)[i];
128 if (element->fastGetAttribute(attrName) == name) { 128 if (element->fastGetAttribute(attrName) == name) {
129 UseCounter::count(element->document(), UseCounter::FormNameAccessFor ImageElement); 129 UseCounter::count(element->document(), UseCounter::FormNameAccessFor ImageElement);
130 return element; 130 return element;
131 } 131 }
132 } 132 }
133 133
134 return 0; 134 return 0;
135 } 135 }
136 136
137 Node* HTMLFormControlsCollection::namedItem(const AtomicString& name) const 137 Element* HTMLFormControlsCollection::namedItem(const AtomicString& name) const
138 { 138 {
139 // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/namedit em.asp 139 // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/namedit em.asp
140 // This method first searches for an object with a matching id 140 // This method first searches for an object with a matching id
141 // attribute. If a match is not found, the method then searches for an 141 // attribute. If a match is not found, the method then searches for an
142 // object with a matching name attribute, but only on those elements 142 // object with a matching name attribute, but only on those elements
143 // that are allowed a name attribute. 143 // that are allowed a name attribute.
144 const Vector<HTMLImageElement*>* imagesElements = ownerNode()->hasTagName(fi eldsetTag) ? 0 : &formImageElements(); 144 const Vector<HTMLImageElement*>* imagesElements = ownerNode()->hasTagName(fi eldsetTag) ? 0 : &formImageElements();
145 if (HTMLElement* item = firstNamedItem(formControlElements(), imagesElements , idAttr, name)) 145 if (HTMLElement* item = firstNamedItem(formControlElements(), imagesElements , idAttr, name))
146 return item; 146 return item;
147 147
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.i mpl())) 183 if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.i mpl()))
184 appendIdCache(idAttrVal, element); 184 appendIdCache(idAttrVal, element);
185 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInpu tElements.contains(nameAttrVal.impl())) 185 if (!nameAttrVal.isEmpty() && idAttrVal != nameAttrVal && !foundInpu tElements.contains(nameAttrVal.impl()))
186 appendNameCache(nameAttrVal, element); 186 appendNameCache(nameAttrVal, element);
187 } 187 }
188 } 188 }
189 189
190 setHasNameCache(); 190 setHasNameCache();
191 } 191 }
192 192
193 void HTMLFormControlsCollection::namedGetter(const AtomicString& name, bool& ret urnValue0Enabled, RefPtr<RadioNodeList>& returnValue0, bool& returnValue1Enabled , RefPtr<Node>& returnValue1) 193 void HTMLFormControlsCollection::namedGetter(const AtomicString& name, bool& ret urnValue0Enabled, RefPtr<RadioNodeList>& returnValue0, bool& returnValue1Enabled , RefPtr<Element>& returnValue1)
194 { 194 {
195 Vector<RefPtr<Node> > namedItems; 195 Vector<RefPtr<Element> > namedItems;
196 this->namedItems(name, namedItems); 196 this->namedItems(name, namedItems);
197 197
198 if (!namedItems.size()) 198 if (!namedItems.size())
199 return; 199 return;
200 200
201 if (namedItems.size() == 1) { 201 if (namedItems.size() == 1) {
202 returnValue1Enabled = true; 202 returnValue1Enabled = true;
203 returnValue1 = namedItems.at(0); 203 returnValue1 = namedItems.at(0);
204 return; 204 return;
205 } 205 }
206 206
207 returnValue0Enabled = true; 207 returnValue0Enabled = true;
208 returnValue0 = this->ownerNode()->radioNodeList(name); 208 returnValue0 = this->ownerNode()->radioNodeList(name);
209 } 209 }
210 210
211 } 211 }
OLDNEW
« no previous file with comments | « Source/core/html/HTMLFormControlsCollection.h ('k') | Source/core/html/HTMLFormControlsCollection.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698