| 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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 namespace XPath { | 38 namespace XPath { |
| 39 | 39 |
| 40 Number::Number(double value) | 40 Number::Number(double value) |
| 41 : m_value(value) | 41 : m_value(value) |
| 42 { | 42 { |
| 43 } | 43 } |
| 44 | 44 |
| 45 void Number::trace(Visitor* visitor) | 45 DEFINE_TRACE(Number) |
| 46 { | 46 { |
| 47 visitor->trace(m_value); | 47 visitor->trace(m_value); |
| 48 Expression::trace(visitor); | 48 Expression::trace(visitor); |
| 49 } | 49 } |
| 50 | 50 |
| 51 Value Number::evaluate(EvaluationContext&) const | 51 Value Number::evaluate(EvaluationContext&) const |
| 52 { | 52 { |
| 53 return m_value; | 53 return m_value; |
| 54 } | 54 } |
| 55 | 55 |
| 56 StringExpression::StringExpression(const String& value) | 56 StringExpression::StringExpression(const String& value) |
| 57 : m_value(value) | 57 : m_value(value) |
| 58 { | 58 { |
| 59 } | 59 } |
| 60 | 60 |
| 61 void StringExpression::trace(Visitor* visitor) | 61 DEFINE_TRACE(StringExpression) |
| 62 { | 62 { |
| 63 visitor->trace(m_value); | 63 visitor->trace(m_value); |
| 64 Expression::trace(visitor); | 64 Expression::trace(visitor); |
| 65 } | 65 } |
| 66 | 66 |
| 67 Value StringExpression::evaluate(EvaluationContext&) const | 67 Value StringExpression::evaluate(EvaluationContext&) const |
| 68 { | 68 { |
| 69 return m_value; | 69 return m_value; |
| 70 } | 70 } |
| 71 | 71 |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 return lhsResult; | 274 return lhsResult; |
| 275 } | 275 } |
| 276 | 276 |
| 277 Predicate::Predicate(PassOwnPtrWillBeRawPtr<Expression> expr) | 277 Predicate::Predicate(PassOwnPtrWillBeRawPtr<Expression> expr) |
| 278 : m_expr(expr) | 278 : m_expr(expr) |
| 279 { | 279 { |
| 280 } | 280 } |
| 281 | 281 |
| 282 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Predicate); | 282 DEFINE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(Predicate); |
| 283 | 283 |
| 284 void Predicate::trace(Visitor* visitor) | 284 DEFINE_TRACE(Predicate) |
| 285 { | 285 { |
| 286 visitor->trace(m_expr); | 286 visitor->trace(m_expr); |
| 287 } | 287 } |
| 288 | 288 |
| 289 bool Predicate::evaluate(EvaluationContext& context) const | 289 bool Predicate::evaluate(EvaluationContext& context) const |
| 290 { | 290 { |
| 291 ASSERT(m_expr); | 291 ASSERT(m_expr); |
| 292 | 292 |
| 293 Value result(m_expr->evaluate(context)); | 293 Value result(m_expr->evaluate(context)); |
| 294 | 294 |
| 295 // foo[3] means foo[position()=3] | 295 // foo[3] means foo[position()=3] |
| 296 if (result.isNumber()) | 296 if (result.isNumber()) |
| 297 return EqTestOp(EqTestOp::OpcodeEqual, adoptPtrWillBeNoop(createFunction
("position")), adoptPtrWillBeNoop(new Number(result.toNumber()))).evaluate(conte
xt).toBoolean(); | 297 return EqTestOp(EqTestOp::OpcodeEqual, adoptPtrWillBeNoop(createFunction
("position")), adoptPtrWillBeNoop(new Number(result.toNumber()))).evaluate(conte
xt).toBoolean(); |
| 298 | 298 |
| 299 return result.toBoolean(); | 299 return result.toBoolean(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 } | 302 } |
| 303 } | 303 } |
| OLD | NEW |