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

Side by Side 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, 3 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/xpath/xpath-detached-nodes-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org> 2 * Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
3 * Copyright (C) 2006, 2009 Apple Inc. 3 * Copyright (C) 2006, 2009 Apple Inc.
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 LocationPath::~LocationPath() 87 LocationPath::~LocationPath()
88 { 88 {
89 deleteAllValues(m_steps); 89 deleteAllValues(m_steps);
90 } 90 }
91 91
92 Value LocationPath::evaluate() const 92 Value LocationPath::evaluate() const
93 { 93 {
94 EvaluationContext& evaluationContext = Expression::evaluationContext(); 94 EvaluationContext& evaluationContext = Expression::evaluationContext();
95 EvaluationContext backupContext = evaluationContext; 95 EvaluationContext backupContext = evaluationContext;
96 // For absolute location paths, the context node is ignored - the 96 // For absolute location paths, the context node is ignored. The
97 // document's root node is used instead. 97 // document's root node is used for attached nodes, otherwise the root
98 // node of the detached subtree is used.
98 Node* context = evaluationContext.node.get(); 99 Node* context = evaluationContext.node.get();
99 if (m_absolute && context->nodeType() != Node::DOCUMENT_NODE) 100 if (m_absolute && context->nodeType() != Node::DOCUMENT_NODE) {
100 context = context->ownerDocument(); 101 if (context->inDocument())
102 context = context->ownerDocument();
103 else
104 context = context->highestAncestor();
105 }
101 106
102 NodeSet nodes; 107 NodeSet nodes;
103 nodes.append(context); 108 nodes.append(context);
104 evaluate(nodes); 109 evaluate(nodes);
105 110
106 evaluationContext = backupContext; 111 evaluationContext = backupContext;
107 return Value(nodes, Value::adopt); 112 return Value(nodes, Value::adopt);
108 } 113 }
109 114
110 void LocationPath::evaluate(NodeSet& nodes) const 115 void LocationPath::evaluate(NodeSet& nodes) const
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 Value v = m_filter->evaluate(); 201 Value v = m_filter->evaluate();
197 202
198 NodeSet& nodes = v.modifiableNodeSet(); 203 NodeSet& nodes = v.modifiableNodeSet();
199 m_path->evaluate(nodes); 204 m_path->evaluate(nodes);
200 205
201 return v; 206 return v;
202 } 207 }
203 208
204 } 209 }
205 } 210 }
OLDNEW
« 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