| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 inline bool keyMatchesMapName(const AtomicString& key, const Element& element) { | 68 inline bool keyMatchesMapName(const AtomicString& key, const Element& element) { |
| 69 return isHTMLMapElement(element) && | 69 return isHTMLMapElement(element) && |
| 70 toHTMLMapElement(element).getName() == key; | 70 toHTMLMapElement(element).getName() == key; |
| 71 } | 71 } |
| 72 | 72 |
| 73 inline bool keyMatchesSlotName(const AtomicString& key, | 73 inline bool keyMatchesSlotName(const AtomicString& key, |
| 74 const Element& element) { | 74 const Element& element) { |
| 75 return isHTMLSlotElement(element) && toHTMLSlotElement(element).name() == key; | 75 return isHTMLSlotElement(element) && toHTMLSlotElement(element).name() == key; |
| 76 } | 76 } |
| 77 | 77 |
| 78 inline bool keyMatchesLowercasedMapName(const AtomicString& key, | |
| 79 const Element& element) { | |
| 80 return isHTMLMapElement(element) && | |
| 81 toHTMLMapElement(element).getName().lower() == key; | |
| 82 } | |
| 83 | |
| 84 void DocumentOrderedMap::add(const AtomicString& key, Element* element) { | 78 void DocumentOrderedMap::add(const AtomicString& key, Element* element) { |
| 85 DCHECK(key); | 79 DCHECK(key); |
| 86 DCHECK(element); | 80 DCHECK(element); |
| 87 | 81 |
| 88 Map::AddResult addResult = m_map.add(key, new MapEntry(element)); | 82 Map::AddResult addResult = m_map.add(key, new MapEntry(element)); |
| 89 if (addResult.isNewEntry) | 83 if (addResult.isNewEntry) |
| 90 return; | 84 return; |
| 91 | 85 |
| 92 Member<MapEntry>& entry = addResult.storedValue->value; | 86 Member<MapEntry>& entry = addResult.storedValue->value; |
| 93 DCHECK(entry->count); | 87 DCHECK(entry->count); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 HTMLSlotElement* DocumentOrderedMap::getSlotByName( | 195 HTMLSlotElement* DocumentOrderedMap::getSlotByName( |
| 202 const AtomicString& key, | 196 const AtomicString& key, |
| 203 const TreeScope* scope) const { | 197 const TreeScope* scope) const { |
| 204 if (Element* slot = get<keyMatchesSlotName>(key, scope)) { | 198 if (Element* slot = get<keyMatchesSlotName>(key, scope)) { |
| 205 DCHECK(isHTMLSlotElement(slot)); | 199 DCHECK(isHTMLSlotElement(slot)); |
| 206 return toHTMLSlotElement(slot); | 200 return toHTMLSlotElement(slot); |
| 207 } | 201 } |
| 208 return nullptr; | 202 return nullptr; |
| 209 } | 203 } |
| 210 | 204 |
| 211 Element* DocumentOrderedMap::getElementByLowercasedMapName( | |
| 212 const AtomicString& key, | |
| 213 const TreeScope* scope) const { | |
| 214 return get<keyMatchesLowercasedMapName>(key, scope); | |
| 215 } | |
| 216 | |
| 217 DEFINE_TRACE(DocumentOrderedMap) { | 205 DEFINE_TRACE(DocumentOrderedMap) { |
| 218 visitor->trace(m_map); | 206 visitor->trace(m_map); |
| 219 } | 207 } |
| 220 | 208 |
| 221 DEFINE_TRACE(DocumentOrderedMap::MapEntry) { | 209 DEFINE_TRACE(DocumentOrderedMap::MapEntry) { |
| 222 visitor->trace(element); | 210 visitor->trace(element); |
| 223 visitor->trace(orderedList); | 211 visitor->trace(orderedList); |
| 224 } | 212 } |
| 225 | 213 |
| 226 } // namespace blink | 214 } // namespace blink |
| OLD | NEW |