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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // "A / by itself selects the root node of the document containing the conte
xt node." | 98 // "A / by itself selects the root node of the document containing the conte
xt node." |
99 // In the case of a tree that is detached from the document, we violate | 99 // In the case of a tree that is detached from the document, we violate |
100 // the spec and treat / as the root node of the detached tree. | 100 // the spec and treat / as the root node of the detached tree. |
101 // This is for compatibility with Firefox, and also seems like a more | 101 // This is for compatibility with Firefox, and also seems like a more |
102 // logical treatment of where you would expect the "root" to be. | 102 // logical treatment of where you would expect the "root" to be. |
103 Node* context = evaluationContext.node.get(); | 103 Node* context = evaluationContext.node.get(); |
104 if (m_absolute && context->nodeType() != Node::DOCUMENT_NODE) { | 104 if (m_absolute && context->nodeType() != Node::DOCUMENT_NODE) { |
105 if (context->inDocument()) | 105 if (context->inDocument()) |
106 context = context->ownerDocument(); | 106 context = context->ownerDocument(); |
107 else | 107 else |
108 context = context->highestAncestor(); | 108 context = &context->highestAncestor(); |
109 } | 109 } |
110 | 110 |
111 NodeSet nodes; | 111 NodeSet nodes; |
112 nodes.append(context); | 112 nodes.append(context); |
113 evaluate(nodes); | 113 evaluate(nodes); |
114 | 114 |
115 evaluationContext = backupContext; | 115 evaluationContext = backupContext; |
116 return Value(nodes, Value::adopt); | 116 return Value(nodes, Value::adopt); |
117 } | 117 } |
118 | 118 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 Value v = m_filter->evaluate(); | 205 Value v = m_filter->evaluate(); |
206 | 206 |
207 NodeSet& nodes = v.modifiableNodeSet(); | 207 NodeSet& nodes = v.modifiableNodeSet(); |
208 m_path->evaluate(nodes); | 208 m_path->evaluate(nodes); |
209 | 209 |
210 return v; | 210 return v; |
211 } | 211 } |
212 | 212 |
213 } | 213 } |
214 } | 214 } |
OLD | NEW |