| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 size_t doublePointOne = parse.find(':'); | 370 size_t doublePointOne = parse.find(':'); |
| 371 size_t doublePointTwo = parse.find(':', doublePointOne + 1); | 371 size_t doublePointTwo = parse.find(':', doublePointOne + 1); |
| 372 if (doublePointOne == 2 && doublePointTwo == 5 && parse.length() >= 8) { | 372 if (doublePointOne == 2 && doublePointTwo == 5 && parse.length() >= 8) { |
| 373 result += parse.substring(0, 2).toUIntStrict(&ok) * 60 * 60; | 373 result += parse.substring(0, 2).toUIntStrict(&ok) * 60 * 60; |
| 374 if (!ok) | 374 if (!ok) |
| 375 return SMILTime::unresolved(); | 375 return SMILTime::unresolved(); |
| 376 result += parse.substring(3, 2).toUIntStrict(&ok) * 60; | 376 result += parse.substring(3, 2).toUIntStrict(&ok) * 60; |
| 377 if (!ok) | 377 if (!ok) |
| 378 return SMILTime::unresolved(); | 378 return SMILTime::unresolved(); |
| 379 result += parse.substring(6).toDouble(&ok); | 379 result += parse.substring(6).toDouble(&ok); |
| 380 } else if (doublePointOne == 2 && doublePointTwo == notFound && parse.length
() >= 5) { | 380 } else if (doublePointOne == 2 && doublePointTwo == kNotFound && parse.lengt
h() >= 5) { |
| 381 result += parse.substring(0, 2).toUIntStrict(&ok) * 60; | 381 result += parse.substring(0, 2).toUIntStrict(&ok) * 60; |
| 382 if (!ok) | 382 if (!ok) |
| 383 return SMILTime::unresolved(); | 383 return SMILTime::unresolved(); |
| 384 result += parse.substring(3).toDouble(&ok); | 384 result += parse.substring(3).toDouble(&ok); |
| 385 } else | 385 } else |
| 386 return parseOffsetValue(parse); | 386 return parseOffsetValue(parse); |
| 387 | 387 |
| 388 if (!ok) | 388 if (!ok) |
| 389 return SMILTime::unresolved(); | 389 return SMILTime::unresolved(); |
| 390 return result; | 390 return result; |
| 391 } | 391 } |
| 392 | 392 |
| 393 static void sortTimeList(Vector<SMILTimeWithOrigin>& timeList) | 393 static void sortTimeList(Vector<SMILTimeWithOrigin>& timeList) |
| 394 { | 394 { |
| 395 std::sort(timeList.begin(), timeList.end()); | 395 std::sort(timeList.begin(), timeList.end()); |
| 396 } | 396 } |
| 397 | 397 |
| 398 bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd) | 398 bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd) |
| 399 { | 399 { |
| 400 String parseString = value.stripWhiteSpace(); | 400 String parseString = value.stripWhiteSpace(); |
| 401 | 401 |
| 402 double sign = 1.; | 402 double sign = 1.; |
| 403 bool ok; | 403 bool ok; |
| 404 size_t pos = parseString.find('+'); | 404 size_t pos = parseString.find('+'); |
| 405 if (pos == notFound) { | 405 if (pos == kNotFound) { |
| 406 pos = parseString.find('-'); | 406 pos = parseString.find('-'); |
| 407 if (pos != notFound) | 407 if (pos != kNotFound) |
| 408 sign = -1.; | 408 sign = -1.; |
| 409 } | 409 } |
| 410 String conditionString; | 410 String conditionString; |
| 411 SMILTime offset = 0; | 411 SMILTime offset = 0; |
| 412 if (pos == notFound) | 412 if (pos == kNotFound) |
| 413 conditionString = parseString; | 413 conditionString = parseString; |
| 414 else { | 414 else { |
| 415 conditionString = parseString.left(pos).stripWhiteSpace(); | 415 conditionString = parseString.left(pos).stripWhiteSpace(); |
| 416 String offsetString = parseString.substring(pos + 1).stripWhiteSpace(); | 416 String offsetString = parseString.substring(pos + 1).stripWhiteSpace(); |
| 417 offset = parseOffsetValue(offsetString); | 417 offset = parseOffsetValue(offsetString); |
| 418 if (offset.isUnresolved()) | 418 if (offset.isUnresolved()) |
| 419 return false; | 419 return false; |
| 420 offset = offset * sign; | 420 offset = offset * sign; |
| 421 } | 421 } |
| 422 if (conditionString.isEmpty()) | 422 if (conditionString.isEmpty()) |
| 423 return false; | 423 return false; |
| 424 pos = conditionString.find('.'); | 424 pos = conditionString.find('.'); |
| 425 | 425 |
| 426 String baseID; | 426 String baseID; |
| 427 String nameString; | 427 String nameString; |
| 428 if (pos == notFound) | 428 if (pos == kNotFound) |
| 429 nameString = conditionString; | 429 nameString = conditionString; |
| 430 else { | 430 else { |
| 431 baseID = conditionString.left(pos); | 431 baseID = conditionString.left(pos); |
| 432 nameString = conditionString.substring(pos + 1); | 432 nameString = conditionString.substring(pos + 1); |
| 433 } | 433 } |
| 434 if (nameString.isEmpty()) | 434 if (nameString.isEmpty()) |
| 435 return false; | 435 return false; |
| 436 | 436 |
| 437 Condition::Type type; | 437 Condition::Type type; |
| 438 int repeat = -1; | 438 int repeat = -1; |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 if (eventType == "repeatn") { | 1286 if (eventType == "repeatn") { |
| 1287 unsigned repeatEventCount = m_repeatEventCountList.first(); | 1287 unsigned repeatEventCount = m_repeatEventCountList.first(); |
| 1288 m_repeatEventCountList.remove(0); | 1288 m_repeatEventCountList.remove(0); |
| 1289 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); | 1289 dispatchEvent(RepeatEvent::create(eventType, repeatEventCount)); |
| 1290 } else { | 1290 } else { |
| 1291 dispatchEvent(Event::create(eventType)); | 1291 dispatchEvent(Event::create(eventType)); |
| 1292 } | 1292 } |
| 1293 } | 1293 } |
| 1294 | 1294 |
| 1295 } | 1295 } |
| OLD | NEW |