| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 Element* TreeScope::getElementById(const AtomicString& elementId) const | 154 Element* TreeScope::getElementById(const AtomicString& elementId) const |
| 155 { | 155 { |
| 156 if (elementId.isEmpty()) | 156 if (elementId.isEmpty()) |
| 157 return 0; | 157 return 0; |
| 158 if (!m_elementsById) | 158 if (!m_elementsById) |
| 159 return 0; | 159 return 0; |
| 160 return m_elementsById->getElementById(elementId, this); | 160 return m_elementsById->getElementById(elementId, this); |
| 161 } | 161 } |
| 162 | 162 |
| 163 const Vector<RawPtr<Element> >& TreeScope::getAllElementsById(const AtomicString
& elementId) const | |
| 164 { | |
| 165 DEFINE_STATIC_LOCAL(OwnPtr<Vector<RawPtr<Element> > >, emptyVector, (adoptPt
r(new Vector<RawPtr<Element> >()))); | |
| 166 if (elementId.isEmpty()) | |
| 167 return *emptyVector; | |
| 168 if (!m_elementsById) | |
| 169 return *emptyVector; | |
| 170 return m_elementsById->getAllElementsById(elementId, this); | |
| 171 } | |
| 172 | |
| 173 void TreeScope::addElementById(const AtomicString& elementId, Element* element) | 163 void TreeScope::addElementById(const AtomicString& elementId, Element* element) |
| 174 { | 164 { |
| 175 if (!m_elementsById) | 165 if (!m_elementsById) |
| 176 m_elementsById = DocumentOrderedMap::create(); | 166 m_elementsById = DocumentOrderedMap::create(); |
| 177 m_elementsById->add(elementId, element); | 167 m_elementsById->add(elementId, element); |
| 178 } | 168 } |
| 179 | 169 |
| 180 void TreeScope::removeElementById(const AtomicString& elementId, Element* elemen
t) | 170 void TreeScope::removeElementById(const AtomicString& elementId, Element* elemen
t) |
| 181 { | 171 { |
| 182 if (!m_elementsById) | 172 if (!m_elementsById) |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 visitor->trace(m_document); | 441 visitor->trace(m_document); |
| 452 visitor->trace(m_parentTreeScope); | 442 visitor->trace(m_parentTreeScope); |
| 453 visitor->trace(m_selection); | 443 visitor->trace(m_selection); |
| 454 visitor->trace(m_elementsById); | 444 visitor->trace(m_elementsById); |
| 455 visitor->trace(m_imageMapsByName); | 445 visitor->trace(m_imageMapsByName); |
| 456 visitor->trace(m_labelsByForAttribute); | 446 visitor->trace(m_labelsByForAttribute); |
| 457 visitor->trace(m_scopedStyleResolver); | 447 visitor->trace(m_scopedStyleResolver); |
| 458 } | 448 } |
| 459 | 449 |
| 460 } // namespace blink | 450 } // namespace blink |
| OLD | NEW |