| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 if (m_min == Inf) | 285 if (m_min == Inf) |
| 286 return value <= m_max; | 286 return value <= m_max; |
| 287 | 287 |
| 288 if (m_max == Inf) | 288 if (m_max == Inf) |
| 289 return value >= m_min; | 289 return value >= m_min; |
| 290 | 290 |
| 291 return value >= m_min && value <= m_max; | 291 return value >= m_min && value <= m_max; |
| 292 } | 292 } |
| 293 | 293 |
| 294 void Function::setArguments(WillBeHeapVector<OwnPtrWillBeMember<Expression> >& a
rgs) | 294 void Function::setArguments(WillBeHeapVector<OwnPtrWillBeMember<Expression>>& ar
gs) |
| 295 { | 295 { |
| 296 ASSERT(!subExprCount()); | 296 ASSERT(!subExprCount()); |
| 297 | 297 |
| 298 // Some functions use context node as implicit argument, so when explicit ar
guments are added, they may no longer be context node sensitive. | 298 // Some functions use context node as implicit argument, so when explicit ar
guments are added, they may no longer be context node sensitive. |
| 299 if (m_name != "lang" && !args.isEmpty()) | 299 if (m_name != "lang" && !args.isEmpty()) |
| 300 setIsContextNodeSensitive(false); | 300 setIsContextNodeSensitive(false); |
| 301 | 301 |
| 302 WillBeHeapVector<OwnPtrWillBeMember<Expression> >::iterator end = args.end()
; | 302 WillBeHeapVector<OwnPtrWillBeMember<Expression>>::iterator end = args.end(); |
| 303 for (WillBeHeapVector<OwnPtrWillBeMember<Expression> >::iterator it = args.b
egin(); it != end; ++it) | 303 for (WillBeHeapVector<OwnPtrWillBeMember<Expression>>::iterator it = args.be
gin(); it != end; ++it) |
| 304 addSubExpression(it->release()); | 304 addSubExpression(it->release()); |
| 305 } | 305 } |
| 306 | 306 |
| 307 Value FunLast::evaluate(EvaluationContext& context) const | 307 Value FunLast::evaluate(EvaluationContext& context) const |
| 308 { | 308 { |
| 309 return context.size; | 309 return context.size; |
| 310 } | 310 } |
| 311 | 311 |
| 312 Value FunPosition::evaluate(EvaluationContext& context) const | 312 Value FunPosition::evaluate(EvaluationContext& context) const |
| 313 { | 313 { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 326 idList.append(str); | 326 idList.append(str); |
| 327 idList.append(' '); | 327 idList.append(' '); |
| 328 } | 328 } |
| 329 } else { | 329 } else { |
| 330 String str = a.toString(); | 330 String str = a.toString(); |
| 331 idList.append(str); | 331 idList.append(str); |
| 332 } | 332 } |
| 333 | 333 |
| 334 TreeScope& contextScope = context.node->treeScope(); | 334 TreeScope& contextScope = context.node->treeScope(); |
| 335 OwnPtrWillBeRawPtr<NodeSet> result(NodeSet::create()); | 335 OwnPtrWillBeRawPtr<NodeSet> result(NodeSet::create()); |
| 336 WillBeHeapHashSet<RawPtrWillBeMember<Node> > resultSet; | 336 WillBeHeapHashSet<RawPtrWillBeMember<Node>> resultSet; |
| 337 | 337 |
| 338 unsigned startPos = 0; | 338 unsigned startPos = 0; |
| 339 unsigned length = idList.length(); | 339 unsigned length = idList.length(); |
| 340 while (true) { | 340 while (true) { |
| 341 while (startPos < length && isWhitespace(idList[startPos])) | 341 while (startPos < length && isWhitespace(idList[startPos])) |
| 342 ++startPos; | 342 ++startPos; |
| 343 | 343 |
| 344 if (startPos == length) | 344 if (startPos == length) |
| 345 break; | 345 break; |
| 346 | 346 |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 }; | 720 }; |
| 721 | 721 |
| 722 functionMap = new HashMap<String, FunctionRec>; | 722 functionMap = new HashMap<String, FunctionRec>; |
| 723 for (size_t i = 0; i < WTF_ARRAY_LENGTH(functions); ++i) | 723 for (size_t i = 0; i < WTF_ARRAY_LENGTH(functions); ++i) |
| 724 functionMap->set(functions[i].name, functions[i].function); | 724 functionMap->set(functions[i].name, functions[i].function); |
| 725 } | 725 } |
| 726 | 726 |
| 727 | 727 |
| 728 Function* createFunction(const String& name) | 728 Function* createFunction(const String& name) |
| 729 { | 729 { |
| 730 WillBeHeapVector<OwnPtrWillBeMember<Expression> > args; | 730 WillBeHeapVector<OwnPtrWillBeMember<Expression>> args; |
| 731 return createFunction(name, args); | 731 return createFunction(name, args); |
| 732 } | 732 } |
| 733 | 733 |
| 734 Function* createFunction(const String& name, WillBeHeapVector<OwnPtrWillBeMember
<Expression> >& args) | 734 Function* createFunction(const String& name, WillBeHeapVector<OwnPtrWillBeMember
<Expression>>& args) |
| 735 { | 735 { |
| 736 if (!functionMap) | 736 if (!functionMap) |
| 737 createFunctionMap(); | 737 createFunctionMap(); |
| 738 | 738 |
| 739 HashMap<String, FunctionRec>::iterator functionMapIter = functionMap->find(n
ame); | 739 HashMap<String, FunctionRec>::iterator functionMapIter = functionMap->find(n
ame); |
| 740 FunctionRec* functionRec = 0; | 740 FunctionRec* functionRec = 0; |
| 741 | 741 |
| 742 if (functionMapIter == functionMap->end() || !(functionRec = &functionMapIte
r->value)->args.contains(args.size())) | 742 if (functionMapIter == functionMap->end() || !(functionRec = &functionMapIte
r->value)->args.contains(args.size())) |
| 743 return 0; | 743 return 0; |
| 744 | 744 |
| 745 Function* function = functionRec->factoryFn(); | 745 Function* function = functionRec->factoryFn(); |
| 746 function->setArguments(args); | 746 function->setArguments(args); |
| 747 function->setName(name); | 747 function->setName(name); |
| 748 return function; | 748 return function; |
| 749 } | 749 } |
| 750 | 750 |
| 751 } | 751 } |
| 752 } | 752 } |
| OLD | NEW |