| OLD | NEW |
| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 EvaluationContext clonedContext = evaluationContext; | 104 EvaluationContext clonedContext = evaluationContext; |
| 105 // http://www.w3.org/TR/xpath/ | 105 // http://www.w3.org/TR/xpath/ |
| 106 // Section 2, Location Paths: | 106 // Section 2, Location Paths: |
| 107 // "/ selects the document root (which is always the parent of the document
element)" | 107 // "/ selects the document root (which is always the parent of the document
element)" |
| 108 // "A / by itself selects the root node of the document containing the conte
xt node." | 108 // "A / by itself selects the root node of the document containing the conte
xt node." |
| 109 // In the case of a tree that is detached from the document, we violate | 109 // In the case of a tree that is detached from the document, we violate |
| 110 // the spec and treat / as the root node of the detached tree. | 110 // the spec and treat / as the root node of the detached tree. |
| 111 // This is for compatibility with Firefox, and also seems like a more | 111 // This is for compatibility with Firefox, and also seems like a more |
| 112 // logical treatment of where you would expect the "root" to be. | 112 // logical treatment of where you would expect the "root" to be. |
| 113 Node* context = evaluationContext.node.get(); | 113 Node* context = evaluationContext.node.get(); |
| 114 if (m_absolute && context->nodeType() != Node::DOCUMENT_NODE) { | 114 if (m_absolute && context->getNodeType() != Node::DOCUMENT_NODE) { |
| 115 if (context->inDocument()) | 115 if (context->inDocument()) |
| 116 context = context->ownerDocument(); | 116 context = context->ownerDocument(); |
| 117 else | 117 else |
| 118 context = &NodeTraversal::highestAncestorOrSelf(*context); | 118 context = &NodeTraversal::highestAncestorOrSelf(*context); |
| 119 } | 119 } |
| 120 | 120 |
| 121 NodeSet* nodes = NodeSet::create(); | 121 NodeSet* nodes = NodeSet::create(); |
| 122 nodes->append(context); | 122 nodes->append(context); |
| 123 evaluate(clonedContext, *nodes); | 123 evaluate(clonedContext, *nodes); |
| 124 | 124 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 NodeSet& nodes = v.modifiableNodeSet(context); | 210 NodeSet& nodes = v.modifiableNodeSet(context); |
| 211 m_path->evaluate(context, nodes); | 211 m_path->evaluate(context, nodes); |
| 212 | 212 |
| 213 return v; | 213 return v; |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace XPath | 216 } // namespace XPath |
| 217 | 217 |
| 218 } // namespace blink | 218 } // namespace blink |
| OLD | NEW |