Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: Source/core/svg/animation/SVGSMILElement.cpp

Issue 329183002: Removing "using" declarations that import names in the C++ Standard library. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed Trybot Errors Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/svg/animation/SMILTimeContainer.cpp ('k') | Source/core/xml/XMLTreeViewer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 #include "core/events/EventSender.h" 35 #include "core/events/EventSender.h"
36 #include "core/svg/SVGDocumentExtensions.h" 36 #include "core/svg/SVGDocumentExtensions.h"
37 #include "core/svg/SVGSVGElement.h" 37 #include "core/svg/SVGSVGElement.h"
38 #include "core/svg/SVGURIReference.h" 38 #include "core/svg/SVGURIReference.h"
39 #include "core/svg/animation/SMILTimeContainer.h" 39 #include "core/svg/animation/SMILTimeContainer.h"
40 #include "platform/FloatConversion.h" 40 #include "platform/FloatConversion.h"
41 #include "wtf/MathExtras.h" 41 #include "wtf/MathExtras.h"
42 #include "wtf/StdLibExtras.h" 42 #include "wtf/StdLibExtras.h"
43 #include "wtf/Vector.h" 43 #include "wtf/Vector.h"
44 44
45 using namespace std;
46
47 namespace WebCore { 45 namespace WebCore {
48 46
49 class RepeatEvent FINAL : public Event { 47 class RepeatEvent FINAL : public Event {
50 public: 48 public:
51 static PassRefPtrWillBeRawPtr<RepeatEvent> create(const AtomicString& type, int repeat) 49 static PassRefPtrWillBeRawPtr<RepeatEvent> create(const AtomicString& type, int repeat)
52 { 50 {
53 return adoptRefWillBeNoop(new RepeatEvent(type, false, false, repeat)); 51 return adoptRefWillBeNoop(new RepeatEvent(type, false, false, repeat));
54 } 52 }
55 53
56 virtual ~RepeatEvent() { } 54 virtual ~RepeatEvent() { }
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 { 788 {
791 if (m_cachedMin != invalidCachedTime) 789 if (m_cachedMin != invalidCachedTime)
792 return m_cachedMin; 790 return m_cachedMin;
793 const AtomicString& value = fastGetAttribute(SVGNames::minAttr); 791 const AtomicString& value = fastGetAttribute(SVGNames::minAttr);
794 SMILTime result = parseClockValue(value); 792 SMILTime result = parseClockValue(value);
795 return m_cachedMin = (result.isUnresolved() || result < 0) ? 0 : result; 793 return m_cachedMin = (result.isUnresolved() || result < 0) ? 0 : result;
796 } 794 }
797 795
798 SMILTime SVGSMILElement::simpleDuration() const 796 SMILTime SVGSMILElement::simpleDuration() const
799 { 797 {
800 return min(dur(), SMILTime::indefinite()); 798 return std::min(dur(), SMILTime::indefinite());
801 } 799 }
802 800
803 void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime, SMILTi meWithOrigin::Origin origin) 801 void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime, SMILTi meWithOrigin::Origin origin)
804 { 802 {
805 ASSERT(!std::isnan(beginTime.value())); 803 ASSERT(!std::isnan(beginTime.value()));
806 m_beginTimes.append(SMILTimeWithOrigin(beginTime, origin)); 804 m_beginTimes.append(SMILTimeWithOrigin(beginTime, origin));
807 sortTimeList(m_beginTimes); 805 sortTimeList(m_beginTimes);
808 beginListChanged(eventTime); 806 beginListChanged(eventTime);
809 } 807 }
810 808
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 SMILTime SVGSMILElement::repeatingDuration() const 860 SMILTime SVGSMILElement::repeatingDuration() const
863 { 861 {
864 // Computing the active duration 862 // Computing the active duration
865 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur 863 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur
866 SMILTime repeatCount = this->repeatCount(); 864 SMILTime repeatCount = this->repeatCount();
867 SMILTime repeatDur = this->repeatDur(); 865 SMILTime repeatDur = this->repeatDur();
868 SMILTime simpleDuration = this->simpleDuration(); 866 SMILTime simpleDuration = this->simpleDuration();
869 if (!simpleDuration || (repeatDur.isUnresolved() && repeatCount.isUnresolved ())) 867 if (!simpleDuration || (repeatDur.isUnresolved() && repeatCount.isUnresolved ()))
870 return simpleDuration; 868 return simpleDuration;
871 SMILTime repeatCountDuration = simpleDuration * repeatCount; 869 SMILTime repeatCountDuration = simpleDuration * repeatCount;
872 return min(repeatCountDuration, min(repeatDur, SMILTime::indefinite())); 870 return std::min(repeatCountDuration, std::min(repeatDur, SMILTime::indefinit e()));
873 } 871 }
874 872
875 SMILTime SVGSMILElement::resolveActiveEnd(SMILTime resolvedBegin, SMILTime resol vedEnd) const 873 SMILTime SVGSMILElement::resolveActiveEnd(SMILTime resolvedBegin, SMILTime resol vedEnd) const
876 { 874 {
877 // Computing the active duration 875 // Computing the active duration
878 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur 876 // http://www.w3.org/TR/SMIL2/smil-timing.html#Timing-ComputingActiveDur
879 SMILTime preliminaryActiveDuration; 877 SMILTime preliminaryActiveDuration;
880 if (!resolvedEnd.isUnresolved() && dur().isUnresolved() && repeatDur().isUnr esolved() && repeatCount().isUnresolved()) 878 if (!resolvedEnd.isUnresolved() && dur().isUnresolved() && repeatDur().isUnr esolved() && repeatCount().isUnresolved())
881 preliminaryActiveDuration = resolvedEnd - resolvedBegin; 879 preliminaryActiveDuration = resolvedEnd - resolvedBegin;
882 else if (!resolvedEnd.isFinite()) 880 else if (!resolvedEnd.isFinite())
883 preliminaryActiveDuration = repeatingDuration(); 881 preliminaryActiveDuration = repeatingDuration();
884 else 882 else
885 preliminaryActiveDuration = min(repeatingDuration(), resolvedEnd - resol vedBegin); 883 preliminaryActiveDuration = std::min(repeatingDuration(), resolvedEnd - resolvedBegin);
886 884
887 SMILTime minValue = this->minValue(); 885 SMILTime minValue = this->minValue();
888 SMILTime maxValue = this->maxValue(); 886 SMILTime maxValue = this->maxValue();
889 if (minValue > maxValue) { 887 if (minValue > maxValue) {
890 // Ignore both. 888 // Ignore both.
891 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#MinMax 889 // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#MinMax
892 minValue = 0; 890 minValue = 0;
893 maxValue = SMILTime::indefinite(); 891 maxValue = SMILTime::indefinite();
894 } 892 }
895 return resolvedBegin + min(maxValue, max(minValue, preliminaryActiveDuration )); 893 return resolvedBegin + std::min(maxValue, std::max(minValue, preliminaryActi veDuration));
896 } 894 }
897 895
898 SMILInterval SVGSMILElement::resolveInterval(ResolveInterval resolveIntervalType ) const 896 SMILInterval SVGSMILElement::resolveInterval(ResolveInterval resolveIntervalType ) const
899 { 897 {
900 bool first = resolveIntervalType == FirstInterval; 898 bool first = resolveIntervalType == FirstInterval;
901 // See the pseudocode in http://www.w3.org/TR/SMIL3/smil-timing.html#q90. 899 // See the pseudocode in http://www.w3.org/TR/SMIL3/smil-timing.html#q90.
902 SMILTime beginAfter = first ? -numeric_limits<double>::infinity() : m_interv al.end; 900 SMILTime beginAfter = first ? -std::numeric_limits<double>::infinity() : m_i nterval.end;
903 SMILTime lastIntervalTempEnd = numeric_limits<double>::infinity(); 901 SMILTime lastIntervalTempEnd = std::numeric_limits<double>::infinity();
904 while (true) { 902 while (true) {
905 bool equalsMinimumOK = !first || m_interval.end > m_interval.begin; 903 bool equalsMinimumOK = !first || m_interval.end > m_interval.begin;
906 SMILTime tempBegin = findInstanceTime(Begin, beginAfter, equalsMinimumOK ); 904 SMILTime tempBegin = findInstanceTime(Begin, beginAfter, equalsMinimumOK );
907 if (tempBegin.isUnresolved()) 905 if (tempBegin.isUnresolved())
908 break; 906 break;
909 SMILTime tempEnd; 907 SMILTime tempEnd;
910 if (m_endTimes.isEmpty()) 908 if (m_endTimes.isEmpty())
911 tempEnd = resolveActiveEnd(tempBegin, SMILTime::indefinite()); 909 tempEnd = resolveActiveEnd(tempBegin, SMILTime::indefinite());
912 else { 910 else {
913 tempEnd = findInstanceTime(End, tempBegin, true); 911 tempEnd = findInstanceTime(End, tempBegin, true);
(...skipping 15 matching lines...) Expand all
929 } 927 }
930 928
931 void SVGSMILElement::resolveFirstInterval() 929 void SVGSMILElement::resolveFirstInterval()
932 { 930 {
933 SMILInterval firstInterval = resolveInterval(FirstInterval); 931 SMILInterval firstInterval = resolveInterval(FirstInterval);
934 ASSERT(!firstInterval.begin.isIndefinite()); 932 ASSERT(!firstInterval.begin.isIndefinite());
935 933
936 if (!firstInterval.begin.isUnresolved() && firstInterval != m_interval) { 934 if (!firstInterval.begin.isUnresolved() && firstInterval != m_interval) {
937 m_interval = firstInterval; 935 m_interval = firstInterval;
938 notifyDependentsIntervalChanged(); 936 notifyDependentsIntervalChanged();
939 m_nextProgressTime = min(m_nextProgressTime, m_interval.begin); 937 m_nextProgressTime = std::min(m_nextProgressTime, m_interval.begin);
940 938
941 if (m_timeContainer) 939 if (m_timeContainer)
942 m_timeContainer->notifyIntervalsChanged(); 940 m_timeContainer->notifyIntervalsChanged();
943 } 941 }
944 } 942 }
945 943
946 bool SVGSMILElement::resolveNextInterval() 944 bool SVGSMILElement::resolveNextInterval()
947 { 945 {
948 SMILInterval nextInterval = resolveInterval(NextInterval); 946 SMILInterval nextInterval = resolveInterval(NextInterval);
949 ASSERT(!nextInterval.begin.isIndefinite()); 947 ASSERT(!nextInterval.begin.isIndefinite());
950 948
951 if (!nextInterval.begin.isUnresolved() && nextInterval.begin != m_interval.b egin) { 949 if (!nextInterval.begin.isUnresolved() && nextInterval.begin != m_interval.b egin) {
952 m_interval = nextInterval; 950 m_interval = nextInterval;
953 notifyDependentsIntervalChanged(); 951 notifyDependentsIntervalChanged();
954 m_nextProgressTime = min(m_nextProgressTime, m_interval.begin); 952 m_nextProgressTime = std::min(m_nextProgressTime, m_interval.begin);
955 return true; 953 return true;
956 } 954 }
957 955
958 return false; 956 return false;
959 } 957 }
960 958
961 SMILTime SVGSMILElement::nextProgressTime() const 959 SMILTime SVGSMILElement::nextProgressTime() const
962 { 960 {
963 return m_nextProgressTime; 961 return m_nextProgressTime;
964 } 962 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 ASSERT(simpleDuration.isFinite()); 1087 ASSERT(simpleDuration.isFinite());
1090 SMILTime activeTime = elapsed - m_interval.begin; 1088 SMILTime activeTime = elapsed - m_interval.begin;
1091 SMILTime repeatingDuration = this->repeatingDuration(); 1089 SMILTime repeatingDuration = this->repeatingDuration();
1092 if (elapsed >= m_interval.end || activeTime > repeatingDuration) { 1090 if (elapsed >= m_interval.end || activeTime > repeatingDuration) {
1093 repeat = static_cast<unsigned>(repeatingDuration.value() / simpleDuratio n.value()); 1091 repeat = static_cast<unsigned>(repeatingDuration.value() / simpleDuratio n.value());
1094 if (!fmod(repeatingDuration.value(), simpleDuration.value())) 1092 if (!fmod(repeatingDuration.value(), simpleDuration.value()))
1095 repeat--; 1093 repeat--;
1096 1094
1097 double percent = (m_interval.end.value() - m_interval.begin.value()) / s impleDuration.value(); 1095 double percent = (m_interval.end.value() - m_interval.begin.value()) / s impleDuration.value();
1098 percent = percent - floor(percent); 1096 percent = percent - floor(percent);
1099 if (percent < numeric_limits<float>::epsilon() || 1 - percent < numeric_ limits<float>::epsilon()) 1097 if (percent < std::numeric_limits<float>::epsilon() || 1 - percent < std ::numeric_limits<float>::epsilon())
1100 return 1.0f; 1098 return 1.0f;
1101 return narrowPrecisionToFloat(percent); 1099 return narrowPrecisionToFloat(percent);
1102 } 1100 }
1103 repeat = static_cast<unsigned>(activeTime.value() / simpleDuration.value()); 1101 repeat = static_cast<unsigned>(activeTime.value() / simpleDuration.value());
1104 SMILTime simpleTime = fmod(activeTime.value(), simpleDuration.value()); 1102 SMILTime simpleTime = fmod(activeTime.value(), simpleDuration.value());
1105 return narrowPrecisionToFloat(simpleTime.value() / simpleDuration.value()); 1103 return narrowPrecisionToFloat(simpleTime.value() / simpleDuration.value());
1106 } 1104 }
1107 1105
1108 SMILTime SVGSMILElement::calculateNextProgressTime(SMILTime elapsed) const 1106 SMILTime SVGSMILElement::calculateNextProgressTime(SMILTime elapsed) const
1109 { 1107 {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 void SVGSMILElement::trace(Visitor* visitor) 1344 void SVGSMILElement::trace(Visitor* visitor)
1347 { 1345 {
1348 visitor->trace(m_targetElement); 1346 visitor->trace(m_targetElement);
1349 visitor->trace(m_timeContainer); 1347 visitor->trace(m_timeContainer);
1350 visitor->trace(m_conditions); 1348 visitor->trace(m_conditions);
1351 visitor->trace(m_syncBaseDependents); 1349 visitor->trace(m_syncBaseDependents);
1352 SVGElement::trace(visitor); 1350 SVGElement::trace(visitor);
1353 } 1351 }
1354 1352
1355 } 1353 }
OLDNEW
« no previous file with comments | « Source/core/svg/animation/SMILTimeContainer.cpp ('k') | Source/core/xml/XMLTreeViewer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698