| 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 18 matching lines...) Expand all Loading... |
| 29 #include "bindings/core/v8/ScriptEventListener.h" | 29 #include "bindings/core/v8/ScriptEventListener.h" |
| 30 #include "core/XLinkNames.h" | 30 #include "core/XLinkNames.h" |
| 31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
| 32 #include "core/events/Event.h" | 32 #include "core/events/Event.h" |
| 33 #include "core/events/EventListener.h" | 33 #include "core/events/EventListener.h" |
| 34 #include "core/events/EventSender.h" | 34 #include "core/events/EventSender.h" |
| 35 #include "core/svg/SVGDocumentExtensions.h" | 35 #include "core/svg/SVGDocumentExtensions.h" |
| 36 #include "core/svg/SVGSVGElement.h" | 36 #include "core/svg/SVGSVGElement.h" |
| 37 #include "core/svg/SVGURIReference.h" | 37 #include "core/svg/SVGURIReference.h" |
| 38 #include "core/svg/animation/SMILTimeContainer.h" | 38 #include "core/svg/animation/SMILTimeContainer.h" |
| 39 #include "platform/FloatConversion.h" | |
| 40 #include "platform/heap/Handle.h" | 39 #include "platform/heap/Handle.h" |
| 41 #include "wtf/MathExtras.h" | 40 #include "wtf/MathExtras.h" |
| 42 #include "wtf/StdLibExtras.h" | 41 #include "wtf/StdLibExtras.h" |
| 43 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
| 44 #include <algorithm> | 43 #include <algorithm> |
| 45 | 44 |
| 46 namespace blink { | 45 namespace blink { |
| 47 | 46 |
| 48 class RepeatEvent final : public Event { | 47 class RepeatEvent final : public Event { |
| 49 public: | 48 public: |
| (...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 SMILTime repeatingDuration = this->repeatingDuration(); | 1076 SMILTime repeatingDuration = this->repeatingDuration(); |
| 1078 if (elapsed >= m_interval.end || activeTime > repeatingDuration) { | 1077 if (elapsed >= m_interval.end || activeTime > repeatingDuration) { |
| 1079 repeat = static_cast<unsigned>(repeatingDuration.value() / simpleDuratio
n.value()); | 1078 repeat = static_cast<unsigned>(repeatingDuration.value() / simpleDuratio
n.value()); |
| 1080 if (!fmod(repeatingDuration.value(), simpleDuration.value())) | 1079 if (!fmod(repeatingDuration.value(), simpleDuration.value())) |
| 1081 repeat--; | 1080 repeat--; |
| 1082 | 1081 |
| 1083 double percent = (m_interval.end.value() - m_interval.begin.value()) / s
impleDuration.value(); | 1082 double percent = (m_interval.end.value() - m_interval.begin.value()) / s
impleDuration.value(); |
| 1084 percent = percent - floor(percent); | 1083 percent = percent - floor(percent); |
| 1085 if (percent < std::numeric_limits<float>::epsilon() || 1 - percent < std
::numeric_limits<float>::epsilon()) | 1084 if (percent < std::numeric_limits<float>::epsilon() || 1 - percent < std
::numeric_limits<float>::epsilon()) |
| 1086 return 1.0f; | 1085 return 1.0f; |
| 1087 return narrowPrecisionToFloat(percent); | 1086 return clampTo<float>(percent); |
| 1088 } | 1087 } |
| 1089 repeat = static_cast<unsigned>(activeTime.value() / simpleDuration.value()); | 1088 repeat = static_cast<unsigned>(activeTime.value() / simpleDuration.value()); |
| 1090 SMILTime simpleTime = fmod(activeTime.value(), simpleDuration.value()); | 1089 SMILTime simpleTime = fmod(activeTime.value(), simpleDuration.value()); |
| 1091 return narrowPrecisionToFloat(simpleTime.value() / simpleDuration.value()); | 1090 return clampTo<float>(simpleTime.value() / simpleDuration.value()); |
| 1092 } | 1091 } |
| 1093 | 1092 |
| 1094 SMILTime SVGSMILElement::calculateNextProgressTime(SMILTime elapsed) const | 1093 SMILTime SVGSMILElement::calculateNextProgressTime(SMILTime elapsed) const |
| 1095 { | 1094 { |
| 1096 if (m_activeState == Active) { | 1095 if (m_activeState == Active) { |
| 1097 // If duration is indefinite the value does not actually change over tim
e. Same is true for <set>. | 1096 // If duration is indefinite the value does not actually change over tim
e. Same is true for <set>. |
| 1098 SMILTime simpleDuration = this->simpleDuration(); | 1097 SMILTime simpleDuration = this->simpleDuration(); |
| 1099 if (simpleDuration.isIndefinite() || isSVGSetElement(*this)) { | 1098 if (simpleDuration.isIndefinite() || isSVGSetElement(*this)) { |
| 1100 SMILTime repeatingDurationEnd = m_interval.begin + repeatingDuration
(); | 1099 SMILTime repeatingDurationEnd = m_interval.begin + repeatingDuration
(); |
| 1101 // We are supposed to do freeze semantics when repeating ends, even
if the element is still active. | 1100 // We are supposed to do freeze semantics when repeating ends, even
if the element is still active. |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 { | 1348 { |
| 1350 visitor->trace(m_targetElement); | 1349 visitor->trace(m_targetElement); |
| 1351 visitor->trace(m_timeContainer); | 1350 visitor->trace(m_timeContainer); |
| 1352 visitor->trace(m_conditions); | 1351 visitor->trace(m_conditions); |
| 1353 visitor->trace(m_syncBaseDependents); | 1352 visitor->trace(m_syncBaseDependents); |
| 1354 SVGElement::trace(visitor); | 1353 SVGElement::trace(visitor); |
| 1355 SVGTests::trace(visitor); | 1354 SVGTests::trace(visitor); |
| 1356 } | 1355 } |
| 1357 | 1356 |
| 1358 } // namespace blink | 1357 } // namespace blink |
| OLD | NEW |