OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 inline bool keyMatchesMapName(const AtomicString& key, const Element& element) | 73 inline bool keyMatchesMapName(const AtomicString& key, const Element& element) |
74 { | 74 { |
75 return isHTMLMapElement(element) && toHTMLMapElement(element).getName() == k
ey; | 75 return isHTMLMapElement(element) && toHTMLMapElement(element).getName() == k
ey; |
76 } | 76 } |
77 | 77 |
78 inline bool keyMatchesLowercasedMapName(const AtomicString& key, const Element&
element) | 78 inline bool keyMatchesLowercasedMapName(const AtomicString& key, const Element&
element) |
79 { | 79 { |
80 return isHTMLMapElement(element) && toHTMLMapElement(element).getName().lowe
r() == key; | 80 return isHTMLMapElement(element) && toHTMLMapElement(element).getName().lowe
r() == key; |
81 } | 81 } |
82 | 82 |
83 inline bool keyMatchesLabelForAttribute(const AtomicString& key, const Element&
element) | |
84 { | |
85 return isHTMLLabelElement(element) && element.getAttribute(forAttr) == key; | |
86 } | |
87 | |
88 void DocumentOrderedMap::add(const AtomicString& key, Element* element) | 83 void DocumentOrderedMap::add(const AtomicString& key, Element* element) |
89 { | 84 { |
90 DCHECK(key); | 85 DCHECK(key); |
91 DCHECK(element); | 86 DCHECK(element); |
92 | 87 |
93 Map::AddResult addResult = m_map.add(key, new MapEntry(element)); | 88 Map::AddResult addResult = m_map.add(key, new MapEntry(element)); |
94 if (addResult.isNewEntry) | 89 if (addResult.isNewEntry) |
95 return; | 90 return; |
96 | 91 |
97 Member<MapEntry>& entry = addResult.storedValue->value; | 92 Member<MapEntry>& entry = addResult.storedValue->value; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 Element* DocumentOrderedMap::getElementByMapName(const AtomicString& key, const
TreeScope* scope) const | 188 Element* DocumentOrderedMap::getElementByMapName(const AtomicString& key, const
TreeScope* scope) const |
194 { | 189 { |
195 return get<keyMatchesMapName>(key, scope); | 190 return get<keyMatchesMapName>(key, scope); |
196 } | 191 } |
197 | 192 |
198 Element* DocumentOrderedMap::getElementByLowercasedMapName(const AtomicString& k
ey, const TreeScope* scope) const | 193 Element* DocumentOrderedMap::getElementByLowercasedMapName(const AtomicString& k
ey, const TreeScope* scope) const |
199 { | 194 { |
200 return get<keyMatchesLowercasedMapName>(key, scope); | 195 return get<keyMatchesLowercasedMapName>(key, scope); |
201 } | 196 } |
202 | 197 |
203 Element* DocumentOrderedMap::getElementByLabelForAttribute(const AtomicString& k
ey, const TreeScope* scope) const | |
204 { | |
205 return get<keyMatchesLabelForAttribute>(key, scope); | |
206 } | |
207 | |
208 DEFINE_TRACE(DocumentOrderedMap) | 198 DEFINE_TRACE(DocumentOrderedMap) |
209 { | 199 { |
210 visitor->trace(m_map); | 200 visitor->trace(m_map); |
211 } | 201 } |
212 | 202 |
213 DEFINE_TRACE(DocumentOrderedMap::MapEntry) | 203 DEFINE_TRACE(DocumentOrderedMap::MapEntry) |
214 { | 204 { |
215 visitor->trace(element); | 205 visitor->trace(element); |
216 visitor->trace(orderedList); | 206 visitor->trace(orderedList); |
217 } | 207 } |
218 | 208 |
219 } // namespace blink | 209 } // namespace blink |
OLD | NEW |