| OLD | NEW |
| 1 description("Test the parsing of the -webkit-filter property."); | 1 description("Test the parsing of the -webkit-filter property."); |
| 2 | 2 |
| 3 function jsWrapperClass(node) | |
| 4 { | |
| 5 if (!node) | |
| 6 return "[null]"; | |
| 7 var string = Object.prototype.toString.apply(node); | |
| 8 return string.substr(8, string.length - 9); | |
| 9 } | |
| 10 | |
| 11 function shouldBeType(expression, className, prototypeName, constructorName) | |
| 12 { | |
| 13 if (!prototypeName) | |
| 14 prototypeName = className + "Prototype"; | |
| 15 if (!constructorName) | |
| 16 constructorName = className + "Constructor"; | |
| 17 shouldBe("jsWrapperClass(" + expression + ")", "'" + className + "'"); | |
| 18 shouldBe("jsWrapperClass(" + expression + ".__proto__)", "'" + prototypeName
+ "'"); | |
| 19 shouldBe("jsWrapperClass(" + expression + ".constructor)", "'" + constructor
Name + "'"); | |
| 20 } | |
| 21 | |
| 22 // These have to be global for the test helpers to see them. | 3 // These have to be global for the test helpers to see them. |
| 23 var stylesheet, cssRule, declaration, filterRule, subRule; | 4 var stylesheet, cssRule, declaration; |
| 24 var styleElement = document.createElement("style"); | 5 var styleElement = document.createElement("style"); |
| 25 document.head.appendChild(styleElement); | 6 document.head.appendChild(styleElement); |
| 26 stylesheet = styleElement.sheet; | 7 stylesheet = styleElement.sheet; |
| 27 | 8 |
| 28 function testFilterRule(description, rule, expectedLength, expectedValue, expect
edTypes, expectedTexts) | 9 function testFilterRule(description, rule, expectedValue) |
| 29 { | 10 { |
| 11 if (expectedValue === undefined) |
| 12 expectedValue = rule; |
| 13 |
| 30 debug(""); | 14 debug(""); |
| 31 debug(description + " : " + rule); | 15 debug(description + " : " + rule); |
| 32 | 16 |
| 33 stylesheet.insertRule("body { -webkit-filter: " + rule + "; }", 0); | 17 stylesheet.insertRule("body { -webkit-filter: " + rule + "; }", 0); |
| 34 cssRule = stylesheet.cssRules.item(0); | 18 cssRule = stylesheet.cssRules.item(0); |
| 35 | 19 |
| 36 shouldBe("cssRule.type", "1"); | 20 shouldBe("cssRule.type", "1"); |
| 37 | 21 |
| 38 declaration = cssRule.style; | 22 declaration = cssRule.style; |
| 39 shouldBe("declaration.length", "1"); | 23 shouldBe("declaration.length", "1"); |
| 40 shouldBe("declaration.getPropertyValue('-webkit-filter')", "'" + expectedVal
ue + "'"); | 24 shouldBeEqualToString("declaration.getPropertyValue('-webkit-filter')", expe
ctedValue); |
| 41 | |
| 42 filterRule = declaration.getPropertyCSSValue('-webkit-filter'); | |
| 43 shouldBeType("filterRule", "CSSValueList"); | |
| 44 | |
| 45 shouldBe("filterRule.length", "" + expectedLength); // shouldBe expects stri
ng arguments | |
| 46 | |
| 47 if (filterRule) { | |
| 48 for (var i = 0; i < expectedLength; i++) { | |
| 49 subRule = filterRule[i]; | |
| 50 shouldBe("subRule.operationType", expectedTypes[i]); | |
| 51 shouldBe("subRule.cssText", "'" + expectedTexts[i] + "'"); | |
| 52 } | |
| 53 } | |
| 54 } | 25 } |
| 55 | 26 |
| 56 testFilterRule("Basic reference", | 27 testFilterRule("Basic reference", "url('#a')", "url('#a')"); |
| 57 "url('#a')", 1, "url(\\'#a\\')", | 28 testFilterRule("Bare unquoted reference converting to quoted form", "url(#a)", "
url('#a')"); |
| 58 ["WebKitCSSFilterValue.CSS_FILTER_REFERENCE"], | 29 testFilterRule("Multiple references", "url('#a') url('#b')", "url('#a') url('#b'
)"); |
| 59 ["url(\\'#a\\')"]); | 30 testFilterRule("Reference as 2nd value", "grayscale(1) url('#a')", "grayscale(1)
url('#a')"); |
| 60 | 31 testFilterRule("Integer value", "grayscale(1)"); |
| 61 testFilterRule("Bare unquoted reference converting to quoted form", | 32 testFilterRule("Percentage value", "grayscale(50%)"); |
| 62 "url(#a)", 1, "url(\\'#a\\')", | 33 testFilterRule("Float value converts to integer", "grayscale(1.0)", "grayscale(1
)"); |
| 63 ["WebKitCSSFilterValue.CSS_FILTER_REFERENCE"], | 34 testFilterRule("Zero value", "grayscale(0)"); |
| 64 ["url(\\'#a\\')"]); | 35 testFilterRule("No values", "grayscale()"); |
| 65 | 36 testFilterRule("Multiple values", "grayscale(0.5) grayscale(0.25)"); |
| 66 testFilterRule("Multiple references", | 37 testFilterRule("Integer value", "sepia(1)"); |
| 67 "url('#a') url('#b')", 2, "url(\\'#a\\') url(\\'#b\\')", | 38 testFilterRule("Percentage value", "sepia(50%)"); |
| 68 ["WebKitCSSFilterValue.CSS_FILTER_REFERENCE", "WebKitCSSFilterVal
ue.CSS_FILTER_REFERENCE"], | 39 testFilterRule("Float value converts to integer", "sepia(1.0)", "sepia(1)"); |
| 69 ["url(\\'#a\\')", "url(\\'#b\\')"]); | 40 testFilterRule("Zero value", "sepia(0)"); |
| 70 | 41 testFilterRule("No values", "sepia()"); |
| 71 testFilterRule("Reference as 2nd value", | 42 testFilterRule("Multiple values", "sepia(0.5) sepia(0.25)"); |
| 72 "grayscale(1) url('#a')", 2, "grayscale(1) url(\\'#a\\')", | 43 testFilterRule("Rule combinations", "sepia(0.5) grayscale(0.25)"); |
| 73 ["WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE", "WebKitCSSFilterVal
ue.CSS_FILTER_REFERENCE"], | 44 testFilterRule("Integer value", "saturate(1)"); |
| 74 ["grayscale(1)", "url(\\'#a\\')"]); | 45 testFilterRule("Percentage value", "saturate(50%)"); |
| 75 | 46 testFilterRule("Percentage value > 1", "saturate(250%)"); |
| 76 testFilterRule("Integer value", | 47 testFilterRule("Float value converts to integer", "saturate(1.0)", "saturate(1)"
); |
| 77 "grayscale(1)", 1, "grayscale(1)", | 48 testFilterRule("Input value > 1", "saturate(5.5)"); |
| 78 ["WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE"], | 49 testFilterRule("Zero value", "saturate(0)"); |
| 79 ["grayscale(1)"]); | 50 testFilterRule("No values", "saturate()"); |
| 80 | 51 testFilterRule("Multiple values", "saturate(0.5) saturate(0.25)"); |
| 81 testFilterRule("Percentage value", | 52 testFilterRule("Rule combinations", "saturate(0.5) grayscale(0.25)"); |
| 82 "grayscale(50%)", 1, "grayscale(50%)", | 53 testFilterRule("Degrees value as integer", "hue-rotate(10deg)"); |
| 83 ["WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE"], | 54 testFilterRule("Degrees float value converts to integer", "hue-rotate(10.0deg)",
"hue-rotate(10deg)"); |
| 84 ["grayscale(50%)"]); | 55 testFilterRule("Radians value", "hue-rotate(10rad)"); |
| 85 | 56 testFilterRule("Gradians value", "hue-rotate(10grad)"); |
| 86 testFilterRule("Float value converts to integer", | 57 testFilterRule("Turns value", "hue-rotate(0.5turn)"); |
| 87 "grayscale(1.0)", 1, "grayscale(1)", | 58 testFilterRule("Zero value", "hue-rotate(0)", "hue-rotate(0deg)"); |
| 88 ["WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE"], | 59 testFilterRule("No values", "hue-rotate()"); |
| 89 ["grayscale(1)"]); | 60 testFilterRule("Rule combinations", "hue-rotate(10deg) grayscale(0.25)"); |
| 90 | 61 testFilterRule("Integer value", "invert(1)") |
| 91 testFilterRule("Zero value", | 62 testFilterRule("Percentage value", "invert(50%)"); |
| 92 "grayscale(0)", 1, "grayscale(0)", | 63 testFilterRule("Float value converts to integer", "invert(1.0)", "invert(1)"); |
| 93 ["WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE"], | 64 testFilterRule("Zero value", "invert(0)"); |
| 94 ["grayscale(0)"]); | 65 testFilterRule("No values", "invert()"); |
| 95 | 66 testFilterRule("Multiple values", "invert(0.5) invert(0.25)"); |
| 96 testFilterRule("No values", | 67 testFilterRule("Rule combinations", "invert(0.5) grayscale(0.25)"); |
| 97 "grayscale()", 1, "grayscale()", | 68 testFilterRule("Integer value", "opacity(1)"); |
| 98 ["WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE"], | 69 testFilterRule("Percentage value", "opacity(50%)"); |
| 99 ["grayscale()"]); | 70 testFilterRule("Float value converts to integer", "opacity(1.0)", "opacity(1)"); |
| 100 | 71 testFilterRule("Zero value", "opacity(0)"); |
| 101 testFilterRule("Multiple values", | 72 testFilterRule("No values", "opacity()"); |
| 102 "grayscale(0.5) grayscale(0.25)", 2, "grayscale(0.5) grayscale(0.
25)", | 73 testFilterRule("Multiple values", "opacity(0.5) opacity(0.25)"); |
| 103 ["WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE", "WebKitCSSFilterVal
ue.CSS_FILTER_GRAYSCALE"], | 74 testFilterRule("Rule combinations", "opacity(0.5) grayscale(0.25)"); |
| 104 ["grayscale(0.5)", "grayscale(0.25)"]); | 75 testFilterRule("Integer value", "brightness(1)"); |
| 105 | 76 testFilterRule("Percentage value", "brightness(50%)"); |
| 106 testFilterRule("Integer value", | 77 testFilterRule("Float value converts to integer", "brightness(1.0)", "brightness
(1)"); |
| 107 "sepia(1)", 1, "sepia(1)", | 78 testFilterRule("Zero value", "brightness(0)"); |
| 108 ["WebKitCSSFilterValue.CSS_FILTER_SEPIA"], | 79 testFilterRule("No values", "brightness()"); |
| 109 ["sepia(1)"]); | 80 testFilterRule("Multiple values", "brightness(0.5) brightness(0.25)"); |
| 110 | 81 testFilterRule("Rule combinations", "brightness(0.5) grayscale(0.25)"); |
| 111 testFilterRule("Percentage value", | 82 testFilterRule("Parameter less than -100%", "brightness(-1.1)"); |
| 112 "sepia(50%)", 1, "sepia(50%)", | 83 testFilterRule("Parameter more than 100%", "brightness(101%)"); |
| 113 ["WebKitCSSFilterValue.CSS_FILTER_SEPIA"], | 84 testFilterRule("Rule combinations", "grayscale(0.25) brightness(0.5)"); |
| 114 ["sepia(50%)"]); | 85 testFilterRule("Integer value", "contrast(1)"); |
| 115 | 86 testFilterRule("Percentage value", "contrast(50%)"); |
| 116 testFilterRule("Float value converts to integer", | 87 testFilterRule("Percentage value > 1", "contrast(250%)"); |
| 117 "sepia(1.0)", 1, "sepia(1)", | 88 testFilterRule("Float value converts to integer", "contrast(1.0)", "contrast(1)"
); |
| 118 ["WebKitCSSFilterValue.CSS_FILTER_SEPIA"], | 89 testFilterRule("Zero value", "contrast(0)"); |
| 119 ["sepia(1)"]); | 90 testFilterRule("No values", "contrast()"); |
| 120 | 91 testFilterRule("Value greater than one", "contrast(2)"); |
| 121 testFilterRule("Zero value", | 92 testFilterRule("Multiple values", "contrast(0.5) contrast(0.25)"); |
| 122 "sepia(0)", 1, "sepia(0)", | 93 testFilterRule("Rule combinations", "contrast(0.5) grayscale(0.25)"); |
| 123 ["WebKitCSSFilterValue.CSS_FILTER_SEPIA"], | 94 testFilterRule("Rule combinations", "grayscale(0.25) contrast(0.5)"); |
| 124 ["sepia(0)"]); | 95 testFilterRule("One zero to px", "blur(0)", "blur(0px)"); |
| 125 | 96 testFilterRule("One length", "blur(10px)"); |
| 126 testFilterRule("No values", | 97 testFilterRule("No values", "blur()"); |
| 127 "sepia()", 1, "sepia()", | 98 testFilterRule("Color then three values", "drop-shadow(red 1px 2px 3px)"); |
| 128 ["WebKitCSSFilterValue.CSS_FILTER_SEPIA"], | 99 testFilterRule("Three values then color", "drop-shadow(1px 2px 3px red)", "drop-
shadow(red 1px 2px 3px)"); |
| 129 ["sepia()"]); | |
| 130 | |
| 131 testFilterRule("Multiple values", | |
| 132 "sepia(0.5) sepia(0.25)", 2, "sepia(0.5) sepia(0.25)", | |
| 133 ["WebKitCSSFilterValue.CSS_FILTER_SEPIA", "WebKitCSSFilterValue.C
SS_FILTER_SEPIA"], | |
| 134 ["sepia(0.5)", "sepia(0.25)"]); | |
| 135 | |
| 136 testFilterRule("Rule combinations", | |
| 137 "sepia(0.5) grayscale(0.25)", 2, "sepia(0.5) grayscale(0.25)", | |
| 138 ["WebKitCSSFilterValue.CSS_FILTER_SEPIA", "WebKitCSSFilterValue.C
SS_FILTER_GRAYSCALE"], | |
| 139 ["sepia(0.5)", "grayscale(0.25)"]); | |
| 140 | |
| 141 testFilterRule("Integer value", | |
| 142 "saturate(1)", 1, "saturate(1)", | |
| 143 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE"], | |
| 144 ["saturate(1)"]); | |
| 145 | |
| 146 testFilterRule("Percentage value", | |
| 147 "saturate(50%)", 1, "saturate(50%)", | |
| 148 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE"], | |
| 149 ["saturate(50%)"]); | |
| 150 | |
| 151 testFilterRule("Percentage value > 1", | |
| 152 "saturate(250%)", 1, "saturate(250%)", | |
| 153 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE"], | |
| 154 ["saturate(250%)"]); | |
| 155 | |
| 156 testFilterRule("Float value converts to integer", | |
| 157 "saturate(1.0)", 1, "saturate(1)", | |
| 158 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE"], | |
| 159 ["saturate(1)"]); | |
| 160 | |
| 161 testFilterRule("Input value > 1", | |
| 162 "saturate(5.5)", 1, "saturate(5.5)", | |
| 163 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE"], | |
| 164 ["saturate(5.5)"]); | |
| 165 | |
| 166 testFilterRule("Zero value", | |
| 167 "saturate(0)", 1, "saturate(0)", | |
| 168 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE"], | |
| 169 ["saturate(0)"]); | |
| 170 | |
| 171 testFilterRule("No values", | |
| 172 "saturate()", 1, "saturate()", | |
| 173 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE"], | |
| 174 ["saturate()"]); | |
| 175 | |
| 176 testFilterRule("Multiple values", | |
| 177 "saturate(0.5) saturate(0.25)", 2, "saturate(0.5) saturate(0.25)"
, | |
| 178 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE", "WebKitCSSFilterValu
e.CSS_FILTER_SATURATE"], | |
| 179 ["saturate(0.5)", "saturate(0.25)"]); | |
| 180 | |
| 181 testFilterRule("Rule combinations", | |
| 182 "saturate(0.5) grayscale(0.25)", 2, "saturate(0.5) grayscale(0.25
)", | |
| 183 ["WebKitCSSFilterValue.CSS_FILTER_SATURATE", "WebKitCSSFilterValu
e.CSS_FILTER_GRAYSCALE"], | |
| 184 ["saturate(0.5)", "grayscale(0.25)"]); | |
| 185 | |
| 186 testFilterRule("Degrees value as integer", | |
| 187 "hue-rotate(10deg)", 1, "hue-rotate(10deg)", | |
| 188 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE"], | |
| 189 ["hue-rotate(10deg)"]); | |
| 190 | |
| 191 testFilterRule("Degrees float value converts to integer", | |
| 192 "hue-rotate(10.0deg)", 1, "hue-rotate(10deg)", | |
| 193 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE"], | |
| 194 ["hue-rotate(10deg)"]); | |
| 195 | |
| 196 testFilterRule("Radians value", | |
| 197 "hue-rotate(10rad)", 1, "hue-rotate(10rad)", | |
| 198 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE"], | |
| 199 ["hue-rotate(10rad)"]); | |
| 200 | |
| 201 testFilterRule("Gradians value", | |
| 202 "hue-rotate(10grad)", 1, "hue-rotate(10grad)", | |
| 203 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE"], | |
| 204 ["hue-rotate(10grad)"]); | |
| 205 | |
| 206 testFilterRule("Turns value", | |
| 207 "hue-rotate(0.5turn)", 1, "hue-rotate(0.5turn)", | |
| 208 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE"], | |
| 209 ["hue-rotate(0.5turn)"]); | |
| 210 | |
| 211 testFilterRule("Zero value", | |
| 212 "hue-rotate(0)", 1, "hue-rotate(0deg)", | |
| 213 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE"], | |
| 214 ["hue-rotate(0deg)"]); | |
| 215 | |
| 216 testFilterRule("No values", | |
| 217 "hue-rotate()", 1, "hue-rotate()", | |
| 218 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE"], | |
| 219 ["hue-rotate()"]); | |
| 220 | |
| 221 testFilterRule("Rule combinations", | |
| 222 "hue-rotate(10deg) grayscale(0.25)", 2, "hue-rotate(10deg) graysc
ale(0.25)", | |
| 223 ["WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE", "WebKitCSSFilterVa
lue.CSS_FILTER_GRAYSCALE"], | |
| 224 ["hue-rotate(10deg)", "grayscale(0.25)"]); | |
| 225 | |
| 226 testFilterRule("Integer value", | |
| 227 "invert(1)", 1, "invert(1)", | |
| 228 ["WebKitCSSFilterValue.CSS_FILTER_INVERT"], | |
| 229 ["invert(1)"]); | |
| 230 | |
| 231 testFilterRule("Percentage value", | |
| 232 "invert(50%)", 1, "invert(50%)", | |
| 233 ["WebKitCSSFilterValue.CSS_FILTER_INVERT"], | |
| 234 ["invert(50%)"]); | |
| 235 | |
| 236 testFilterRule("Float value converts to integer", | |
| 237 "invert(1.0)", 1, "invert(1)", | |
| 238 ["WebKitCSSFilterValue.CSS_FILTER_INVERT"], | |
| 239 ["invert(1)"]); | |
| 240 | |
| 241 testFilterRule("Zero value", | |
| 242 "invert(0)", 1, "invert(0)", | |
| 243 ["WebKitCSSFilterValue.CSS_FILTER_INVERT"], | |
| 244 ["invert(0)"]); | |
| 245 | |
| 246 testFilterRule("No values", | |
| 247 "invert()", 1, "invert()", | |
| 248 ["WebKitCSSFilterValue.CSS_FILTER_INVERT"], | |
| 249 ["invert()"]); | |
| 250 | |
| 251 testFilterRule("Multiple values", | |
| 252 "invert(0.5) invert(0.25)", 2, "invert(0.5) invert(0.25)", | |
| 253 ["WebKitCSSFilterValue.CSS_FILTER_INVERT", "WebKitCSSFilterValue.
CSS_FILTER_INVERT"], | |
| 254 ["invert(0.5)", "invert(0.25)"]); | |
| 255 | |
| 256 testFilterRule("Rule combinations", | |
| 257 "invert(0.5) grayscale(0.25)", 2, "invert(0.5) grayscale(0.25)", | |
| 258 ["WebKitCSSFilterValue.CSS_FILTER_INVERT", "WebKitCSSFilterValue.
CSS_FILTER_GRAYSCALE"], | |
| 259 ["invert(0.5)", "grayscale(0.25)"]); | |
| 260 | |
| 261 testFilterRule("Integer value", | |
| 262 "opacity(1)", 1, "opacity(1)", | |
| 263 ["WebKitCSSFilterValue.CSS_FILTER_OPACITY"], | |
| 264 ["opacity(1)"]); | |
| 265 | |
| 266 testFilterRule("Percentage value", | |
| 267 "opacity(50%)", 1, "opacity(50%)", | |
| 268 ["WebKitCSSFilterValue.CSS_FILTER_OPACITY"], | |
| 269 ["opacity(50%)"]); | |
| 270 | |
| 271 testFilterRule("Float value converts to integer", | |
| 272 "opacity(1.0)", 1, "opacity(1)", | |
| 273 ["WebKitCSSFilterValue.CSS_FILTER_OPACITY"], | |
| 274 ["opacity(1)"]); | |
| 275 | |
| 276 testFilterRule("Zero value", | |
| 277 "opacity(0)", 1, "opacity(0)", | |
| 278 ["WebKitCSSFilterValue.CSS_FILTER_OPACITY"], | |
| 279 ["opacity(0)"]); | |
| 280 | |
| 281 testFilterRule("No values", | |
| 282 "opacity()", 1, "opacity()", | |
| 283 ["WebKitCSSFilterValue.CSS_FILTER_OPACITY"], | |
| 284 ["opacity()"]); | |
| 285 | |
| 286 testFilterRule("Multiple values", | |
| 287 "opacity(0.5) opacity(0.25)", 2, "opacity(0.5) opacity(0.25)", | |
| 288 ["WebKitCSSFilterValue.CSS_FILTER_OPACITY", "WebKitCSSFilterValue
.CSS_FILTER_OPACITY"], | |
| 289 ["opacity(0.5)", "opacity(0.25)"]); | |
| 290 | |
| 291 testFilterRule("Rule combinations", | |
| 292 "opacity(0.5) grayscale(0.25)", 2, "opacity(0.5) grayscale(0.25)"
, | |
| 293 ["WebKitCSSFilterValue.CSS_FILTER_OPACITY", "WebKitCSSFilterValue
.CSS_FILTER_GRAYSCALE"], | |
| 294 ["opacity(0.5)", "grayscale(0.25)"]); | |
| 295 | |
| 296 testFilterRule("Integer value", | |
| 297 "brightness(1)", 1, "brightness(1)", | |
| 298 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"], | |
| 299 ["brightness(1)"]); | |
| 300 | |
| 301 testFilterRule("Percentage value", | |
| 302 "brightness(50%)", 1, "brightness(50%)", | |
| 303 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"], | |
| 304 ["brightness(50%)"]); | |
| 305 | |
| 306 testFilterRule("Float value converts to integer", | |
| 307 "brightness(1.0)", 1, "brightness(1)", | |
| 308 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"], | |
| 309 ["brightness(1)"]); | |
| 310 | |
| 311 testFilterRule("Zero value", | |
| 312 "brightness(0)", 1, "brightness(0)", | |
| 313 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"], | |
| 314 ["brightness(0)"]); | |
| 315 | |
| 316 testFilterRule("No values", | |
| 317 "brightness()", 1, "brightness()", | |
| 318 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"], | |
| 319 ["brightness()"]); | |
| 320 | |
| 321 testFilterRule("Multiple values", | |
| 322 "brightness(0.5) brightness(0.25)", 2, "brightness(0.5) brightness
(0.25)", | |
| 323 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS", "WebKitCSSFilterVal
ue.CSS_FILTER_BRIGHTNESS"], | |
| 324 ["brightness(0.5)", "brightness(0.25)"]); | |
| 325 | |
| 326 testFilterRule("Rule combinations", | |
| 327 "brightness(0.5) grayscale(0.25)", 2, "brightness(0.5) grayscale(0
.25)", | |
| 328 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS", "WebKitCSSFilterVal
ue.CSS_FILTER_GRAYSCALE"], | |
| 329 ["brightness(0.5)", "grayscale(0.25)"]); | |
| 330 | |
| 331 testFilterRule("Parameter less than -100%", | |
| 332 "brightness(-1.1)", 1, "brightness(-1.1)", | |
| 333 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"], | |
| 334 ["brightness(-1.1)"]); | |
| 335 | |
| 336 testFilterRule("Parameter more than 100%", | |
| 337 "brightness(101%)", 1, "brightness(101%)", | |
| 338 ["WebKitCSSFilterValue.CSS_FILTER_BRIGHTNESS"], | |
| 339 ["brightness(101%)"]); | |
| 340 | |
| 341 testFilterRule("Rule combinations", | |
| 342 "grayscale(0.25) brightness(0.5)", 2, "grayscale(0.25) brightness(
0.5)", | |
| 343 [ "WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE", "WebKitCSSFilterVal
ue.CSS_FILTER_BRIGHTNESS"], | |
| 344 ["grayscale(0.25)", "brightness(0.5)"]); | |
| 345 | |
| 346 testFilterRule("Integer value", | |
| 347 "contrast(1)", 1, "contrast(1)", | |
| 348 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST"], | |
| 349 ["contrast(1)"]); | |
| 350 | |
| 351 testFilterRule("Percentage value", | |
| 352 "contrast(50%)", 1, "contrast(50%)", | |
| 353 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST"], | |
| 354 ["contrast(50%)"]); | |
| 355 | |
| 356 testFilterRule("Percentage value > 1", | |
| 357 "contrast(250%)", 1, "contrast(250%)", | |
| 358 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST"], | |
| 359 ["contrast(250%)"]); | |
| 360 | |
| 361 testFilterRule("Float value converts to integer", | |
| 362 "contrast(1.0)", 1, "contrast(1)", | |
| 363 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST"], | |
| 364 ["contrast(1)"]); | |
| 365 | |
| 366 testFilterRule("Zero value", | |
| 367 "contrast(0)", 1, "contrast(0)", | |
| 368 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST"], | |
| 369 ["contrast(0)"]); | |
| 370 | |
| 371 testFilterRule("No values", | |
| 372 "contrast()", 1, "contrast()", | |
| 373 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST"], | |
| 374 ["contrast()"]); | |
| 375 | |
| 376 testFilterRule("Value greater than one", | |
| 377 "contrast(2)", 1, "contrast(2)", | |
| 378 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST"], | |
| 379 ["contrast(2)"]); | |
| 380 | |
| 381 testFilterRule("Multiple values", | |
| 382 "contrast(0.5) contrast(0.25)", 2, "contrast(0.5) contrast(0.25)", | |
| 383 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST", "WebKitCSSFilterValue
.CSS_FILTER_CONTRAST"], | |
| 384 ["contrast(0.5)", "contrast(0.25)"]); | |
| 385 | |
| 386 testFilterRule("Rule combinations", | |
| 387 "contrast(0.5) grayscale(0.25)", 2, "contrast(0.5) grayscale(0.25)
", | |
| 388 ["WebKitCSSFilterValue.CSS_FILTER_CONTRAST", "WebKitCSSFilterValue
.CSS_FILTER_GRAYSCALE"], | |
| 389 ["contrast(0.5)", "grayscale(0.25)"]); | |
| 390 | |
| 391 testFilterRule("Rule combinations", | |
| 392 "grayscale(0.25) contrast(0.5)", 2, "grayscale(0.25) contrast(0.5)
", | |
| 393 [ "WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE", "WebKitCSSFilterVal
ue.CSS_FILTER_CONTRAST"], | |
| 394 ["grayscale(0.25)", "contrast(0.5)"]); | |
| 395 | |
| 396 testFilterRule("One zero to px", | |
| 397 "blur(0)", 1, "blur(0px)", | |
| 398 ["WebKitCSSFilterValue.CSS_FILTER_BLUR"], | |
| 399 ["blur(0px)"]); | |
| 400 | |
| 401 testFilterRule("One length", | |
| 402 "blur(10px)", 1, "blur(10px)", | |
| 403 ["WebKitCSSFilterValue.CSS_FILTER_BLUR"], | |
| 404 ["blur(10px)"]); | |
| 405 | |
| 406 testFilterRule("No values", | |
| 407 "blur()", 1, "blur()", | |
| 408 ["WebKitCSSFilterValue.CSS_FILTER_BLUR"], | |
| 409 ["blur()"]); | |
| 410 | |
| 411 testFilterRule("Color then three values", | |
| 412 "drop-shadow(red 1px 2px 3px)", 1, "drop-shadow(red 1px 2px 3px)", | |
| 413 ["WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW"], | |
| 414 ["drop-shadow(red 1px 2px 3px)"]); | |
| 415 | |
| 416 testFilterRule("Three values then color", | |
| 417 "drop-shadow(1px 2px 3px red)", 1, "drop-shadow(red 1px 2px 3px)", | |
| 418 ["WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW"], | |
| 419 ["drop-shadow(red 1px 2px 3px)"]); | |
| 420 | 100 |
| 421 testFilterRule("Color then three values with zero length", | 101 testFilterRule("Color then three values with zero length", |
| 422 "drop-shadow(#abc 0 0 0)", 1, "drop-shadow(rgb(170, 187, 204) 0px
0px 0px)", | 102 "drop-shadow(#abc 0 0 0)", "drop-shadow(rgb(170, 187, 204) 0px 0px
0px)"); |
| 423 ["WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW"], | |
| 424 ["drop-shadow(rgb(170, 187, 204) 0px 0px 0px)"]); | |
| 425 | 103 |
| 426 testFilterRule("Three values with zero length", | 104 testFilterRule("Three values with zero length", |
| 427 "drop-shadow(0 0 0)", 1, "drop-shadow(0px 0px 0px)", | 105 "drop-shadow(0 0 0)", "drop-shadow(0px 0px 0px)"); |
| 428 ["WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW"], | |
| 429 ["drop-shadow(0px 0px 0px)"]); | |
| 430 | 106 |
| 431 testFilterRule("Two values no color", | 107 testFilterRule("Two values no color", "drop-shadow(1px 2px)"); |
| 432 "drop-shadow(1px 2px)", 1, "drop-shadow(1px 2px)", | |
| 433 ["WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW"], | |
| 434 ["drop-shadow(1px 2px)"]); | |
| 435 | 108 |
| 436 testFilterRule("Multiple operations", | 109 testFilterRule("Multiple operations", |
| 437 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) inve
rt(0.2) opacity(0.9) blur(5px) drop-shadow(green 1px 2px 3px)", 8, | 110 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) inve
rt(0.2) opacity(0.9) blur(5px) drop-shadow(green 1px 2px 3px)"); |
| 438 "grayscale(0.5) sepia(0.25) saturate(0.75) hue-rotate(35deg) inve
rt(0.2) opacity(0.9) blur(5px) drop-shadow(green 1px 2px 3px)", | |
| 439 [ | |
| 440 "WebKitCSSFilterValue.CSS_FILTER_GRAYSCALE", | |
| 441 "WebKitCSSFilterValue.CSS_FILTER_SEPIA", | |
| 442 "WebKitCSSFilterValue.CSS_FILTER_SATURATE", | |
| 443 "WebKitCSSFilterValue.CSS_FILTER_HUE_ROTATE", | |
| 444 "WebKitCSSFilterValue.CSS_FILTER_INVERT", | |
| 445 "WebKitCSSFilterValue.CSS_FILTER_OPACITY", | |
| 446 "WebKitCSSFilterValue.CSS_FILTER_BLUR", | |
| 447 "WebKitCSSFilterValue.CSS_FILTER_DROP_SHADOW" | |
| 448 ], | |
| 449 [ | |
| 450 "grayscale(0.5)", | |
| 451 "sepia(0.25)", | |
| 452 "saturate(0.75)", | |
| 453 "hue-rotate(35deg)", | |
| 454 "invert(0.2)", | |
| 455 "opacity(0.9)", | |
| 456 "blur(5px)", | |
| 457 "drop-shadow(green 1px 2px 3px)" | |
| 458 ]); | |
| 459 | 111 |
| 460 successfullyParsed = true; | 112 successfullyParsed = true; |
| OLD | NEW |