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

Side by Side Diff: third_party/WebKit/LayoutTests/css3/filters/unprefixed.html

Issue 2065593002: Unprefix the CSS 'filter' property (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove disabler. Try different DCHECK expressions. Created 4 years, 6 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 <title>-webkit-filter matches filter</title>
3 <script src="../../resources/testharness.js"></script>
4 <script src="../../resources/testharnessreport.js"></script>
5 <script src="../../css-parser/resources/property-parsing-test.js"></script>
6 <script>
7 function assert_prefixed_computed_style(property, value, expectedValue) {
8 if (expectedValue === undefined)
9 expectedValue = value;
10
11 var stringifiedValue = JSON.stringify(value);
12 var prefixedProperty = convert_to_dashes('webkit' + property.charAt(0).toUpper Case() + property.substr(1));
13
14 test(function() {
15 var div = document.createElement('div');
16 div.setAttribute("style", prefixedProperty + ": " + value);
17 document.head.appendChild(div);
18 var computedStyleValue = getComputedStyle(div)[property];
19 div.remove();
20 assert_equals(computedStyleValue, expectedValue);
21 }, "Computed style after parsing style='" + prefixedProperty + ": " + stringif iedValue + "'");
22 }
23
24 assert_prefixed_computed_style("filter", "url('#a')", 'url("#a")'); // Basic ref erence
25 assert_prefixed_computed_style("filter", "url(#a)", 'url("#a")'); // Bare unquot ed reference converting to quoted form
26 assert_prefixed_computed_style("filter", "url('#a') url('#b')", 'url("#a") url(" #b")'); // Multiple references
27
28 assert_prefixed_computed_style("filter", "grayscale(1) url('#a')", 'grayscale(1) url("#a")'); // Reference as 2nd value
29 assert_prefixed_computed_style("filter", "grayscale(1.0)", "grayscale(1)"); // F loat value converts to integer
30 assert_prefixed_computed_style("filter", "grayscale(0)"); // Zero value
31 assert_prefixed_computed_style("filter", "grayscale()", "grayscale(1)"); // No a rguments
32 assert_prefixed_computed_style("filter", "grayscale(0.5) grayscale(0.25)"); // M ultiple values
33
34 assert_prefixed_computed_style("filter", "sepia(1)"); // Integer value
35 assert_prefixed_computed_style("filter", "sepia(1.0)", "sepia(1)"); // Float val ue converts to integer
36 assert_prefixed_computed_style("filter", "sepia(0)"); // Zero value
37 assert_prefixed_computed_style("filter", "sepia()", "sepia(1)"); // No arguments
38 assert_prefixed_computed_style("filter", "sepia(0.5) sepia(0.25)"); // Multiple values
39
40 assert_prefixed_computed_style("filter", "saturate(1)"); // Integer value
41 assert_prefixed_computed_style("filter", "saturate(1.0)", "saturate(1)"); // Flo at value converts to integer
42 assert_prefixed_computed_style("filter", "saturate(0)"); // Zero value
43 assert_prefixed_computed_style("filter", "saturate()", "saturate(1)"); // No arg uments
44 assert_prefixed_computed_style("filter", "saturate(0.5) saturate(0.25)"); // Mul tiple values
45
46 assert_prefixed_computed_style("filter", "hue-rotate(10deg)"); // Degrees value as integer
47 assert_prefixed_computed_style("filter", "hue-rotate(10.0deg)", "hue-rotate(10de g)"); // Degrees float value converts to integer
48 assert_prefixed_computed_style("filter", "hue-rotate(10rad)", "hue-rotate(572.95 8deg)"); // Radians value
49 assert_prefixed_computed_style("filter", "hue-rotate(10grad)", "hue-rotate(9deg) "); // Gradians value
50 assert_prefixed_computed_style("filter", "hue-rotate(0.5turn)", "hue-rotate(180d eg)"); // Turns value
51 assert_prefixed_computed_style("filter", "hue-rotate(0)", "hue-rotate(0deg)"); / / Zero value
52 assert_prefixed_computed_style("filter", "hue-rotate()", "hue-rotate(0deg)"); // No arguments
53
54 assert_prefixed_computed_style("filter", "invert(1)"); // Integer value
55 assert_prefixed_computed_style("filter", "invert(1.0)", "invert(1)"); // Float v alue converts to integer
56 assert_prefixed_computed_style("filter", "invert(0)"); // Zero value
57 assert_prefixed_computed_style("filter", "invert()", "invert(1)"); // No argumen ts
58 assert_prefixed_computed_style("filter", "invert(0.5) invert(0.25)"); // Multipl e values
59
60 assert_prefixed_computed_style("filter", "opacity(1)"); // Integer value
61 assert_prefixed_computed_style("filter", "opacity(1.0)", "opacity(1)"); // Float value converts to integer
62 assert_prefixed_computed_style("filter", "opacity(0)"); // Zero value
63 assert_prefixed_computed_style("filter", "opacity()", "opacity(1)"); // No argum ents
64 assert_prefixed_computed_style("filter", "opacity(0.5) opacity(0.25)"); // Multi ple values
65
66 assert_prefixed_computed_style("filter", "brightness(1)"); // Integer value
67 assert_prefixed_computed_style("filter", "brightness(1.0)", "brightness(1)"); // Float value converts to integer
68 assert_prefixed_computed_style("filter", "brightness(0)"); // Zero value
69 assert_prefixed_computed_style("filter", "brightness()", "brightness(0)"); // No arguments
70 assert_prefixed_computed_style("filter", "brightness(0.5) brightness(0.25)"); // Multiple values
71
72 assert_prefixed_computed_style("filter", "contrast(1)"); // Integer value
73 assert_prefixed_computed_style("filter", "contrast(2)"); // Value greater than 1
74 assert_prefixed_computed_style("filter", "contrast(1.0)", "contrast(1)"); // Flo at value converts to integer
75 assert_prefixed_computed_style("filter", "contrast(0)"); // Zero value
76 assert_prefixed_computed_style("filter", "contrast()", "contrast(1)"); // No arg uments
77 assert_prefixed_computed_style("filter", "contrast(0.5) contrast(0.25)"); // Mul tiple values
78
79 assert_prefixed_computed_style("filter", "blur(0)", "blur(0px)"); // One zero to px
80 assert_prefixed_computed_style("filter", "blur(2em)", "blur(32px)"); // One leng th
81 assert_prefixed_computed_style("filter", "blur(5px)"); // One length
82 assert_prefixed_computed_style("filter", "blur()", "blur(0px)"); // No arguments
83
84 assert_prefixed_computed_style("filter", "drop-shadow(red 1px 2px 3px)",
85 "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)"); // Named color then three values
86 assert_prefixed_computed_style("filter", "drop-shadow(1px 2px 3px red)",
87 "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)"); // Three values then named color
88 assert_prefixed_computed_style("filter", "drop-shadow(#abc 0 0 0)",
89 "drop-shadow(rgb(170, 187, 204) 0px 0px 0px)"); // Color then three values wit h zero length
90 assert_prefixed_computed_style("filter", "drop-shadow(0 0 0)",
91 "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"); // Three values with zero length
92 assert_prefixed_computed_style("filter", "drop-shadow(1px 2px)",
93 "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"); // Two values no color
94
95 // Rule combinations
96 assert_prefixed_computed_style("filter", "contrast(0.5) grayscale(0.25)");
97 assert_prefixed_computed_style("filter", "sepia(0.5) grayscale(0.25)");
98 assert_prefixed_computed_style("filter", "saturate(0.5) grayscale(0.25)");
99 assert_prefixed_computed_style("filter", "hue-rotate(10deg) grayscale(0.25)");
100 assert_prefixed_computed_style("filter", "invert(0.5) grayscale(0.25)");
101 assert_prefixed_computed_style("filter", "opacity(0.5) grayscale(0.25)");
102 assert_prefixed_computed_style("filter", "brightness(0.5) grayscale(0.25)");
103 assert_prefixed_computed_style("filter",
104 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opaci ty(0.9) blur(5px)",
105 [ "grayscale(0.5)",
106 "sepia(0.25)",
107 "saturate(0.75)",
108 "hue-rotate(35deg)",
109 "invert(0.2)",
110 "opacity(0.9)",
111 "blur(5px)" ].join(" "));
112 assert_prefixed_computed_style("filter",
113 "grayscale(50%) sepia(25%) saturate(75%) invert(20%) opacity(90%) brightness(6 0%) contrast(30%)",
114 [ "grayscale(0.5)",
115 "sepia(0.25)",
116 "saturate(0.75)",
117 "invert(0.2)",
118 "opacity(0.9)",
119 "brightness(0.6)",
120 "contrast(0.3)" ].join(" ")); // Percentage values
121 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698