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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 return value <= m_max; | 285 return value <= m_max; |
286 | 286 |
287 if (m_max == Inf) | 287 if (m_max == Inf) |
288 return value >= m_min; | 288 return value >= m_min; |
289 | 289 |
290 return value >= m_min && value <= m_max; | 290 return value >= m_min && value <= m_max; |
291 } | 291 } |
292 | 292 |
293 void Function::setArguments(HeapVector<Member<Expression>>& args) | 293 void Function::setArguments(HeapVector<Member<Expression>>& args) |
294 { | 294 { |
295 ASSERT(!subExprCount()); | 295 DCHECK(!subExprCount()); |
296 | 296 |
297 // Some functions use context node as implicit argument, so when explicit ar
guments are added, they may no longer be context node sensitive. | 297 // Some functions use context node as implicit argument, so when explicit ar
guments are added, they may no longer be context node sensitive. |
298 if (m_name != "lang" && !args.isEmpty()) | 298 if (m_name != "lang" && !args.isEmpty()) |
299 setIsContextNodeSensitive(false); | 299 setIsContextNodeSensitive(false); |
300 | 300 |
301 for (Expression* arg : args) | 301 for (Expression* arg : args) |
302 addSubExpression(arg); | 302 addSubExpression(arg); |
303 } | 303 } |
304 | 304 |
305 Value FunLast::evaluate(EvaluationContext& context) const | 305 Value FunLast::evaluate(EvaluationContext& context) const |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 return round(arg(0)->evaluate(context).toNumber()); | 699 return round(arg(0)->evaluate(context).toNumber()); |
700 } | 700 } |
701 | 701 |
702 struct FunctionMapping { | 702 struct FunctionMapping { |
703 const char* name; | 703 const char* name; |
704 FunctionRec function; | 704 FunctionRec function; |
705 }; | 705 }; |
706 | 706 |
707 static void createFunctionMap() | 707 static void createFunctionMap() |
708 { | 708 { |
709 ASSERT(!functionMap); | 709 DCHECK(!functionMap); |
710 const FunctionMapping functions[] = { | 710 const FunctionMapping functions[] = { |
711 { "boolean", { &createFunBoolean, 1 } }, | 711 { "boolean", { &createFunBoolean, 1 } }, |
712 { "ceiling", { &createFunCeiling, 1 } }, | 712 { "ceiling", { &createFunCeiling, 1 } }, |
713 { "concat", { &createFunConcat, Interval(2, Interval::Inf) } }, | 713 { "concat", { &createFunConcat, Interval(2, Interval::Inf) } }, |
714 { "contains", { &createFunContains, 2 } }, | 714 { "contains", { &createFunContains, 2 } }, |
715 { "count", { &createFunCount, 1 } }, | 715 { "count", { &createFunCount, 1 } }, |
716 { "false", { &createFunFalse, 0 } }, | 716 { "false", { &createFunFalse, 0 } }, |
717 { "floor", { &createFunFloor, 1 } }, | 717 { "floor", { &createFunFloor, 1 } }, |
718 { "id", { &createFunId, 1 } }, | 718 { "id", { &createFunId, 1 } }, |
719 { "lang", { &createFunLang, 1 } }, | 719 { "lang", { &createFunLang, 1 } }, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 return nullptr; | 761 return nullptr; |
762 | 762 |
763 Function* function = functionRec->factoryFn(); | 763 Function* function = functionRec->factoryFn(); |
764 function->setArguments(args); | 764 function->setArguments(args); |
765 function->setName(name); | 765 function->setName(name); |
766 return function; | 766 return function; |
767 } | 767 } |
768 | 768 |
769 } // namespace XPath | 769 } // namespace XPath |
770 } // namespace blink | 770 } // namespace blink |
OLD | NEW |