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

Side by Side Diff: third_party/WebKit/LayoutTests/animations/animated-css-property-usecounter.html

Issue 2678143003: Move CSS animations use counters to UseCounter (Closed)
Patch Set: Rebase on top of crrev.com/2701353002 Created 3 years, 10 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
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4
5 <style>
6 @keyframes bgColorAnim {
7 from {
8 background-color: blue;
9 }
10 to {
11 background-color: red;
12 }
13 }
14
15 @keyframes customPropertyAnim {
16 from {
17 --x: blue;
18 }
19 to {
20 --x: red;
21 }
22 }
23
24 #target {
25 width: 100px;
26 height: 100px;
27 }
28 </style>
29
30 <div id="target"></div>
31
32 <script>
33 'use strict';
34
35 test(() => {
36 assert_true(
37 internals.isCSSPropertyUseCounted(document, "background-color"),
38 'Usage of background-color in style causes it to be counted in ' +
39 'normal CSS property UseCounter');
40 assert_true(
41 internals.isCSSPropertyUseCounted(document, "width"),
42 'Usage of width in style causes it to be counted in normal CSS ' +
43 'property UseCounter');
44
45 assert_false(
46 internals.isAnimatedCSSPropertyUseCounted(document, "background-color"),
47 'Initially background-color animation has not been UseCounted');
48 assert_false(
49 internals.isAnimatedCSSPropertyUseCounted(document, "width"),
50 'Initially width animation has not been UseCounted');
51
52 target.style.animation = 'bgColorAnim 1s';
53 target.offsetTop; // force recalc
54
55 assert_true(
56 internals.isAnimatedCSSPropertyUseCounted(document, "background-color"),
57 'After applying the animation, background-color has been counted');
58 assert_false(
59 internals.isAnimatedCSSPropertyUseCounted(document, "width"),
60 'Width is not animated, so not counted');
61 }, 'Animating properties via CSS causes UseCounter to be incremented.');
62
63 test(() => {
64 // FIXME(suzyh): CSS property UseCounter should include custom properties
alancutter (OOO until 2018) 2017/02/20 23:49:38 Tests should be testing what we want to happen and
65 assert_false(
66 internals.isCSSPropertyUseCounted(document, "--x"),
67 'Usage of custom property --x in style is not counted in ' +
68 'normal CSS property UseCounter');
69 assert_false(
70 internals.isCSSPropertyUseCounted(document, "--y"),
71 'All custom properties are counted together in normal CSS property ' +
72 'UseCounter');
73
74 assert_false(
75 internals.isAnimatedCSSPropertyUseCounted(document, "--x"),
76 'Initially custom property --x animation has not been UseCounted');
77 assert_false(
78 internals.isAnimatedCSSPropertyUseCounted(document, "--y"),
79 'Initially custom property --y animation has not been UseCounted');
80
81 target.style.animation = 'customPropertyAnim 1s';
82 target.offsetTop; // force recalc
83
84 assert_true(
85 internals.isAnimatedCSSPropertyUseCounted(document, "--x"),
86 'After applying the animation, custom property animation has been counted' );
87 assert_true(
88 internals.isAnimatedCSSPropertyUseCounted(document, "--y"),
89 'All custom property animations are counted together');
90 }, 'Animating custom CSS properties causes UseCounter to be incremented.');
91 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698