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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
484 | 484 |
485 return true; | 485 return true; |
486 } | 486 } |
487 | 487 |
488 void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin OrEnd) | 488 void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin OrEnd) |
489 { | 489 { |
490 Vector<SMILTimeWithOrigin>& timeList = beginOrEnd == Begin ? m_beginTimes : m_endTimes; | 490 Vector<SMILTimeWithOrigin>& timeList = beginOrEnd == Begin ? m_beginTimes : m_endTimes; |
491 if (beginOrEnd == End) | 491 if (beginOrEnd == End) |
492 m_hasEndEventConditions = false; | 492 m_hasEndEventConditions = false; |
493 HashSet<double> existing; | 493 HashSet<double> existing; |
494 for (unsigned n = 0; n < timeList.size(); ++n) | 494 for (unsigned n = 0; n < timeList.size(); ++n) { |
495 existing.add(timeList[n].time().value()); | 495 if (!timeList[n].time().isUnresolved()) |
496 existing.add(timeList[n].time().value()); | |
497 } | |
496 Vector<String> splitString; | 498 Vector<String> splitString; |
497 parseString.split(';', splitString); | 499 parseString.split(';', splitString); |
498 for (unsigned n = 0; n < splitString.size(); ++n) { | 500 for (unsigned n = 0; n < splitString.size(); ++n) { |
499 SMILTime value = parseClockValue(splitString[n]); | 501 SMILTime value = parseClockValue(splitString[n]); |
500 if (value.isUnresolved()) | 502 if (value.isUnresolved()) |
501 parseCondition(splitString[n], beginOrEnd); | 503 parseCondition(splitString[n], beginOrEnd); |
502 else if (!existing.contains(value.value())) | 504 else if (value.isFinite() && !existing.contains(value.value())) |
503 timeList.append(SMILTimeWithOrigin(value, SMILTimeWithOrigin::Parser Origin)); | 505 timeList.append(SMILTimeWithOrigin(value, SMILTimeWithOrigin::Parser Origin)); |
504 } | 506 } |
505 sortTimeList(timeList); | 507 sortTimeList(timeList); |
506 } | 508 } |
507 | 509 |
508 bool SVGSMILElement::isSupportedAttribute(const QualifiedName& attrName) | 510 bool SVGSMILElement::isSupportedAttribute(const QualifiedName& attrName) |
509 { | 511 { |
510 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 512 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
511 if (supportedAttributes.isEmpty()) { | 513 if (supportedAttributes.isEmpty()) { |
512 SVGTests::addSupportedAttributes(supportedAttributes); | 514 SVGTests::addSupportedAttributes(supportedAttributes); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
799 return m_cachedMin = (result.isUnresolved() || result < 0) ? 0 : result; | 801 return m_cachedMin = (result.isUnresolved() || result < 0) ? 0 : result; |
800 } | 802 } |
801 | 803 |
802 SMILTime SVGSMILElement::simpleDuration() const | 804 SMILTime SVGSMILElement::simpleDuration() const |
803 { | 805 { |
804 return std::min(dur(), SMILTime::indefinite()); | 806 return std::min(dur(), SMILTime::indefinite()); |
805 } | 807 } |
806 | 808 |
807 void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime, SMILTi meWithOrigin::Origin origin) | 809 void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime, SMILTi meWithOrigin::Origin origin) |
808 { | 810 { |
809 ASSERT(!std::isnan(beginTime.value())); | 811 ASSERT(!beginTime.isUnresolved()); |
810 m_beginTimes.append(SMILTimeWithOrigin(beginTime, origin)); | 812 m_beginTimes.append(SMILTimeWithOrigin(beginTime, origin)); |
811 sortTimeList(m_beginTimes); | 813 sortTimeList(m_beginTimes); |
812 beginListChanged(eventTime); | 814 beginListChanged(eventTime); |
813 } | 815 } |
814 | 816 |
815 void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWi thOrigin::Origin origin) | 817 void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWi thOrigin::Origin origin) |
816 { | 818 { |
817 ASSERT(!std::isnan(endTime.value())); | 819 ASSERT(!endTime.isUnresolved()); |
818 m_endTimes.append(SMILTimeWithOrigin(endTime, origin)); | 820 m_endTimes.append(SMILTimeWithOrigin(endTime, origin)); |
819 sortTimeList(m_endTimes); | 821 sortTimeList(m_endTimes); |
820 endListChanged(eventTime); | 822 endListChanged(eventTime); |
821 } | 823 } |
822 | 824 |
823 inline bool compareTimes(const SMILTimeWithOrigin& left, const SMILTimeWithOrigi n& right) | 825 inline bool compareTimes(const SMILTimeWithOrigin& left, const SMILTimeWithOrigi n& right) |
824 { | 826 { |
825 return left.time() < right.time(); | 827 return left.time() < right.time(); |
826 } | 828 } |
827 | 829 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
865 | 867 |
866 SMILTime SVGSMILElement::repeatingDuration() const | 868 SMILTime SVGSMILElement::repeatingDuration() const |
867 { | 869 { |
868 // Computing the active duration | 870 // Computing the active duration |
869 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur | 871 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur |
870 SMILTime repeatCount = this->repeatCount(); | 872 SMILTime repeatCount = this->repeatCount(); |
871 SMILTime repeatDur = this->repeatDur(); | 873 SMILTime repeatDur = this->repeatDur(); |
872 SMILTime simpleDuration = this->simpleDuration(); | 874 SMILTime simpleDuration = this->simpleDuration(); |
873 if (!simpleDuration || (repeatDur.isUnresolved() && repeatCount.isUnresolved ())) | 875 if (!simpleDuration || (repeatDur.isUnresolved() && repeatCount.isUnresolved ())) |
874 return simpleDuration; | 876 return simpleDuration; |
877 repeatDur = std::min(repeatDur, SMILTime::indefinite()); | |
875 SMILTime repeatCountDuration = simpleDuration * repeatCount; | 878 SMILTime repeatCountDuration = simpleDuration * repeatCount; |
876 return std::min(repeatCountDuration, std::min(repeatDur, SMILTime::indefinit e())); | 879 if (!repeatCountDuration.isUnresolved()) |
880 return std::min(repeatDur, repeatCountDuration); | |
881 return repeatDur; | |
877 } | 882 } |
878 | 883 |
879 SMILTime SVGSMILElement::resolveActiveEnd(SMILTime resolvedBegin, SMILTime resol vedEnd) const | 884 SMILTime SVGSMILElement::resolveActiveEnd(SMILTime resolvedBegin, SMILTime resol vedEnd) const |
880 { | 885 { |
881 // Computing the active duration | 886 // Computing the active duration |
882 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur | 887 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur |
883 SMILTime preliminaryActiveDuration; | 888 SMILTime preliminaryActiveDuration; |
884 if (!resolvedEnd.isUnresolved() && dur().isUnresolved() && repeatDur().isUnr esolved() && repeatCount().isUnresolved()) | 889 if (!resolvedEnd.isUnresolved() && dur().isUnresolved() && repeatDur().isUnr esolved() && repeatCount().isUnresolved()) |
885 preliminaryActiveDuration = resolvedEnd - resolvedBegin; | 890 preliminaryActiveDuration = resolvedEnd - resolvedBegin; |
886 else if (!resolvedEnd.isFinite()) | 891 else if (!resolvedEnd.isFinite()) |
887 preliminaryActiveDuration = repeatingDuration(); | 892 preliminaryActiveDuration = repeatingDuration(); |
888 else | 893 else |
889 preliminaryActiveDuration = std::min(repeatingDuration(), resolvedEnd - resolvedBegin); | 894 preliminaryActiveDuration = std::min(repeatingDuration(), resolvedEnd - resolvedBegin); |
890 | 895 |
896 if (preliminaryActiveDuration.isUnresolved()) | |
897 return SMILTime::unresolved(); | |
fs
2014/08/21 15:30:39
Actually,
min(maxValue, max(minValue, pAD)); pAD=
| |
898 | |
891 SMILTime minValue = this->minValue(); | 899 SMILTime minValue = this->minValue(); |
892 SMILTime maxValue = this->maxValue(); | 900 SMILTime maxValue = this->maxValue(); |
893 if (minValue > maxValue) { | 901 if (minValue > maxValue) { |
894 // Ignore both. | 902 // Ignore both. |
895 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#MinMax | 903 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#MinMax |
896 minValue = 0; | 904 minValue = 0; |
897 maxValue = SMILTime::indefinite(); | 905 maxValue = SMILTime::indefinite(); |
898 } | 906 } |
899 return resolvedBegin + std::min(maxValue, std::max(minValue, preliminaryActi veDuration)); | 907 return resolvedBegin + std::min(maxValue, std::max(minValue, preliminaryActi veDuration)); |
900 } | 908 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
933 } | 941 } |
934 | 942 |
935 void SVGSMILElement::resolveFirstInterval() | 943 void SVGSMILElement::resolveFirstInterval() |
936 { | 944 { |
937 SMILInterval firstInterval = resolveInterval(FirstInterval); | 945 SMILInterval firstInterval = resolveInterval(FirstInterval); |
938 ASSERT(!firstInterval.begin.isIndefinite()); | 946 ASSERT(!firstInterval.begin.isIndefinite()); |
939 | 947 |
940 if (!firstInterval.begin.isUnresolved() && firstInterval != m_interval) { | 948 if (!firstInterval.begin.isUnresolved() && firstInterval != m_interval) { |
941 m_interval = firstInterval; | 949 m_interval = firstInterval; |
942 notifyDependentsIntervalChanged(); | 950 notifyDependentsIntervalChanged(); |
943 m_nextProgressTime = std::min(m_nextProgressTime, m_interval.begin); | 951 m_nextProgressTime = m_nextProgressTime.isUnresolved() ? m_interval.begi n : std::min(m_nextProgressTime, m_interval.begin); |
944 | 952 |
945 if (m_timeContainer) | 953 if (m_timeContainer) |
946 m_timeContainer->notifyIntervalsChanged(); | 954 m_timeContainer->notifyIntervalsChanged(); |
947 } | 955 } |
948 } | 956 } |
949 | 957 |
950 bool SVGSMILElement::resolveNextInterval() | 958 bool SVGSMILElement::resolveNextInterval() |
951 { | 959 { |
952 SMILInterval nextInterval = resolveInterval(NextInterval); | 960 SMILInterval nextInterval = resolveInterval(NextInterval); |
953 ASSERT(!nextInterval.begin.isIndefinite()); | 961 ASSERT(!nextInterval.begin.isIndefinite()); |
954 | 962 |
955 if (!nextInterval.begin.isUnresolved() && nextInterval.begin != m_interval.b egin) { | 963 if (!nextInterval.begin.isUnresolved() && nextInterval.begin != m_interval.b egin) { |
956 m_interval = nextInterval; | 964 m_interval = nextInterval; |
957 notifyDependentsIntervalChanged(); | 965 notifyDependentsIntervalChanged(); |
958 m_nextProgressTime = std::min(m_nextProgressTime, m_interval.begin); | 966 m_nextProgressTime = m_nextProgressTime.isUnresolved() ? m_interval.begi n : std::min(m_nextProgressTime, m_interval.begin); |
959 return true; | 967 return true; |
960 } | 968 } |
961 | 969 |
962 return false; | 970 return false; |
963 } | 971 } |
964 | 972 |
965 SMILTime SVGSMILElement::nextProgressTime() const | 973 SMILTime SVGSMILElement::nextProgressTime() const |
966 { | 974 { |
967 return m_nextProgressTime; | 975 return m_nextProgressTime; |
968 } | 976 } |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1267 if (condition->type() == Condition::Syncbase && condition->syncBase() == syncBase) { | 1275 if (condition->type() == Condition::Syncbase && condition->syncBase() == syncBase) { |
1268 ASSERT(condition->name() == "begin" || condition->name() == "end"); | 1276 ASSERT(condition->name() == "begin" || condition->name() == "end"); |
1269 // No nested time containers in SVG, no need for crazy time space co nversions. Phew! | 1277 // No nested time containers in SVG, no need for crazy time space co nversions. Phew! |
1270 SMILTime time = 0; | 1278 SMILTime time = 0; |
1271 if (condition->name() == "begin") | 1279 if (condition->name() == "begin") |
1272 time = syncBase->m_interval.begin + condition->offset(); | 1280 time = syncBase->m_interval.begin + condition->offset(); |
1273 else | 1281 else |
1274 time = syncBase->m_interval.end + condition->offset(); | 1282 time = syncBase->m_interval.end + condition->offset(); |
1275 if (!time.isFinite()) | 1283 if (!time.isFinite()) |
1276 continue; | 1284 continue; |
1285 SMILTime elapsed = this->elapsed(); | |
1286 if (elapsed.isUnresolved()) | |
1287 return; | |
fs
2014/08/21 15:30:39
return => continue
reni
2014/08/21 20:52:31
Done.
| |
1277 if (condition->beginOrEnd() == Begin) | 1288 if (condition->beginOrEnd() == Begin) |
1278 addBeginTime(elapsed(), time); | 1289 addBeginTime(elapsed, time); |
1279 else | 1290 else |
1280 addEndTime(elapsed(), time); | 1291 addEndTime(elapsed, time); |
1281 } | 1292 } |
1282 } | 1293 } |
1283 } | 1294 } |
1284 | 1295 |
1285 void SVGSMILElement::addSyncBaseDependent(SVGSMILElement* animation) | 1296 void SVGSMILElement::addSyncBaseDependent(SVGSMILElement* animation) |
1286 { | 1297 { |
1287 m_syncBaseDependents.add(animation); | 1298 m_syncBaseDependents.add(animation); |
1288 if (m_interval.begin.isFinite()) | 1299 if (m_interval.begin.isFinite()) |
1289 animation->createInstanceTimesFromSyncbase(this); | 1300 animation->createInstanceTimesFromSyncbase(this); |
1290 } | 1301 } |
1291 | 1302 |
1292 void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement* animation) | 1303 void SVGSMILElement::removeSyncBaseDependent(SVGSMILElement* animation) |
1293 { | 1304 { |
1294 m_syncBaseDependents.remove(animation); | 1305 m_syncBaseDependents.remove(animation); |
1295 } | 1306 } |
1296 | 1307 |
1297 void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition) | 1308 void SVGSMILElement::handleConditionEvent(Event* event, Condition* condition) |
1298 { | 1309 { |
1299 if (event->type() == "repeatn" && toRepeatEvent(event)->repeat() != conditio n->repeat()) | 1310 if (event->type() == "repeatn" && toRepeatEvent(event)->repeat() != conditio n->repeat()) |
1300 return; | 1311 return; |
1301 | 1312 |
1302 SMILTime elapsed = this->elapsed(); | 1313 SMILTime elapsed = this->elapsed(); |
1314 if (elapsed.isUnresolved()) | |
1315 return; | |
1303 if (condition->beginOrEnd() == Begin) | 1316 if (condition->beginOrEnd() == Begin) |
1304 addBeginTime(elapsed, elapsed + condition->offset()); | 1317 addBeginTime(elapsed, elapsed + condition->offset()); |
1305 else | 1318 else |
1306 addEndTime(elapsed, elapsed + condition->offset()); | 1319 addEndTime(elapsed, elapsed + condition->offset()); |
1307 } | 1320 } |
1308 | 1321 |
1309 void SVGSMILElement::beginByLinkActivation() | 1322 void SVGSMILElement::beginByLinkActivation() |
1310 { | 1323 { |
1311 SMILTime elapsed = this->elapsed(); | 1324 SMILTime elapsed = this->elapsed(); |
1325 if (elapsed.isUnresolved()) | |
1326 return; | |
1312 addBeginTime(elapsed, elapsed); | 1327 addBeginTime(elapsed, elapsed); |
1313 } | 1328 } |
1314 | 1329 |
1315 void SVGSMILElement::endedActiveInterval() | 1330 void SVGSMILElement::endedActiveInterval() |
1316 { | 1331 { |
1317 clearTimesWithDynamicOrigins(m_beginTimes); | 1332 clearTimesWithDynamicOrigins(m_beginTimes); |
1318 clearTimesWithDynamicOrigins(m_endTimes); | 1333 clearTimesWithDynamicOrigins(m_endTimes); |
1319 } | 1334 } |
1320 | 1335 |
1321 void SVGSMILElement::dispatchRepeatEvents(unsigned count) | 1336 void SVGSMILElement::dispatchRepeatEvents(unsigned count) |
(...skipping 30 matching lines...) Expand all Loading... | |
1352 #if ENABLE(OILPAN) | 1367 #if ENABLE(OILPAN) |
1353 visitor->trace(m_targetElement); | 1368 visitor->trace(m_targetElement); |
1354 visitor->trace(m_timeContainer); | 1369 visitor->trace(m_timeContainer); |
1355 visitor->trace(m_conditions); | 1370 visitor->trace(m_conditions); |
1356 visitor->trace(m_syncBaseDependents); | 1371 visitor->trace(m_syncBaseDependents); |
1357 #endif | 1372 #endif |
1358 SVGElement::trace(visitor); | 1373 SVGElement::trace(visitor); |
1359 } | 1374 } |
1360 | 1375 |
1361 } | 1376 } |
OLD | NEW |