Index: Source/core/dom/TreeScope.cpp |
diff --git a/Source/core/dom/TreeScope.cpp b/Source/core/dom/TreeScope.cpp |
index 1824cc17fb59cbea850fcf265468a6f06d8d6170..67e78820c42a5013c30657b9a75cf37f45529f0d 100644 |
--- a/Source/core/dom/TreeScope.cpp |
+++ b/Source/core/dom/TreeScope.cpp |
@@ -55,7 +55,7 @@ namespace WebCore { |
struct SameSizeAsTreeScope { |
virtual ~SameSizeAsTreeScope(); |
- void* pointers[8]; |
+ void* pointers[9]; |
int ints[1]; |
}; |
@@ -151,6 +151,15 @@ Element* TreeScope::getElementById(const AtomicString& elementId) const |
return m_elementsById->getElementById(elementId.impl(), this); |
} |
+const Vector<Element*>* TreeScope::getAllElementsById(const AtomicString& elementId) const |
+{ |
+ if (elementId.isEmpty()) |
+ return 0; |
+ if (!m_elementsById) |
+ return 0; |
+ return m_elementsById->getAllElementsById(elementId.impl(), this); |
+} |
+ |
void TreeScope::addElementById(const AtomicString& elementId, Element* element) |
{ |
if (!m_elementsById) |
@@ -167,6 +176,29 @@ void TreeScope::removeElementById(const AtomicString& elementId, Element* elemen |
m_idTargetObserverRegistry->notifyObservers(elementId); |
} |
+Element* TreeScope::getElementByName(const AtomicString& name) const |
+{ |
+ if (name.isEmpty()) |
+ return 0; |
+ if (!m_elementsByName) |
+ return 0; |
+ return m_elementsByName->getElementByName(name.impl(), this); |
+} |
+ |
+void TreeScope::addElementByName(const AtomicString& name, Element* element) |
+{ |
+ if (!m_elementsByName) |
+ m_elementsByName = adoptPtr(new DocumentOrderedMap); |
+ m_elementsByName->add(name.impl(), element); |
+} |
+ |
+void TreeScope::removeElementByName(const AtomicString& name, Element* element) |
+{ |
+ if (!m_elementsByName) |
+ return; |
+ m_elementsByName->remove(name.impl(), element); |
+} |
+ |
Node* TreeScope::ancestorInThisScope(Node* node) const |
{ |
while (node) { |