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().isFinite()) |
fs
2014/08/19 21:49:43
Could this be isUnresolved instead? I.e. I don't s
reni
2014/08/21 14:20:06
Done.
| |
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())) |
fs
2014/08/19 21:49:44
I think 'indefinite' is [sometimes] valid here, so
reni
2014/08/21 14:20:06
HashSet can really contain Inf value without conse
fs
2014/08/21 15:30:39
Ok. I noticed:
static T emptyValue() { return
reni
2014/08/21 20:52:31
I agree with =/, but done :)
| |
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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 { | 796 { |
795 if (m_cachedMin != invalidCachedTime) | 797 if (m_cachedMin != invalidCachedTime) |
796 return m_cachedMin; | 798 return m_cachedMin; |
797 const AtomicString& value = fastGetAttribute(SVGNames::minAttr); | 799 const AtomicString& value = fastGetAttribute(SVGNames::minAttr); |
798 SMILTime result = parseClockValue(value); | 800 SMILTime result = parseClockValue(value); |
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 SMILTime duration = dur(); |
807 return duration.isUnresolved() ? SMILTime::indefinite() : duration; | |
fs
2014/08/19 21:49:44
I think this could've been left as min(), but mayb
reni
2014/08/21 14:20:06
Done.
| |
805 } | 808 } |
806 | 809 |
807 void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime, SMILTi meWithOrigin::Origin origin) | 810 void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime, SMILTi meWithOrigin::Origin origin) |
808 { | 811 { |
809 ASSERT(!std::isnan(beginTime.value())); | 812 if (!beginTime.isFinite()) |
fs
2014/08/19 21:49:43
Could we drop this (and the below) back to asserts
reni
2014/08/21 14:20:06
I set them back to asserts. However, are we sure t
fs
2014/08/21 15:30:39
If nothing else, they serve to communicate the pre
reni
2014/08/21 20:52:31
They are dropped.
| |
813 return; | |
810 m_beginTimes.append(SMILTimeWithOrigin(beginTime, origin)); | 814 m_beginTimes.append(SMILTimeWithOrigin(beginTime, origin)); |
811 sortTimeList(m_beginTimes); | 815 sortTimeList(m_beginTimes); |
812 beginListChanged(eventTime); | 816 beginListChanged(eventTime); |
813 } | 817 } |
814 | 818 |
815 void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWi thOrigin::Origin origin) | 819 void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWi thOrigin::Origin origin) |
816 { | 820 { |
817 ASSERT(!std::isnan(endTime.value())); | 821 if (!endTime.isFinite()) |
822 return; | |
818 m_endTimes.append(SMILTimeWithOrigin(endTime, origin)); | 823 m_endTimes.append(SMILTimeWithOrigin(endTime, origin)); |
819 sortTimeList(m_endTimes); | 824 sortTimeList(m_endTimes); |
820 endListChanged(eventTime); | 825 endListChanged(eventTime); |
821 } | 826 } |
822 | 827 |
823 inline bool compareTimes(const SMILTimeWithOrigin& left, const SMILTimeWithOrigi n& right) | 828 inline bool compareTimes(const SMILTimeWithOrigin& left, const SMILTimeWithOrigi n& right) |
824 { | 829 { |
825 return left.time() < right.time(); | 830 return left.time() < right.time(); |
826 } | 831 } |
827 | 832 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
866 SMILTime SVGSMILElement::repeatingDuration() const | 871 SMILTime SVGSMILElement::repeatingDuration() const |
867 { | 872 { |
868 // Computing the active duration | 873 // Computing the active duration |
869 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur | 874 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur |
870 SMILTime repeatCount = this->repeatCount(); | 875 SMILTime repeatCount = this->repeatCount(); |
871 SMILTime repeatDur = this->repeatDur(); | 876 SMILTime repeatDur = this->repeatDur(); |
872 SMILTime simpleDuration = this->simpleDuration(); | 877 SMILTime simpleDuration = this->simpleDuration(); |
873 if (!simpleDuration || (repeatDur.isUnresolved() && repeatCount.isUnresolved ())) | 878 if (!simpleDuration || (repeatDur.isUnresolved() && repeatCount.isUnresolved ())) |
874 return simpleDuration; | 879 return simpleDuration; |
875 SMILTime repeatCountDuration = simpleDuration * repeatCount; | 880 SMILTime repeatCountDuration = simpleDuration * repeatCount; |
881 if (repeatCountDuration.isUnresolved()) | |
882 return std::min(repeatDur, SMILTime::indefinite()); | |
fs
2014/08/19 21:49:44
This would probably look more obvious if the min(r
reni
2014/08/21 14:20:07
Done.
| |
876 return std::min(repeatCountDuration, std::min(repeatDur, SMILTime::indefinit e())); | 883 return std::min(repeatCountDuration, std::min(repeatDur, SMILTime::indefinit e())); |
877 } | 884 } |
878 | 885 |
879 SMILTime SVGSMILElement::resolveActiveEnd(SMILTime resolvedBegin, SMILTime resol vedEnd) const | 886 SMILTime SVGSMILElement::resolveActiveEnd(SMILTime resolvedBegin, SMILTime resol vedEnd) const |
880 { | 887 { |
881 // Computing the active duration | 888 // Computing the active duration |
882 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur | 889 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur |
883 SMILTime preliminaryActiveDuration; | 890 SMILTime preliminaryActiveDuration; |
884 if (!resolvedEnd.isUnresolved() && dur().isUnresolved() && repeatDur().isUnr esolved() && repeatCount().isUnresolved()) | 891 if (!resolvedEnd.isUnresolved() && dur().isUnresolved() && repeatDur().isUnr esolved() && repeatCount().isUnresolved()) |
885 preliminaryActiveDuration = resolvedEnd - resolvedBegin; | 892 preliminaryActiveDuration = resolvedEnd - resolvedBegin; |
886 else if (!resolvedEnd.isFinite()) | 893 else if (!resolvedEnd.isFinite()) |
887 preliminaryActiveDuration = repeatingDuration(); | 894 preliminaryActiveDuration = repeatingDuration(); |
888 else | 895 else |
889 preliminaryActiveDuration = std::min(repeatingDuration(), resolvedEnd - resolvedBegin); | 896 preliminaryActiveDuration = std::min(repeatingDuration(), resolvedEnd - resolvedBegin); |
890 | 897 |
891 SMILTime minValue = this->minValue(); | 898 SMILTime minValue = this->minValue(); |
892 SMILTime maxValue = this->maxValue(); | 899 SMILTime maxValue = this->maxValue(); |
893 if (minValue > maxValue) { | 900 if (minValue > maxValue) { |
894 // Ignore both. | 901 // Ignore both. |
895 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#MinMax | 902 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#MinMax |
896 minValue = 0; | 903 minValue = 0; |
897 maxValue = SMILTime::indefinite(); | 904 maxValue = SMILTime::indefinite(); |
898 } | 905 } |
899 return resolvedBegin + std::min(maxValue, std::max(minValue, preliminaryActi veDuration)); | 906 return resolvedBegin + (preliminaryActiveDuration.isUnresolved() ? prelimina ryActiveDuration : std::max(minValue, preliminaryActiveDuration)); |
fs
2014/08/19 21:49:44
Looks like maxValue disappeared? Also, if |prelimi
reni
2014/08/21 14:20:07
Done.
| |
900 } | 907 } |
901 | 908 |
902 SMILInterval SVGSMILElement::resolveInterval(ResolveInterval resolveIntervalType ) const | 909 SMILInterval SVGSMILElement::resolveInterval(ResolveInterval resolveIntervalType ) const |
903 { | 910 { |
904 bool first = resolveIntervalType == FirstInterval; | 911 bool first = resolveIntervalType == FirstInterval; |
905 // See the pseudocode in http://www.w3.org/TR/SMIL3/smil-timing.html#q90. | 912 // See the pseudocode in http://www.w3.org/TR/SMIL3/smil-timing.html#q90. |
906 SMILTime beginAfter = first ? -std::numeric_limits<double>::infinity() : m_i nterval.end; | 913 SMILTime beginAfter = first ? -std::numeric_limits<double>::infinity() : m_i nterval.end; |
907 SMILTime lastIntervalTempEnd = std::numeric_limits<double>::infinity(); | 914 SMILTime lastIntervalTempEnd = std::numeric_limits<double>::infinity(); |
908 while (true) { | 915 while (true) { |
909 bool equalsMinimumOK = !first || m_interval.end > m_interval.begin; | 916 bool equalsMinimumOK = !first || m_interval.end > m_interval.begin; |
(...skipping 23 matching lines...) Expand all Loading... | |
933 } | 940 } |
934 | 941 |
935 void SVGSMILElement::resolveFirstInterval() | 942 void SVGSMILElement::resolveFirstInterval() |
936 { | 943 { |
937 SMILInterval firstInterval = resolveInterval(FirstInterval); | 944 SMILInterval firstInterval = resolveInterval(FirstInterval); |
938 ASSERT(!firstInterval.begin.isIndefinite()); | 945 ASSERT(!firstInterval.begin.isIndefinite()); |
939 | 946 |
940 if (!firstInterval.begin.isUnresolved() && firstInterval != m_interval) { | 947 if (!firstInterval.begin.isUnresolved() && firstInterval != m_interval) { |
941 m_interval = firstInterval; | 948 m_interval = firstInterval; |
942 notifyDependentsIntervalChanged(); | 949 notifyDependentsIntervalChanged(); |
943 m_nextProgressTime = std::min(m_nextProgressTime, m_interval.begin); | 950 m_nextProgressTime = m_nextProgressTime.isUnresolved() ? m_interval.begi n : std::min(m_nextProgressTime, m_interval.begin); |
944 | 951 |
945 if (m_timeContainer) | 952 if (m_timeContainer) |
946 m_timeContainer->notifyIntervalsChanged(); | 953 m_timeContainer->notifyIntervalsChanged(); |
947 } | 954 } |
948 } | 955 } |
949 | 956 |
950 bool SVGSMILElement::resolveNextInterval() | 957 bool SVGSMILElement::resolveNextInterval() |
951 { | 958 { |
952 SMILInterval nextInterval = resolveInterval(NextInterval); | 959 SMILInterval nextInterval = resolveInterval(NextInterval); |
953 ASSERT(!nextInterval.begin.isIndefinite()); | 960 ASSERT(!nextInterval.begin.isIndefinite()); |
954 | 961 |
955 if (!nextInterval.begin.isUnresolved() && nextInterval.begin != m_interval.b egin) { | 962 if (!nextInterval.begin.isUnresolved() && nextInterval.begin != m_interval.b egin) { |
956 m_interval = nextInterval; | 963 m_interval = nextInterval; |
957 notifyDependentsIntervalChanged(); | 964 notifyDependentsIntervalChanged(); |
958 m_nextProgressTime = std::min(m_nextProgressTime, m_interval.begin); | 965 m_nextProgressTime = m_nextProgressTime.isUnresolved() ? m_interval.begi n : std::min(m_nextProgressTime, m_interval.begin); |
959 return true; | 966 return true; |
960 } | 967 } |
961 | 968 |
962 return false; | 969 return false; |
963 } | 970 } |
964 | 971 |
965 SMILTime SVGSMILElement::nextProgressTime() const | 972 SMILTime SVGSMILElement::nextProgressTime() const |
966 { | 973 { |
967 return m_nextProgressTime; | 974 return m_nextProgressTime; |
968 } | 975 } |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1352 #if ENABLE(OILPAN) | 1359 #if ENABLE(OILPAN) |
1353 visitor->trace(m_targetElement); | 1360 visitor->trace(m_targetElement); |
1354 visitor->trace(m_timeContainer); | 1361 visitor->trace(m_timeContainer); |
1355 visitor->trace(m_conditions); | 1362 visitor->trace(m_conditions); |
1356 visitor->trace(m_syncBaseDependents); | 1363 visitor->trace(m_syncBaseDependents); |
1357 #endif | 1364 #endif |
1358 SVGElement::trace(visitor); | 1365 SVGElement::trace(visitor); |
1359 } | 1366 } |
1360 | 1367 |
1361 } | 1368 } |
OLD | NEW |