Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: Source/WebCore/xml/XPathPath.cpp

Issue 10869059: Merge 125631 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1229/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/xpath/xpath-detached-nodes-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/xml/XPathPath.cpp
===================================================================
--- Source/WebCore/xml/XPathPath.cpp (revision 126648)
+++ Source/WebCore/xml/XPathPath.cpp (working copy)
@@ -93,11 +93,16 @@
{
EvaluationContext& evaluationContext = Expression::evaluationContext();
EvaluationContext backupContext = evaluationContext;
- // For absolute location paths, the context node is ignored - the
- // document's root node is used instead.
+ // For absolute location paths, the context node is ignored. The
+ // document's root node is used for attached nodes, otherwise the root
+ // node of the detached subtree is used.
Node* context = evaluationContext.node.get();
- if (m_absolute && context->nodeType() != Node::DOCUMENT_NODE)
- context = context->ownerDocument();
+ if (m_absolute && context->nodeType() != Node::DOCUMENT_NODE) {
+ if (context->inDocument())
+ context = context->ownerDocument();
+ else
+ context = context->highestAncestor();
+ }
NodeSet nodes;
nodes.append(context);
« no previous file with comments | « LayoutTests/fast/xpath/xpath-detached-nodes-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698