OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 Google Inc. All Rights Reserved. |
3 * Copyright (C) 2012 Apple Inc. All rights reserved. | 3 * Copyright (C) 2012 Apple Inc. All rights 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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 { | 163 { |
164 if (elementId.isEmpty()) | 164 if (elementId.isEmpty()) |
165 return 0; | 165 return 0; |
166 if (!m_elementsById) | 166 if (!m_elementsById) |
167 return 0; | 167 return 0; |
168 return m_elementsById->getElementById(elementId, this); | 168 return m_elementsById->getElementById(elementId, this); |
169 } | 169 } |
170 | 170 |
171 const HeapVector<Member<Element>>& TreeScope::getAllElementsById(const AtomicStr
ing& elementId) const | 171 const HeapVector<Member<Element>>& TreeScope::getAllElementsById(const AtomicStr
ing& elementId) const |
172 { | 172 { |
173 DEFINE_STATIC_LOCAL(Persistent<HeapVector<Member<Element>>>, emptyVector, (n
ew HeapVector<Member<Element>>())); | 173 DEFINE_STATIC_LOCAL(HeapVector<Member<Element>>, emptyVector, (new HeapVecto
r<Member<Element>>)); |
174 if (elementId.isEmpty()) | 174 if (elementId.isEmpty()) |
175 return *emptyVector; | 175 return emptyVector; |
176 if (!m_elementsById) | 176 if (!m_elementsById) |
177 return *emptyVector; | 177 return emptyVector; |
178 return m_elementsById->getAllElementsById(elementId, this); | 178 return m_elementsById->getAllElementsById(elementId, this); |
179 } | 179 } |
180 | 180 |
181 void TreeScope::addElementById(const AtomicString& elementId, Element* element) | 181 void TreeScope::addElementById(const AtomicString& elementId, Element* element) |
182 { | 182 { |
183 if (!m_elementsById) | 183 if (!m_elementsById) |
184 m_elementsById = DocumentOrderedMap::create(); | 184 m_elementsById = DocumentOrderedMap::create(); |
185 m_elementsById->add(elementId, element); | 185 m_elementsById->add(elementId, element); |
186 m_idTargetObserverRegistry->notifyObservers(elementId); | 186 m_idTargetObserverRegistry->notifyObservers(elementId); |
187 } | 187 } |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 visitor->trace(m_idTargetObserverRegistry); | 576 visitor->trace(m_idTargetObserverRegistry); |
577 visitor->trace(m_selection); | 577 visitor->trace(m_selection); |
578 visitor->trace(m_elementsById); | 578 visitor->trace(m_elementsById); |
579 visitor->trace(m_imageMapsByName); | 579 visitor->trace(m_imageMapsByName); |
580 visitor->trace(m_labelsByForAttribute); | 580 visitor->trace(m_labelsByForAttribute); |
581 visitor->trace(m_scopedStyleResolver); | 581 visitor->trace(m_scopedStyleResolver); |
582 visitor->trace(m_radioButtonGroupScope); | 582 visitor->trace(m_radioButtonGroupScope); |
583 } | 583 } |
584 | 584 |
585 } // namespace blink | 585 } // namespace blink |
OLD | NEW |