Skip to content

Commit ffcd346

Browse files
alancutterCommit Bot
authored and
Commit Bot
committed
Unship frames() animation timing function
This patch unships the frames() animation timing function due to unresolved issues over the naming. No intent is required as the timing function has not reached the stable channel of Chrome yet. Ongoing spec discussion: w3c/csswg-drafts#1301 Bug: 646265 Change-Id: Ice19051813a96eaa55229e46ef6630a75333b5b8 Reviewed-on: https://chromium-review.googlesource.com/552218 Commit-Queue: Alan Cutter <[email protected]> Reviewed-by: Suzy Howlett <[email protected]> Reviewed-by: Noel Gordon <[email protected]> Cr-Commit-Position: refs/heads/master@{#483584}
1 parent 3ed4f53 commit ffcd346

File tree

6 files changed

+39
-3
lines changed

6 files changed

+39
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<script src="../../../resources/testharness.js"></script>
3+
<script src="../../../resources/testharnessreport.js"></script>
4+
5+
<style>
6+
#target {
7+
transition-timing-function: frames(4);
8+
animation-timing-function: frames(4);
9+
}
10+
</style>
11+
12+
<div id="target"></div>
13+
14+
<script>
15+
test(function() {
16+
assert_equals(getComputedStyle(target).transitionTimingFunction, 'ease');
17+
assert_equals(getComputedStyle(target).animationTimingFunction, 'ease');
18+
}, 'The frames() timing function is still experimental and should not be exposed to stable.');
19+
</script>

third_party/WebKit/Source/core/css/CSSTimingFunctionValue.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#define CSSTimingFunctionValue_h
2828

2929
#include "core/css/CSSValue.h"
30+
#include "platform/RuntimeEnabledFeatures.h"
3031
#include "platform/animation/TimingFunction.h"
3132
#include "platform/wtf/PassRefPtr.h"
3233

@@ -124,7 +125,9 @@ class CSSFramesTimingFunctionValue : public CSSValue {
124125

125126
private:
126127
CSSFramesTimingFunctionValue(int frames)
127-
: CSSValue(kFramesTimingFunctionClass), frames_(frames) {}
128+
: CSSValue(kFramesTimingFunctionClass), frames_(frames) {
129+
DCHECK(RuntimeEnabledFeatures::FramesTimingFunctionEnabled());
130+
}
128131

129132
int frames_;
130133
};

third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,10 @@ static CSSValue* ConsumeAnimationTimingFunction(CSSParserTokenRange& range) {
396396
CSSValueID function = range.Peek().FunctionId();
397397
if (function == CSSValueSteps)
398398
return ConsumeSteps(range);
399-
if (function == CSSValueFrames)
399+
if (RuntimeEnabledFeatures::FramesTimingFunctionEnabled() &&
400+
function == CSSValueFrames) {
400401
return ConsumeFrames(range);
402+
}
401403
if (function == CSSValueCubicBezier)
402404
return ConsumeCubicBezier(range);
403405
return nullptr;

third_party/WebKit/Source/platform/RuntimeEnabledFeatures.json5

+4
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@
460460
settable_from_internals: true,
461461
status: "experimental",
462462
},
463+
{
464+
name: "FramesTimingFunction",
465+
status: "experimental",
466+
},
463467
{
464468
name: "FrameTimingSupport",
465469
status: "experimental",

third_party/WebKit/Source/platform/animation/TimingFunction.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
#include "cc/animation/timing_function.h"
2929
#include "platform/PlatformExport.h"
30+
#include "platform/RuntimeEnabledFeatures.h"
3031
#include "platform/wtf/Assertions.h"
3132
#include "platform/wtf/PassRefPtr.h"
3233
#include "platform/wtf/RefCounted.h"
@@ -214,7 +215,9 @@ class PLATFORM_EXPORT FramesTimingFunction final : public TimingFunction {
214215
private:
215216
FramesTimingFunction(int frames)
216217
: TimingFunction(Type::FRAMES),
217-
frames_(cc::FramesTimingFunction::Create(frames)) {}
218+
frames_(cc::FramesTimingFunction::Create(frames)) {
219+
DCHECK(RuntimeEnabledFeatures::FramesTimingFunctionEnabled());
220+
}
218221

219222
std::unique_ptr<cc::FramesTimingFunction> frames_;
220223
};

third_party/WebKit/Source/platform/animation/TimingFunctionTest.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
#include <sstream>
3434
#include <string>
35+
#include "platform/RuntimeEnabledFeatures.h"
3536
#include "platform/wtf/text/WTFString.h"
3637
#include "testing/gmock/include/gmock/gmock.h"
3738
#include "testing/gtest/include/gtest/gtest.h"
@@ -51,6 +52,10 @@ namespace {
5152

5253
class TimingFunctionTest : public ::testing::Test {
5354
public:
55+
TimingFunctionTest() {
56+
RuntimeEnabledFeatures::SetFramesTimingFunctionEnabled(true);
57+
}
58+
5459
void NotEqualHelperLoop(
5560
Vector<std::pair<std::string, RefPtr<TimingFunction>>>& v) {
5661
for (size_t i = 0; i < v.size(); ++i) {

0 commit comments

Comments
 (0)