Index: third_party/WebKit/LayoutTests/css3/filters/unprefixed.html |
diff --git a/third_party/WebKit/LayoutTests/css3/filters/unprefixed.html b/third_party/WebKit/LayoutTests/css3/filters/unprefixed.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2f45d1659c5181d989aa78231f67f98c0525bbb6 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/css3/filters/unprefixed.html |
@@ -0,0 +1,121 @@ |
+<!DOCTYPE html> |
+<title>-webkit-filter matches filter</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="../../css-parser/resources/property-parsing-test.js"></script> |
+<script> |
+function assert_prefixed_computed_style(property, value, expectedValue) { |
+ if (expectedValue === undefined) |
+ expectedValue = value; |
+ |
+ var stringifiedValue = JSON.stringify(value); |
+ var prefixedProperty = convert_to_dashes('webkit' + property.charAt(0).toUpperCase() + property.substr(1)); |
+ |
+ test(function() { |
+ var div = document.createElement('div'); |
+ div.setAttribute("style", prefixedProperty + ": " + value); |
+ document.head.appendChild(div); |
+ var computedStyleValue = getComputedStyle(div)[property]; |
+ div.remove(); |
+ assert_equals(computedStyleValue, expectedValue); |
+ }, "Computed style after parsing style='" + prefixedProperty + ": " + stringifiedValue + "'"); |
+} |
+ |
+assert_prefixed_computed_style("filter", "url('#a')", 'url("#a")'); // Basic reference |
+assert_prefixed_computed_style("filter", "url(#a)", 'url("#a")'); // Bare unquoted reference converting to quoted form |
+assert_prefixed_computed_style("filter", "url('#a') url('#b')", 'url("#a") url("#b")'); // Multiple references |
+ |
+assert_prefixed_computed_style("filter", "grayscale(1) url('#a')", 'grayscale(1) url("#a")'); // Reference as 2nd value |
+assert_prefixed_computed_style("filter", "grayscale(1.0)", "grayscale(1)"); // Float value converts to integer |
+assert_prefixed_computed_style("filter", "grayscale(0)"); // Zero value |
+assert_prefixed_computed_style("filter", "grayscale()", "grayscale(1)"); // No arguments |
+assert_prefixed_computed_style("filter", "grayscale(0.5) grayscale(0.25)"); // Multiple values |
+ |
+assert_prefixed_computed_style("filter", "sepia(1)"); // Integer value |
+assert_prefixed_computed_style("filter", "sepia(1.0)", "sepia(1)"); // Float value converts to integer |
+assert_prefixed_computed_style("filter", "sepia(0)"); // Zero value |
+assert_prefixed_computed_style("filter", "sepia()", "sepia(1)"); // No arguments |
+assert_prefixed_computed_style("filter", "sepia(0.5) sepia(0.25)"); // Multiple values |
+ |
+assert_prefixed_computed_style("filter", "saturate(1)"); // Integer value |
+assert_prefixed_computed_style("filter", "saturate(1.0)", "saturate(1)"); // Float value converts to integer |
+assert_prefixed_computed_style("filter", "saturate(0)"); // Zero value |
+assert_prefixed_computed_style("filter", "saturate()", "saturate(1)"); // No arguments |
+assert_prefixed_computed_style("filter", "saturate(0.5) saturate(0.25)"); // Multiple values |
+ |
+assert_prefixed_computed_style("filter", "hue-rotate(10deg)"); // Degrees value as integer |
+assert_prefixed_computed_style("filter", "hue-rotate(10.0deg)", "hue-rotate(10deg)"); // Degrees float value converts to integer |
+assert_prefixed_computed_style("filter", "hue-rotate(10rad)", "hue-rotate(572.958deg)"); // Radians value |
+assert_prefixed_computed_style("filter", "hue-rotate(10grad)", "hue-rotate(9deg)"); // Gradians value |
+assert_prefixed_computed_style("filter", "hue-rotate(0.5turn)", "hue-rotate(180deg)"); // Turns value |
+assert_prefixed_computed_style("filter", "hue-rotate(0)", "hue-rotate(0deg)"); // Zero value |
+assert_prefixed_computed_style("filter", "hue-rotate()", "hue-rotate(0deg)"); // No arguments |
+ |
+assert_prefixed_computed_style("filter", "invert(1)"); // Integer value |
+assert_prefixed_computed_style("filter", "invert(1.0)", "invert(1)"); // Float value converts to integer |
+assert_prefixed_computed_style("filter", "invert(0)"); // Zero value |
+assert_prefixed_computed_style("filter", "invert()", "invert(1)"); // No arguments |
+assert_prefixed_computed_style("filter", "invert(0.5) invert(0.25)"); // Multiple values |
+ |
+assert_prefixed_computed_style("filter", "opacity(1)"); // Integer value |
+assert_prefixed_computed_style("filter", "opacity(1.0)", "opacity(1)"); // Float value converts to integer |
+assert_prefixed_computed_style("filter", "opacity(0)"); // Zero value |
+assert_prefixed_computed_style("filter", "opacity()", "opacity(1)"); // No arguments |
+assert_prefixed_computed_style("filter", "opacity(0.5) opacity(0.25)"); // Multiple values |
+ |
+assert_prefixed_computed_style("filter", "brightness(1)"); // Integer value |
+assert_prefixed_computed_style("filter", "brightness(1.0)", "brightness(1)"); // Float value converts to integer |
+assert_prefixed_computed_style("filter", "brightness(0)"); // Zero value |
+assert_prefixed_computed_style("filter", "brightness()", "brightness(0)"); // No arguments |
+assert_prefixed_computed_style("filter", "brightness(0.5) brightness(0.25)"); // Multiple values |
+ |
+assert_prefixed_computed_style("filter", "contrast(1)"); // Integer value |
+assert_prefixed_computed_style("filter", "contrast(2)"); // Value greater than 1 |
+assert_prefixed_computed_style("filter", "contrast(1.0)", "contrast(1)"); // Float value converts to integer |
+assert_prefixed_computed_style("filter", "contrast(0)"); // Zero value |
+assert_prefixed_computed_style("filter", "contrast()", "contrast(1)"); // No arguments |
+assert_prefixed_computed_style("filter", "contrast(0.5) contrast(0.25)"); // Multiple values |
+ |
+assert_prefixed_computed_style("filter", "blur(0)", "blur(0px)"); // One zero to px |
+assert_prefixed_computed_style("filter", "blur(2em)", "blur(32px)"); // One length |
+assert_prefixed_computed_style("filter", "blur(5px)"); // One length |
+assert_prefixed_computed_style("filter", "blur()", "blur(0px)"); // No arguments |
+ |
+assert_prefixed_computed_style("filter", "drop-shadow(red 1px 2px 3px)", |
+ "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)"); // Named color then three values |
+assert_prefixed_computed_style("filter", "drop-shadow(1px 2px 3px red)", |
+ "drop-shadow(rgb(255, 0, 0) 1px 2px 3px)"); // Three values then named color |
+assert_prefixed_computed_style("filter", "drop-shadow(#abc 0 0 0)", |
+ "drop-shadow(rgb(170, 187, 204) 0px 0px 0px)"); // Color then three values with zero length |
+assert_prefixed_computed_style("filter", "drop-shadow(0 0 0)", |
+ "drop-shadow(rgb(0, 0, 0) 0px 0px 0px)"); // Three values with zero length |
+assert_prefixed_computed_style("filter", "drop-shadow(1px 2px)", |
+ "drop-shadow(rgb(0, 0, 0) 1px 2px 0px)"); // Two values no color |
+ |
+// Rule combinations |
+assert_prefixed_computed_style("filter", "contrast(0.5) grayscale(0.25)"); |
+assert_prefixed_computed_style("filter", "sepia(0.5) grayscale(0.25)"); |
+assert_prefixed_computed_style("filter", "saturate(0.5) grayscale(0.25)"); |
+assert_prefixed_computed_style("filter", "hue-rotate(10deg) grayscale(0.25)"); |
+assert_prefixed_computed_style("filter", "invert(0.5) grayscale(0.25)"); |
+assert_prefixed_computed_style("filter", "opacity(0.5) grayscale(0.25)"); |
+assert_prefixed_computed_style("filter", "brightness(0.5) grayscale(0.25)"); |
+assert_prefixed_computed_style("filter", |
+ "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(" ")); |
+assert_prefixed_computed_style("filter", |
+ "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(" ")); // Percentage values |
+</script> |