| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> |
| 3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 } | 249 } |
| 250 | 250 |
| 251 Value Union::evaluate(EvaluationContext& context) const | 251 Value Union::evaluate(EvaluationContext& context) const |
| 252 { | 252 { |
| 253 Value lhsResult = subExpr(0)->evaluate(context); | 253 Value lhsResult = subExpr(0)->evaluate(context); |
| 254 Value rhs = subExpr(1)->evaluate(context); | 254 Value rhs = subExpr(1)->evaluate(context); |
| 255 | 255 |
| 256 NodeSet& resultSet = lhsResult.modifiableNodeSet(context); | 256 NodeSet& resultSet = lhsResult.modifiableNodeSet(context); |
| 257 const NodeSet& rhsNodes = rhs.toNodeSet(&context); | 257 const NodeSet& rhsNodes = rhs.toNodeSet(&context); |
| 258 | 258 |
| 259 WillBeHeapHashSet<RawPtrWillBeMember<Node>> nodes; | 259 HeapHashSet<Member<Node>> nodes; |
| 260 for (size_t i = 0; i < resultSet.size(); ++i) | 260 for (size_t i = 0; i < resultSet.size(); ++i) |
| 261 nodes.add(resultSet[i]); | 261 nodes.add(resultSet[i]); |
| 262 | 262 |
| 263 for (size_t i = 0; i < rhsNodes.size(); ++i) { | 263 for (size_t i = 0; i < rhsNodes.size(); ++i) { |
| 264 Node* node = rhsNodes[i]; | 264 Node* node = rhsNodes[i]; |
| 265 if (nodes.add(node).isNewEntry) | 265 if (nodes.add(node).isNewEntry) |
| 266 resultSet.append(node); | 266 resultSet.append(node); |
| 267 } | 267 } |
| 268 | 268 |
| 269 // It is also possible to use merge sort to avoid making the result | 269 // It is also possible to use merge sort to avoid making the result |
| (...skipping 22 matching lines...) Expand all Loading... |
| 292 // foo[3] means foo[position()=3] | 292 // foo[3] means foo[position()=3] |
| 293 if (result.isNumber()) | 293 if (result.isNumber()) |
| 294 return EqTestOp(EqTestOp::OpcodeEqual, createFunction("position"), new N
umber(result.toNumber())).evaluate(context).toBoolean(); | 294 return EqTestOp(EqTestOp::OpcodeEqual, createFunction("position"), new N
umber(result.toNumber())).evaluate(context).toBoolean(); |
| 295 | 295 |
| 296 return result.toBoolean(); | 296 return result.toBoolean(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 } // namespace XPath | 299 } // namespace XPath |
| 300 | 300 |
| 301 } // namespace blink | 301 } // namespace blink |
| OLD | NEW |