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

Unified Diff: third_party/WebKit/LayoutTests/css3/filters/script-tests/unprefixed.js

Issue 1987943002: [wip] unprefix filter Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/css3/filters/script-tests/unprefixed.js
diff --git a/third_party/WebKit/LayoutTests/css3/filters/script-tests/unprefixed.js b/third_party/WebKit/LayoutTests/css3/filters/script-tests/unprefixed.js
new file mode 100644
index 0000000000000000000000000000000000000000..ceba9bc3e2ae6c424e546441142c8dd2e4286a27
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/filters/script-tests/unprefixed.js
@@ -0,0 +1,293 @@
+description("Test that -webkit-filter matches filter.");
+
+var styleElement = document.createElement("style");
+document.head.appendChild(styleElement);
+var styleSheet = styleElement.sheet;
+
+function testComputedFilterRule(description, rule, expected)
+{
+ styleSheet.insertRule("body { -webkit-filter: " + rule + "; }", 0);
+ debug(description + " : -webkit-filter: " + rule);
+
+ var style = window.getComputedStyle(document.body).getPropertyValue('filter');
+ var value = "computed filter style: " + style;
+
+ if (style != expected) {
+ testFailed(value + " should have style: " + expected);
+ } else {
+ testPassed(value);
+ }
+
+ styleSheet.deleteRule(0);
+ debug("");
+}
+
+testComputedFilterRule("Basic reference",
+ "url('#a')",
+ 'url("#a")');
+
+testComputedFilterRule("Bare unquoted reference converting to quoted form",
+ "url(#a)",
+ 'url("#a")');
+
+testComputedFilterRule("Multiple references",
+ "url('#a') url('#b')",
+ 'url("#a") url("#b")');
+
+testComputedFilterRule("Reference as 2nd value",
+ "grayscale(1) url('#a')",
+ 'grayscale(1) url("#a")');
+
+testComputedFilterRule("Float value converts to integer",
+ "grayscale(1.0)",
+ "grayscale(1)");
+
+testComputedFilterRule("Zero value",
+ "grayscale(0)",
+ "grayscale(0)");
+
+testComputedFilterRule("No values",
+ "grayscale()",
+ "grayscale(1)");
+
+testComputedFilterRule("Multiple values",
+ "grayscale(0.5) grayscale(0.25)",
+ "grayscale(0.5) grayscale(0.25)");
+
+testComputedFilterRule("Integer value",
+ "sepia(1)",
+ "sepia(1)");
+
+testComputedFilterRule("Float value converts to integer",
+ "sepia(1.0)",
+ "sepia(1)");
+
+testComputedFilterRule("Zero value",
+ "sepia(0)",
+ "sepia(0)");
+
+testComputedFilterRule("No values",
+ "sepia()",
+ "sepia(1)");
+
+testComputedFilterRule("Multiple values",
+ "sepia(0.5) sepia(0.25)",
+ "sepia(0.5) sepia(0.25)");
+
+testComputedFilterRule("Rule combinations",
+ "sepia(0.5) grayscale(0.25)",
+ "sepia(0.5) grayscale(0.25)");
+
+testComputedFilterRule("Integer value",
+ "saturate(1)",
+ "saturate(1)");
+
+testComputedFilterRule("Float value converts to integer",
+ "saturate(1.0)",
+ "saturate(1)");
+
+testComputedFilterRule("Zero value",
+ "saturate(0)",
+ "saturate(0)");
+
+testComputedFilterRule("No values",
+ "saturate()",
+ "saturate(1)");
+
+testComputedFilterRule("Multiple values",
+ "saturate(0.5) saturate(0.25)",
+ "saturate(0.5) saturate(0.25)");
+
+testComputedFilterRule("Rule combinations",
+ "saturate(0.5) grayscale(0.25)",
+ "saturate(0.5) grayscale(0.25)");
+
+testComputedFilterRule("Degrees value as integer",
+ "hue-rotate(10deg)",
+ "hue-rotate(10deg)");
+
+testComputedFilterRule("Degrees float value converts to integer",
+ "hue-rotate(10.0deg)",
+ "hue-rotate(10deg)");
+
+testComputedFilterRule("Radians value",
+ "hue-rotate(10rad)",
+ "hue-rotate(572.958deg)");
+
+testComputedFilterRule("Gradians value",
+ "hue-rotate(10grad)",
+ "hue-rotate(9deg)");
+
+testComputedFilterRule("Turns value",
+ "hue-rotate(0.5turn)",
+ "hue-rotate(180deg)");
+
+testComputedFilterRule("Zero value",
+ "hue-rotate(0)",
+ "hue-rotate(0deg)");
+
+testComputedFilterRule("No values",
+ "hue-rotate()",
+ "hue-rotate(0deg)");
+
+testComputedFilterRule("Rule combinations",
+ "hue-rotate(10deg) grayscale(0.25)",
+ "hue-rotate(10deg) grayscale(0.25)");
+
+testComputedFilterRule("Integer value",
+ "invert(1)",
+ "invert(1)");
+
+testComputedFilterRule("Float value converts to integer",
+ "invert(1.0)",
+ "invert(1)");
+
+testComputedFilterRule("Zero value",
+ "invert(0)",
+ "invert(0)");
+
+testComputedFilterRule("No values",
+ "invert()",
+ "invert(1)");
+
+testComputedFilterRule("Multiple values",
+ "invert(0.5) invert(0.25)",
+ "invert(0.5) invert(0.25)");
+
+testComputedFilterRule("Rule combinations",
+ "invert(0.5) grayscale(0.25)",
+ "invert(0.5) grayscale(0.25)");
+
+testComputedFilterRule("Integer value",
+ "opacity(1)",
+ "opacity(1)");
+
+testComputedFilterRule("Float value converts to integer",
+ "opacity(1.0)",
+ "opacity(1)");
+
+testComputedFilterRule("Zero value",
+ "opacity(0)",
+ "opacity(0)");
+
+testComputedFilterRule("No values",
+ "opacity()",
+ "opacity(1)");
+
+testComputedFilterRule("Multiple values",
+ "opacity(0.5) opacity(0.25)",
+ "opacity(0.5) opacity(0.25)");
+
+testComputedFilterRule("Rule combinations",
+ "opacity(0.5) grayscale(0.25)",
+ "opacity(0.5) grayscale(0.25)");
+
+testComputedFilterRule("Integer value",
+ "brightness(1)",
+ "brightness(1)");
+
+testComputedFilterRule("Float value converts to integer",
+ "brightness(1.0)",
+ "brightness(1)");
+
+testComputedFilterRule("Zero value",
+ "brightness(0)",
+ "brightness(0)");
+
+testComputedFilterRule("No values",
+ "brightness()",
+ "brightness(0)");
+
+testComputedFilterRule("Multiple values",
+ "brightness(0.5) brightness(0.25)",
+ "brightness(0.5) brightness(0.25)");
+
+testComputedFilterRule("Rule combinations",
+ "brightness(0.5) grayscale(0.25)",
+ "brightness(0.5) grayscale(0.25)");
+
+testComputedFilterRule("Integer value",
+ "contrast(1)",
+ "contrast(1)");
+
+testComputedFilterRule("Value greater than 1",
+ "contrast(2)",
+ "contrast(2)");
+
+testComputedFilterRule("Float value converts to integer",
+ "contrast(1.0)",
+ "contrast(1)");
+
+testComputedFilterRule("Zero value",
+ "contrast(0)",
+ "contrast(0)");
+
+testComputedFilterRule("No values",
+ "contrast()",
+ "contrast(1)");
+
+testComputedFilterRule("Multiple values",
+ "contrast(0.5) contrast(0.25)",
+ "contrast(0.5) contrast(0.25)");
+
+testComputedFilterRule("Rule combinations",
+ "contrast(0.5) grayscale(0.25)",
+ "contrast(0.5) grayscale(0.25)");
+
+testComputedFilterRule("One zero to px",
+ "blur(0)",
+ "blur(0px)");
+
+testComputedFilterRule("One length",
+ "blur(2em)",
+ "blur(32px)");
+
+testComputedFilterRule("One length",
+ "blur(5px)",
+ "blur(5px)");
+
+testComputedFilterRule("No values",
+ "blur()",
+ "blur(0px)");
+
+testComputedFilterRule("Named color then three values",
+ "drop-shadow(red 1px 2px 3px)",
+ "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)");
+
+testComputedFilterRule("Three values then named color",
+ "drop-shadow(1px 2px 3px red)",
+ "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)");
+
+testComputedFilterRule("Color then three values with zero length",
+ "drop-shadow(#abc 0 0 0)",
+ "drop-shadow(rgb(170, 187, 204) 0px 0px 0px)");
+
+testComputedFilterRule("Three values with zero length",
+ "drop-shadow(0 0 0)",
+ "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)");
+
+testComputedFilterRule("Two values no color",
+ "drop-shadow(1px 2px)",
+ "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)");
+
+testComputedFilterRule("Multiple operations",
+ "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) invert(0.2) opacity(0.9) blur(5px)",
+ [ "grayscale(0.5)",
+ "sepia(0.25)",
+ "saturate(0.75)",
+ "hue-rotate(35deg)",
+ "invert(0.2)",
+ "opacity(0.9)",
+ "blur(5px)" ].join(" "));
+
+testComputedFilterRule("Percentage values",
+ "grayscale(50%) sepia(25%) saturate(75%) invert(20%) opacity(90%) brightness(60%) contrast(30%)",
+ [ "grayscale(0.5)",
+ "sepia(0.25)",
+ "saturate(0.75)",
+ "invert(0.2)",
+ "opacity(0.9)",
+ "brightness(0.6)",
+ "contrast(0.3)" ].join(" "));
+
+successfullyParsed = true;

Powered by Google App Engine
This is Rietveld 408576698