2011-05-02  Roland Steiner  <rolandsteiner@chromium.org>

        Reviewed by Dimitri Glazkov.

        Bug 59966 - Update ID hash on the containing TreeScope rather than the Document
        https://bugs.webkit.org/show_bug.cgi?id=59966

        No new tests. (refactoring)

        * accessibility/AccessibilityRenderObject.cpp:
        (WebCore::AccessibilityRenderObject::elementsFromAttribute):
        (WebCore::AccessibilityRenderObject::activeDescendant):
        * accessibility/AccessibilityRenderObject.h:
        (WebCore::AccessibilityRenderObject::isAccessibilityRenderObject):
        * css/CSSCursorImageValue.cpp:
        (WebCore::resourceReferencedByCursorElement):
        (WebCore::CSSCursorImageValue::~CSSCursorImageValue):
        (WebCore::CSSCursorImageValue::updateIfSVGCursorIsUsed):
        (WebCore::CSSCursorImageValue::cachedImage):
        * dom/DynamicNodeList.cpp:
        (WebCore::DynamicNodeList::itemWithName):
        * dom/Element.h:
        (WebCore::Element::updateId):
        * dom/Node.cpp:
        (WebCore::Node::querySelector):
        * html/FormAssociatedElement.cpp:
        (WebCore::FormAssociatedElement::insertedIntoTree):
        (WebCore::FormAssociatedElement::resetFormOwner):
        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::dataList):
        * html/HTMLLabelElement.cpp:
        (WebCore::HTMLLabelElement::control):
        * rendering/svg/RenderSVGTextPath.cpp:
        (WebCore::RenderSVGTextPath::layoutPath):
        * svg/SVGAElement.cpp:
        (WebCore::SVGAElement::defaultEventHandler):
        * svg/SVGAltGlyphElement.cpp:
        (WebCore::SVGAltGlyphElement::glyphElement):
        * svg/SVGFEImageElement.cpp:
        (WebCore::SVGFEImageElement::requestImageResource):
        (WebCore::SVGFEImageElement::build):
        * svg/SVGLinearGradientElement.cpp:
        (WebCore::SVGLinearGradientElement::collectGradientAttributes):
        * svg/SVGMPathElement.cpp:
        (WebCore::SVGMPathElement::pathElement):
        * svg/SVGPatternElement.cpp:
        (WebCore::SVGPatternElement::collectPatternAttributes):
        * svg/SVGRadialGradientElement.cpp:
        (WebCore::SVGRadialGradientElement::collectGradientAttributes):
        * svg/SVGSVGElement.cpp:
        (WebCore::SVGSVGElement::getElementById):
        * svg/SVGTRefElement.cpp:
        (WebCore::SVGTRefElement::updateReferencedText):
        * svg/SVGTextPathElement.cpp:
        (WebCore::SVGTextPathElement::insertedIntoDocument):
        * svg/SVGUseElement.cpp:
        (WebCore::SVGUseElement::buildPendingResource):
        (WebCore::SVGUseElement::hasCycleUseReferencing):
        (WebCore::SVGUseElement::expandUseElementsInShadowTree):
        * svg/SVGViewSpec.cpp:
        (WebCore::SVGViewSpec::viewTarget):
        * svg/animation/SVGSMILElement.cpp:
        (WebCore::SVGSMILElement::eventBaseFor):
        (WebCore::SVGSMILElement::connectConditions):
        (WebCore::SVGSMILElement::targetElement):
        * xml/XPathFunctions.cpp:
        (WebCore::XPath::FunId::evaluate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@85617 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/xml/XPathFunctions.cpp b/Source/WebCore/xml/XPathFunctions.cpp
index 2091aca..d343a59 100644
--- a/Source/WebCore/xml/XPathFunctions.cpp
+++ b/Source/WebCore/xml/XPathFunctions.cpp
@@ -30,10 +30,10 @@
 
 #if ENABLE(XPATH)
 
-#include "Document.h"
 #include "Element.h"
 #include "NamedNodeMap.h"
 #include "ProcessingInstruction.h"
+#include "TreeScope.h"
 #include "XMLNames.h"
 #include "XPathUtil.h"
 #include "XPathValue.h"
@@ -332,7 +332,7 @@
         idList.append(str.characters(), str.length());
     }
     
-    Document* contextDocument = evaluationContext().node->document();
+    TreeScope* contextScope = evaluationContext().node->treeScope();
     NodeSet result;
     HashSet<Node*> resultSet;
 
@@ -351,7 +351,7 @@
 
         // If there are several nodes with the same id, id() should return the first one.
         // In WebKit, getElementById behaves so, too, although its behavior in this case is formally undefined.
-        Node* node = contextDocument->getElementById(String(&idList[startPos], endPos - startPos));
+        Node* node = contextScope->getElementById(String(&idList[startPos], endPos - startPos));
         if (node && resultSet.add(node).second)
             result.append(node);