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, 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 * 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 { | 74 { |
75 unsigned i = 0; | 75 unsigned i = 0; |
76 for (; i < associatedElements.size(); ++i) { | 76 for (; i < associatedElements.size(); ++i) { |
77 FormAssociatedElement* associatedElement = associatedElements[i]; | 77 FormAssociatedElement* associatedElement = associatedElements[i]; |
78 if (associatedElement->isEnumeratable() && toHTMLElement(associatedEleme
nt) == element) | 78 if (associatedElement->isEnumeratable() && toHTMLElement(associatedEleme
nt) == element) |
79 break; | 79 break; |
80 } | 80 } |
81 return i; | 81 return i; |
82 } | 82 } |
83 | 83 |
84 Element* HTMLFormControlsCollection::virtualItemAfter(Element* previous) const | 84 HTMLElement* HTMLFormControlsCollection::virtualItemAfter(Element* previous) con
st |
85 { | 85 { |
86 const FormAssociatedElement::List& associatedElements = formControlElements(
); | 86 const FormAssociatedElement::List& associatedElements = formControlElements(
); |
87 unsigned offset; | 87 unsigned offset; |
88 if (!previous) | 88 if (!previous) |
89 offset = 0; | 89 offset = 0; |
90 else if (m_cachedElement == previous) | 90 else if (m_cachedElement == previous) |
91 offset = m_cachedElementOffsetInArray + 1; | 91 offset = m_cachedElementOffsetInArray + 1; |
92 else | 92 else |
93 offset = findFormAssociatedElement(associatedElements, previous) + 1; | 93 offset = findFormAssociatedElement(associatedElements, previous) + 1; |
94 | 94 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 HTMLImageElement* element = (*imageElementsArray)[i]; | 128 HTMLImageElement* element = (*imageElementsArray)[i]; |
129 if (element->fastGetAttribute(attrName) == name) { | 129 if (element->fastGetAttribute(attrName) == name) { |
130 UseCounter::count(element->document(), UseCounter::FormNameAccessFor
ImageElement); | 130 UseCounter::count(element->document(), UseCounter::FormNameAccessFor
ImageElement); |
131 return element; | 131 return element; |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 return 0; | 135 return 0; |
136 } | 136 } |
137 | 137 |
138 Element* HTMLFormControlsCollection::namedItem(const AtomicString& name) const | 138 HTMLElement* HTMLFormControlsCollection::namedItem(const AtomicString& name) con
st |
139 { | 139 { |
140 // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/namedit
em.asp | 140 // http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/namedit
em.asp |
141 // This method first searches for an object with a matching id | 141 // This method first searches for an object with a matching id |
142 // attribute. If a match is not found, the method then searches for an | 142 // attribute. If a match is not found, the method then searches for an |
143 // object with a matching name attribute, but only on those elements | 143 // object with a matching name attribute, but only on those elements |
144 // that are allowed a name attribute. | 144 // that are allowed a name attribute. |
145 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >* imagesElement
s = isHTMLFieldSetElement(ownerNode()) ? 0 : &formImageElements(); | 145 const WillBeHeapVector<RawPtrWillBeMember<HTMLImageElement> >* imagesElement
s = isHTMLFieldSetElement(ownerNode()) ? 0 : &formImageElements(); |
146 if (HTMLElement* item = firstNamedItem(formControlElements(), imagesElements
, idAttr, name)) | 146 if (HTMLElement* item = firstNamedItem(formControlElements(), imagesElements
, idAttr, name)) |
147 return item; | 147 return item; |
148 | 148 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 void HTMLFormControlsCollection::supportedPropertyNames(Vector<String>& names) | 212 void HTMLFormControlsCollection::supportedPropertyNames(Vector<String>& names) |
213 { | 213 { |
214 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-in
terfaces.html#htmlformcontrolscollection-0: | 214 // http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-in
terfaces.html#htmlformcontrolscollection-0: |
215 // The supported property names consist of the non-empty values of all the i
d and name attributes | 215 // The supported property names consist of the non-empty values of all the i
d and name attributes |
216 // of all the elements represented by the collection, in tree order, ignorin
g later duplicates, | 216 // of all the elements represented by the collection, in tree order, ignorin
g later duplicates, |
217 // with the id of an element preceding its name if it contributes both, they
differ from each | 217 // with the id of an element preceding its name if it contributes both, they
differ from each |
218 // other, and neither is the duplicate of an earlier entry. | 218 // other, and neither is the duplicate of an earlier entry. |
219 HashSet<AtomicString> existingNames; | 219 HashSet<AtomicString> existingNames; |
220 unsigned length = this->length(); | 220 unsigned length = this->length(); |
221 for (unsigned i = 0; i < length; ++i) { | 221 for (unsigned i = 0; i < length; ++i) { |
222 Element* element = item(i); | 222 HTMLElement* element = item(i); |
223 ASSERT(element); | 223 ASSERT(element); |
224 const AtomicString& idAttribute = element->getIdAttribute(); | 224 const AtomicString& idAttribute = element->getIdAttribute(); |
225 if (!idAttribute.isEmpty()) { | 225 if (!idAttribute.isEmpty()) { |
226 HashSet<AtomicString>::AddResult addResult = existingNames.add(idAtt
ribute); | 226 HashSet<AtomicString>::AddResult addResult = existingNames.add(idAtt
ribute); |
227 if (addResult.isNewEntry) | 227 if (addResult.isNewEntry) |
228 names.append(idAttribute); | 228 names.append(idAttribute); |
229 } | 229 } |
230 const AtomicString& nameAttribute = element->getNameAttribute(); | 230 const AtomicString& nameAttribute = element->getNameAttribute(); |
231 if (!nameAttribute.isEmpty()) { | 231 if (!nameAttribute.isEmpty()) { |
232 HashSet<AtomicString>::AddResult addResult = existingNames.add(nameA
ttribute); | 232 HashSet<AtomicString>::AddResult addResult = existingNames.add(nameA
ttribute); |
233 if (addResult.isNewEntry) | 233 if (addResult.isNewEntry) |
234 names.append(nameAttribute); | 234 names.append(nameAttribute); |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 | 238 |
239 void HTMLFormControlsCollection::trace(Visitor* visitor) | 239 void HTMLFormControlsCollection::trace(Visitor* visitor) |
240 { | 240 { |
241 visitor->trace(m_cachedElement); | 241 visitor->trace(m_cachedElement); |
242 HTMLCollection::trace(visitor); | 242 HTMLCollection::trace(visitor); |
243 } | 243 } |
244 | 244 |
245 } | 245 } |
OLD | NEW |