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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 Element* TreeScope::getElementById(const AtomicString& elementId) const | 144 Element* TreeScope::getElementById(const AtomicString& elementId) const |
145 { | 145 { |
146 if (elementId.isEmpty()) | 146 if (elementId.isEmpty()) |
147 return 0; | 147 return 0; |
148 if (!m_elementsById) | 148 if (!m_elementsById) |
149 return 0; | 149 return 0; |
150 return m_elementsById->getElementById(elementId.impl(), this); | 150 return m_elementsById->getElementById(elementId.impl(), this); |
151 } | 151 } |
152 | 152 |
| 153 const Vector<Element*>& TreeScope::getAllElementsById(const AtomicString& elemen
tId) const |
| 154 { |
| 155 DEFINE_STATIC_LOCAL(Vector<Element*>, emptyVector, ()); |
| 156 if (elementId.isEmpty()) |
| 157 return emptyVector; |
| 158 if (!m_elementsById) |
| 159 return emptyVector; |
| 160 return m_elementsById->getAllElementsById(elementId.impl(), this); |
| 161 } |
| 162 |
153 void TreeScope::addElementById(const AtomicString& elementId, Element* element) | 163 void TreeScope::addElementById(const AtomicString& elementId, Element* element) |
154 { | 164 { |
155 if (!m_elementsById) | 165 if (!m_elementsById) |
156 m_elementsById = adoptPtr(new DocumentOrderedMap); | 166 m_elementsById = adoptPtr(new DocumentOrderedMap); |
157 m_elementsById->add(elementId.impl(), element); | 167 m_elementsById->add(elementId.impl(), element); |
158 m_idTargetObserverRegistry->notifyObservers(elementId); | 168 m_idTargetObserverRegistry->notifyObservers(elementId); |
159 } | 169 } |
160 | 170 |
161 void TreeScope::removeElementById(const AtomicString& elementId, Element* elemen
t) | 171 void TreeScope::removeElementById(const AtomicString& elementId, Element* elemen
t) |
162 { | 172 { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 result = element; | 501 result = element; |
492 for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot;
shadowRoot = shadowRoot->olderShadowRoot()) { | 502 for (ShadowRoot* shadowRoot = element->youngestShadowRoot(); shadowRoot;
shadowRoot = shadowRoot->olderShadowRoot()) { |
493 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key)) | 503 if (Element* shadowResult = shadowRoot->getElementByAccessKey(key)) |
494 result = shadowResult; | 504 result = shadowResult; |
495 } | 505 } |
496 } | 506 } |
497 return result; | 507 return result; |
498 } | 508 } |
499 | 509 |
500 } // namespace WebCore | 510 } // namespace WebCore |
OLD | NEW |