Diff
Modified: trunk/Source/WebCore/ChangeLog (282750 => 282751)
--- trunk/Source/WebCore/ChangeLog 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/ChangeLog 2021-09-20 16:26:27 UTC (rev 282751)
@@ -1,3 +1,28 @@
+2021-09-20 Antoine Quint <grao...@webkit.org>
+
+ TimingFunction::transformTime() is poorly-named
+ https://bugs.webkit.org/show_bug.cgi?id=230478
+
+ Reviewed by Simon Fraser.
+
+ This function transforms an input _progress_ not a time, so we rename it to transformProgress()
+ and name its first parameter accordingly.
+
+ * animation/AnimationEffect.cpp:
+ (WebCore::AnimationEffect::getComputedTiming const):
+ * animation/KeyframeEffect.cpp:
+ (WebCore::KeyframeEffect::setAnimatedPropertiesInStyle):
+ * platform/ScrollAnimationSmooth.cpp:
+ (WebCore::ScrollAnimationSmooth::animateScroll):
+ * platform/animation/TimingFunction.cpp:
+ (WebCore::TimingFunction::transformProgress const):
+ (WebCore::TimingFunction::transformTime const): Deleted.
+ * platform/animation/TimingFunction.h:
+ * platform/graphics/nicosia/NicosiaAnimation.cpp:
+ (Nicosia::Animation::apply):
+ * platform/mac/ScrollbarsControllerMac.mm:
+ (-[WebScrollbarPartAnimation setCurrentProgress:]):
+
2021-09-20 Aditya Keerthi <akeer...@apple.com>
Implement input-security
Modified: trunk/Source/WebCore/animation/AnimationEffect.cpp (282750 => 282751)
--- trunk/Source/WebCore/animation/AnimationEffect.cpp 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/animation/AnimationEffect.cpp 2021-09-20 16:26:27 UTC (rev 282751)
@@ -326,7 +326,7 @@
// 3. Return the result of evaluating the animation effect’s timing function passing directed progress as the
// input progress value and before flag as the before flag.
- return m_timingFunction->transformTime(*directedProgress, iterationDuration, before);
+ return m_timingFunction->transformProgress(*directedProgress, iterationDuration, before);
}
return *directedProgress;
Modified: trunk/Source/WebCore/animation/KeyframeEffect.cpp (282750 => 282751)
--- trunk/Source/WebCore/animation/KeyframeEffect.cpp 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/animation/KeyframeEffect.cpp 2021-09-20 16:26:27 UTC (rev 282751)
@@ -1555,7 +1555,7 @@
if (auto duration = iterationDuration()) {
auto rangeDuration = (endOffset - startOffset) * duration.seconds();
if (auto* timingFunction = timingFunctionForKeyframeAtIndex(startKeyframeIndex.value()))
- transformedDistance = timingFunction->transformTime(intervalDistance, rangeDuration);
+ transformedDistance = timingFunction->transformProgress(intervalDistance, rangeDuration);
}
}
Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp (282750 => 282751)
--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2021-09-20 16:26:27 UTC (rev 282751)
@@ -133,7 +133,7 @@
currentTime = std::min(currentTime, endTime);
double fractionComplete = (currentTime - m_startTime) / m_duration;
- double progress = m_easeInOutTimingFunction->transformTime(fractionComplete, m_duration.value());
+ double progress = m_easeInOutTimingFunction->transformProgress(fractionComplete, m_duration.value());
m_currentOffset = {
linearInterpolation(progress, m_startOffset.x(), m_destinationOffset.x()),
Modified: trunk/Source/WebCore/platform/animation/TimingFunction.cpp (282750 => 282751)
--- trunk/Source/WebCore/platform/animation/TimingFunction.cpp 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/platform/animation/TimingFunction.cpp 2021-09-20 16:26:27 UTC (rev 282751)
@@ -89,17 +89,17 @@
return ts;
}
-double TimingFunction::transformTime(double inputTime, double duration, bool before) const
+double TimingFunction::transformProgress(double progress, double duration, bool before) const
{
switch (m_type) {
case TimingFunction::CubicBezierFunction: {
auto& function = downcast<CubicBezierTimingFunction>(*this);
if (function.isLinear())
- return inputTime;
+ return progress;
// The epsilon value we pass to UnitBezier::solve given that the animation is going to run over |dur| seconds. The longer the
// animation, the more precision we need in the timing function result to avoid ugly discontinuities.
auto epsilon = 1.0 / (1000.0 * duration);
- return UnitBezier(function.x1(), function.y1(), function.x2(), function.y2()).solve(inputTime, epsilon);
+ return UnitBezier(function.x1(), function.y1(), function.x2(), function.y2()).solve(progress, epsilon);
}
case TimingFunction::StepsFunction: {
// https://drafts.csswg.org/css-easing-1/#step-timing-functions
@@ -107,7 +107,7 @@
auto steps = function.numberOfSteps();
auto stepPosition = function.stepPosition();
// 1. Calculate the current step as floor(input progress value × steps).
- auto currentStep = std::floor(inputTime * steps);
+ auto currentStep = std::floor(progress * steps);
// 2. If the step position property is start, increment current step by one.
if (stepPosition == StepsTimingFunction::StepPosition::JumpStart || stepPosition == StepsTimingFunction::StepPosition::Start || stepPosition == StepsTimingFunction::StepPosition::JumpBoth)
++currentStep;
@@ -115,10 +115,10 @@
// - the before flag is set, and
// - input progress value × steps mod 1 equals zero (that is, if input progress value × steps is integral), then
// decrement current step by one.
- if (before && !fmod(inputTime * steps, 1))
+ if (before && !fmod(progress * steps, 1))
currentStep--;
// 4. If input progress value ≥ 0 and current step < 0, let current step be zero.
- if (inputTime >= 0 && currentStep < 0)
+ if (progress >= 0 && currentStep < 0)
currentStep = 0;
// 5. Calculate jumps based on the step position.
if (stepPosition == StepsTimingFunction::StepPosition::JumpNone)
@@ -126,7 +126,7 @@
else if (stepPosition == StepsTimingFunction::StepPosition::JumpBoth)
++steps;
// 6. If input progress value ≤ 1 and current step > jumps, let current step be jumps.
- if (inputTime <= 1 && currentStep > steps)
+ if (progress <= 1 && currentStep > steps)
currentStep = steps;
// 7. The output progress value is current step / jumps.
return currentStep / steps;
@@ -133,10 +133,10 @@
}
case TimingFunction::SpringFunction: {
auto& function = downcast<SpringTimingFunction>(*this);
- return SpringSolver(function.mass(), function.stiffness(), function.damping(), function.initialVelocity()).solve(inputTime * duration);
+ return SpringSolver(function.mass(), function.stiffness(), function.damping(), function.initialVelocity()).solve(progress * duration);
}
case TimingFunction::LinearFunction:
- return inputTime;
+ return progress;
}
ASSERT_NOT_REACHED();
Modified: trunk/Source/WebCore/platform/animation/TimingFunction.h (282750 => 282751)
--- trunk/Source/WebCore/platform/animation/TimingFunction.h 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/platform/animation/TimingFunction.h 2021-09-20 16:26:27 UTC (rev 282751)
@@ -55,7 +55,7 @@
static ExceptionOr<RefPtr<TimingFunction>> createFromCSSText(const String&);
static RefPtr<TimingFunction> createFromCSSValue(const CSSValue&);
- double transformTime(double, double, bool before = false) const;
+ double transformProgress(double progress, double duration, bool before = false) const;
String cssText() const;
protected:
Modified: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp (282750 => 282751)
--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaAnimation.cpp 2021-09-20 16:26:27 UTC (rev 282751)
@@ -248,7 +248,7 @@
}
if (m_keyframes.size() == 2) {
auto& timingFunction = timingFunctionForAnimationValue(m_keyframes.at(0), *this);
- normalizedValue = timingFunction.transformTime(normalizedValue, m_duration);
+ normalizedValue = timingFunction.transformProgress(normalizedValue, m_duration);
applyInternal(applicationResults, m_keyframes.at(0), m_keyframes.at(1), normalizedValue);
return;
}
@@ -261,7 +261,7 @@
normalizedValue = (normalizedValue - from.keyTime()) / (to.keyTime() - from.keyTime());
auto& timingFunction = timingFunctionForAnimationValue(from, *this);
- normalizedValue = timingFunction.transformTime(normalizedValue, m_duration);
+ normalizedValue = timingFunction.transformProgress(normalizedValue, m_duration);
applyInternal(applicationResults, from, to, normalizedValue);
break;
}
Modified: trunk/Source/WebCore/platform/mac/ScrollbarsControllerMac.mm (282750 => 282751)
--- trunk/Source/WebCore/platform/mac/ScrollbarsControllerMac.mm 2021-09-20 16:19:04 UTC (rev 282750)
+++ trunk/Source/WebCore/platform/mac/ScrollbarsControllerMac.mm 2021-09-20 16:26:27 UTC (rev 282751)
@@ -261,7 +261,7 @@
NSTimeInterval t = 1;
if (_duration)
t = elapsed / _duration;
- progress = _timingFunction->transformTime(t, _duration);
+ progress = _timingFunction->transformProgress(t, _duration);
}
ASSERT(_scrollbar);