// getElementById on SVGSVGElement is restricted to only the child subtree defined by the <svg> element. // See http://www.w3.org/TR/SVG11/struct.html#InterfaceSVGSVGElement Element* SVGSVGElement::getElementById(const AtomicString& id) const { Element* element = document()->getElementById(id); if (element && element->isDescendantOf(this)) return element; // Fall back to traversing our subtree. Duplicate ids are allowed, the first found will // be returned. for (Node* node = traverseNextNode(this); node; node = node->traverseNextNode(this)) { if (!node->isElementNode()) continue; Element* element = static_cast<Element*>(node); if (element->hasID() && element->getIdAttribute() == id) return element; } return 0; }
PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const FloatRect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect) const { Vector<RefPtr<Node> > nodes; Node* node = traverseNextNode(referenceElement ? referenceElement : this); while (node) { if (node->isSVGElement()) { if (collect == CollectIntersectionList) { if (checkIntersection(static_cast<SVGElement*>(node), rect)) nodes.append(node); } else { if (checkEnclosure(static_cast<SVGElement*>(node), rect)) nodes.append(node); } } node = node->traverseNextNode(referenceElement ? referenceElement : this); } return StaticNodeList::adopt(nodes); }