Bug 1504602: Remove frames timing related codes. r=pbro

The `frames()` timing function was removed from CSS Easing Functions spec[1].
Likewise, already had dropped this feature from our platform as well[2].
Thus, removes `frames()` related code from animation inspector.

[1] https://drafts.csswg.org/css-easing-1/#timing-function
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=1496619

Differential Revision: https://phabricator.services.mozilla.com/D14943

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Daisuke Akatsuka 2018-12-20 02:44:13 +00:00
parent 12904948b7
commit 346b735df6

View File

@ -216,20 +216,14 @@ function getPreferredDurationResolution(keyframes) {
* Preferred threshold.
*/
function getPreferredProgressThreshold(state, keyframes) {
let threshold = DEFAULT_MIN_PROGRESS_THRESHOLD;
let stepsOrFrames;
if ((stepsOrFrames = getStepsOrFramesCount(state.easing))) {
threshold = Math.min(threshold, (1 / (stepsOrFrames + 1)));
}
const steps = getStepsCount(state.easing);
const threshold = Math.min(DEFAULT_MIN_PROGRESS_THRESHOLD, (1 / (steps + 1)));
if (!keyframes) {
return threshold;
}
threshold = Math.min(threshold, getPreferredProgressThresholdByKeyframes(keyframes));
return threshold;
return Math.min(threshold, getPreferredProgressThresholdByKeyframes(keyframes));
}
/**
@ -242,7 +236,6 @@ function getPreferredProgressThreshold(state, keyframes) {
*/
function getPreferredProgressThresholdByKeyframes(keyframes) {
let threshold = DEFAULT_MIN_PROGRESS_THRESHOLD;
let stepsOrFrames;
for (let i = 0; i < keyframes.length - 1; i++) {
const keyframe = keyframes[i];
@ -251,20 +244,21 @@ function getPreferredProgressThresholdByKeyframes(keyframes) {
continue;
}
if ((stepsOrFrames = getStepsOrFramesCount(keyframe.easing))) {
const steps = getStepsCount(keyframe.easing);
if (steps) {
const nextKeyframe = keyframes[i + 1];
threshold =
Math.min(threshold,
1 / (stepsOrFrames + 1) * (nextKeyframe.offset - keyframe.offset));
Math.min(threshold, 1 / (steps + 1) * (nextKeyframe.offset - keyframe.offset));
}
}
return threshold;
}
function getStepsOrFramesCount(easing) {
const stepsOrFramesFunction = easing.match(/(steps|frames)\((\d+)/);
return stepsOrFramesFunction ? parseInt(stepsOrFramesFunction[2], 10) : 0;
function getStepsCount(easing) {
const stepsFunction = easing.match(/(steps)\((\d+)/);
return stepsFunction ? parseInt(stepsFunction[2], 10) : 0;
}
function mapSegmentsToPlaybackRate(segments, endTime, playbackRate) {