Changeset 148802 in webkit
- Timestamp:
- Apr 20, 2013 8:32:31 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r148797 r148802 1 2013-04-20 Dirk Schulze <krit@webkit.org> 2 3 [Part 5] Parse color value for custom() function parameters 4 https://bugs.webkit.org/show_bug.cgi?id=114902 5 6 Reviewed by Dean Jackson. 7 8 Added tests for color parameters on custom fiter function and parameter descriptor. 9 10 * css3/filters/custom-with-at-rule-syntax/parsing-custom-function-invalid-expected.txt: 11 * css3/filters/custom-with-at-rule-syntax/parsing-custom-function-valid-expected.txt: 12 * css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-invalid-expected.txt: 13 * css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-valid-expected.txt: 14 * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-custom-function-invalid.js: 15 * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-custom-function-valid.js: 16 * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-parameters-property-invalid.js: 17 * css3/filters/custom-with-at-rule-syntax/script-tests/parsing-parameters-property-valid.js: 18 1 19 2013-04-20 Glenn Adams <glenn@skynav.com> 2 20 -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-custom-function-invalid-expected.txt
r141480 r148802 108 108 109 109 ======================================== 110 Color parameter tests. 111 ======================================== 112 113 No rgb color values. 114 custom(my-filter, c rgb(,,)) 115 PASS styleRule.type is CSSRule.STYLE_RULE 116 PASS declaration.length is 0 117 PASS declaration.getPropertyValue('-webkit-filter') is null 118 119 No hsl color values. 120 custom(my-filter, c hsl(,,)) 121 PASS styleRule.type is CSSRule.STYLE_RULE 122 PASS declaration.length is 0 123 PASS declaration.getPropertyValue('-webkit-filter') is null 124 125 Hex with 8 characters. 126 custom(my-filter, c #FF0000FF) 127 PASS styleRule.type is CSSRule.STYLE_RULE 128 PASS declaration.length is 0 129 PASS declaration.getPropertyValue('-webkit-filter') is null 130 131 Hex with 2 character. 132 custom(my-filter, c #FF) 133 PASS styleRule.type is CSSRule.STYLE_RULE 134 PASS declaration.length is 0 135 PASS declaration.getPropertyValue('-webkit-filter') is null 136 137 Rgba with 3 values and 2 commas. 138 custom(my-filter, c rgba(255, 0, 0)) 139 PASS styleRule.type is CSSRule.STYLE_RULE 140 PASS declaration.length is 0 141 PASS declaration.getPropertyValue('-webkit-filter') is null 142 143 ======================================== 110 144 Transform parameter tests. 111 145 ======================================== … … 306 340 PASS declaration.length is 0 307 341 PASS declaration.getPropertyValue('-webkit-filter') is null 342 343 ======================================== 344 Mixing parameter types. 345 ======================================== 346 347 Number parameter with hex color. 348 custom(my-filter, n1 1 2 #FF0000) 349 PASS styleRule.type is CSSRule.STYLE_RULE 350 PASS declaration.length is 0 351 PASS declaration.getPropertyValue('-webkit-filter') is null 352 353 Number parameter with color keyword. 354 custom(my-filter, n1 1 2 red) 355 PASS styleRule.type is CSSRule.STYLE_RULE 356 PASS declaration.length is 0 357 PASS declaration.getPropertyValue('-webkit-filter') is null 358 359 Number parameter with rgb color. 360 custom(my-filter, n1 1 2 rgb(255, 0, 0)) 361 PASS styleRule.type is CSSRule.STYLE_RULE 362 PASS declaration.length is 0 363 PASS declaration.getPropertyValue('-webkit-filter') is null 364 365 Color with number parameter. 366 custom(my-filter, a rgb(255, 0, 0) 1) 367 PASS styleRule.type is CSSRule.STYLE_RULE 368 PASS declaration.length is 0 369 PASS declaration.getPropertyValue('-webkit-filter') is null 370 371 Color in array. 372 custom(my-filter, a array(0, rgb(255, 0, 0))) 373 PASS styleRule.type is CSSRule.STYLE_RULE 374 PASS declaration.length is 0 375 PASS declaration.getPropertyValue('-webkit-filter') is null 376 377 Color and array. 378 custom(my-filter, a array(0, 0) rgb(255, 0, 0)) 379 PASS styleRule.type is CSSRule.STYLE_RULE 380 PASS declaration.length is 0 381 PASS declaration.getPropertyValue('-webkit-filter') is null 382 383 Color with transform values. 384 custom(my-filter, a rotate(45deg) rgb(255, 0, 0)) 385 PASS styleRule.type is CSSRule.STYLE_RULE 386 PASS declaration.length is 0 387 PASS declaration.getPropertyValue('-webkit-filter') is null 388 389 Color with transform values. 390 custom(my-filter, a rgb(255, 0, 0) rotate(45deg)) 391 PASS styleRule.type is CSSRule.STYLE_RULE 392 PASS declaration.length is 0 393 PASS declaration.getPropertyValue('-webkit-filter') is null 308 394 PASS successfullyParsed is true 309 395 -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-custom-function-valid-expected.txt
r141480 r148802 110 110 111 111 ======================================== 112 Color parameter tests. 113 ======================================== 114 115 Hex color. 116 custom(my-filter, c #00FF00) 117 PASS styleRule.type is CSSRule.STYLE_RULE 118 PASS styleDeclaration.length is 1 119 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, c rgb(0, 255, 0))' 120 PASS filterPropertyValue instanceof CSSValueList is true 121 PASS filterPropertyValue.constructor === CSSValueList is true 122 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 123 PASS filterPropertyValue.length is 1 124 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 125 PASS subValue.cssText is 'custom(my-filter, c rgb(0, 255, 0))' 126 127 Color keyword. 128 custom(my-filter, c green) 129 PASS styleRule.type is CSSRule.STYLE_RULE 130 PASS styleDeclaration.length is 1 131 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, c rgb(0, 128, 0))' 132 PASS filterPropertyValue instanceof CSSValueList is true 133 PASS filterPropertyValue.constructor === CSSValueList is true 134 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 135 PASS filterPropertyValue.length is 1 136 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 137 PASS subValue.cssText is 'custom(my-filter, c rgb(0, 128, 0))' 138 139 Color rgb function. 140 custom(my-filter, c rgb(0, 128, 0)) 141 PASS styleRule.type is CSSRule.STYLE_RULE 142 PASS styleDeclaration.length is 1 143 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, c rgb(0, 128, 0))' 144 PASS filterPropertyValue instanceof CSSValueList is true 145 PASS filterPropertyValue.constructor === CSSValueList is true 146 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 147 PASS filterPropertyValue.length is 1 148 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 149 PASS subValue.cssText is 'custom(my-filter, c rgb(0, 128, 0))' 150 151 Color hsl function. 152 custom(my-filter, c hsl(120, 100%, 50%)) 153 PASS styleRule.type is CSSRule.STYLE_RULE 154 PASS styleDeclaration.length is 1 155 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, c rgb(0, 255, 0))' 156 PASS filterPropertyValue instanceof CSSValueList is true 157 PASS filterPropertyValue.constructor === CSSValueList is true 158 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 159 PASS filterPropertyValue.length is 1 160 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 161 PASS subValue.cssText is 'custom(my-filter, c rgb(0, 255, 0))' 162 163 Color rgba function. 164 custom(my-filter, c rgba(0, 255, 0, 0.2)) 165 PASS styleRule.type is CSSRule.STYLE_RULE 166 PASS styleDeclaration.length is 1 167 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, c rgba(0, 255, 0, 0.2))' 168 PASS filterPropertyValue instanceof CSSValueList is true 169 PASS filterPropertyValue.constructor === CSSValueList is true 170 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 171 PASS filterPropertyValue.length is 1 172 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 173 PASS subValue.cssText is 'custom(my-filter, c rgba(0, 255, 0, 0.2))' 174 175 Color hsla function. 176 custom(my-filter, c hsla(120, 100%, 50%, 0.2)) 177 PASS styleRule.type is CSSRule.STYLE_RULE 178 PASS styleDeclaration.length is 1 179 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, c rgba(0, 255, 0, 0.2))' 180 PASS filterPropertyValue instanceof CSSValueList is true 181 PASS filterPropertyValue.constructor === CSSValueList is true 182 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 183 PASS filterPropertyValue.length is 1 184 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 185 PASS subValue.cssText is 'custom(my-filter, c rgba(0, 255, 0, 0.2))' 186 187 ======================================== 112 188 Transform parameter tests. 113 189 ======================================== … … 229 305 ======================================== 230 306 231 Number parameter, transform parameter, and array parameter.232 custom(my-filter, n 1, t rotate(0deg), a array(1))233 PASS styleRule.type is CSSRule.STYLE_RULE 234 PASS styleDeclaration.length is 1 235 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, n 1, t rotate(0deg), a array(1))'236 PASS filterPropertyValue instanceof CSSValueList is true 237 PASS filterPropertyValue.constructor === CSSValueList is true 238 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 239 PASS filterPropertyValue.length is 1 240 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 241 PASS subValue.cssText is 'custom(my-filter, n 1, t rotate(0deg), a array(1))'307 Number parameter, color parameter, transform parameter, and array parameter. 308 custom(my-filter, n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1)) 309 PASS styleRule.type is CSSRule.STYLE_RULE 310 PASS styleDeclaration.length is 1 311 PASS styleDeclaration.getPropertyValue('-webkit-filter') is 'custom(my-filter, n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1))' 312 PASS filterPropertyValue instanceof CSSValueList is true 313 PASS filterPropertyValue.constructor === CSSValueList is true 314 PASS filterPropertyValue.__proto__ === CSSValueList.prototype is true 315 PASS filterPropertyValue.length is 1 316 PASS subValue.operationType is WebKitCSSFilterValue.CSS_FILTER_CUSTOM 317 PASS subValue.cssText is 'custom(my-filter, n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1))' 242 318 PASS successfullyParsed is true 243 319 -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-invalid-expected.txt
r148227 r148802 52 52 53 53 ======================================== 54 Color parameter tests. 55 ======================================== 56 57 No rgb color values. 58 parameters: c rgb(,,); 59 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 60 PASS styleDeclaration.length is 0 61 PASS styleDeclaration.getPropertyValue('parameters') is null 62 63 No hsl color values. 64 parameters: c hsl(,,); 65 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 66 PASS styleDeclaration.length is 0 67 PASS styleDeclaration.getPropertyValue('parameters') is null 68 69 Hex with 8 characters. 70 parameters: c #FF0000FF; 71 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 72 PASS styleDeclaration.length is 0 73 PASS styleDeclaration.getPropertyValue('parameters') is null 74 75 Hex with 2 character. 76 parameters: c #FF; 77 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 78 PASS styleDeclaration.length is 0 79 PASS styleDeclaration.getPropertyValue('parameters') is null 80 81 Rgba with 3 values and 2 commas. 82 parameters: c rgba(255, 0, 0); 83 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 84 PASS styleDeclaration.length is 0 85 PASS styleDeclaration.getPropertyValue('parameters') is null 86 87 ======================================== 54 88 Transform parameter tests. 55 89 ======================================== … … 232 266 PASS styleDeclaration.length is 0 233 267 PASS styleDeclaration.getPropertyValue('parameters') is null 268 269 ======================================== 270 Mixing parameter types. 271 ======================================== 272 273 Number parameter with hex color. 274 parameters: n1 1 2 #FF0000; 275 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 276 PASS styleDeclaration.length is 0 277 PASS styleDeclaration.getPropertyValue('parameters') is null 278 279 Number parameter with color keyword. 280 parameters: n1 1 2 red; 281 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 282 PASS styleDeclaration.length is 0 283 PASS styleDeclaration.getPropertyValue('parameters') is null 284 285 Number parameter with rgb color. 286 parameters: n1 1 2 rgb(255, 0, 0); 287 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 288 PASS styleDeclaration.length is 0 289 PASS styleDeclaration.getPropertyValue('parameters') is null 290 291 Color with number parameter. 292 parameters: a rgb(255, 0, 0) 1; 293 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 294 PASS styleDeclaration.length is 0 295 PASS styleDeclaration.getPropertyValue('parameters') is null 296 297 Color in array. 298 parameters: a array(0, rgb(255, 0, 0)); 299 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 300 PASS styleDeclaration.length is 0 301 PASS styleDeclaration.getPropertyValue('parameters') is null 302 303 Color and array. 304 parameters: a array(0, 0) rgb(255, 0, 0); 305 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 306 PASS styleDeclaration.length is 0 307 PASS styleDeclaration.getPropertyValue('parameters') is null 308 309 Color with transform values. 310 parameters: a rotate(45deg) rgb(255, 0, 0); 311 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 312 PASS styleDeclaration.length is 0 313 PASS styleDeclaration.getPropertyValue('parameters') is null 314 315 Color with transform values. 316 parameters: a rgb(255, 0, 0) rotate(45deg); 317 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 318 PASS styleDeclaration.length is 0 319 PASS styleDeclaration.getPropertyValue('parameters') is null 234 320 PASS successfullyParsed is true 235 321 -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/parsing-parameters-property-valid-expected.txt
r148227 r148802 178 178 179 179 ======================================== 180 Color parameter tests. 181 ======================================== 182 183 Hex color. 184 parameters: c #00FF00; 185 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 186 PASS styleDeclaration.length is 1 187 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "c rgb(0, 255, 0)" 188 PASS parametersPropertyValue instanceof CSSValueList is true 189 PASS parametersPropertyValue.constructor === CSSValueList is true 190 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 191 PASS parametersPropertyValue.length is 1 192 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 193 PASS removeBaseURL(subValue.cssText) is "c rgb(0, 255, 0)" 194 195 Color keyword. 196 parameters: c green; 197 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 198 PASS styleDeclaration.length is 1 199 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "c rgb(0, 128, 0)" 200 PASS parametersPropertyValue instanceof CSSValueList is true 201 PASS parametersPropertyValue.constructor === CSSValueList is true 202 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 203 PASS parametersPropertyValue.length is 1 204 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 205 PASS removeBaseURL(subValue.cssText) is "c rgb(0, 128, 0)" 206 207 Color rgb function. 208 parameters: c rgb(0, 128, 0); 209 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 210 PASS styleDeclaration.length is 1 211 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "c rgb(0, 128, 0)" 212 PASS parametersPropertyValue instanceof CSSValueList is true 213 PASS parametersPropertyValue.constructor === CSSValueList is true 214 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 215 PASS parametersPropertyValue.length is 1 216 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 217 PASS removeBaseURL(subValue.cssText) is "c rgb(0, 128, 0)" 218 219 Color hsl function. 220 parameters: c hsl(120, 100%, 50%); 221 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 222 PASS styleDeclaration.length is 1 223 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "c rgb(0, 255, 0)" 224 PASS parametersPropertyValue instanceof CSSValueList is true 225 PASS parametersPropertyValue.constructor === CSSValueList is true 226 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 227 PASS parametersPropertyValue.length is 1 228 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 229 PASS removeBaseURL(subValue.cssText) is "c rgb(0, 255, 0)" 230 231 Color rgba function. 232 parameters: c rgba(0, 255, 0, 0.2); 233 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 234 PASS styleDeclaration.length is 1 235 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "c rgba(0, 255, 0, 0.2)" 236 PASS parametersPropertyValue instanceof CSSValueList is true 237 PASS parametersPropertyValue.constructor === CSSValueList is true 238 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 239 PASS parametersPropertyValue.length is 1 240 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 241 PASS removeBaseURL(subValue.cssText) is "c rgba(0, 255, 0, 0.2)" 242 243 Color hsla function. 244 parameters: c hsla(120, 100%, 50%, 0.2); 245 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 246 PASS styleDeclaration.length is 1 247 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "c rgba(0, 255, 0, 0.2)" 248 PASS parametersPropertyValue instanceof CSSValueList is true 249 PASS parametersPropertyValue.constructor === CSSValueList is true 250 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 251 PASS parametersPropertyValue.length is 1 252 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 253 PASS removeBaseURL(subValue.cssText) is "c rgba(0, 255, 0, 0.2)" 254 255 ======================================== 180 256 Combined parameter tests. 181 257 ======================================== 182 258 183 Number parameter, transform parameter,and array parameter.184 parameters: n 1, t rotate(0deg), a array(1);185 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 186 PASS styleDeclaration.length is 1 187 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "n 1, t rotate(0deg), a array(1)"188 PASS parametersPropertyValue instanceof CSSValueList is true 189 PASS parametersPropertyValue.constructor === CSSValueList is true 190 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 191 PASS parametersPropertyValue.length is 3259 Number parameter, color parameter, transform parameter and array parameter. 260 parameters: n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1); 261 PASS filterAtRule.type is CSSRule.WEBKIT_FILTER_RULE 262 PASS styleDeclaration.length is 1 263 PASS removeBaseURL(styleDeclaration.getPropertyValue('parameters')) is "n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1)" 264 PASS parametersPropertyValue instanceof CSSValueList is true 265 PASS parametersPropertyValue.constructor === CSSValueList is true 266 PASS parametersPropertyValue.__proto__ === CSSValueList.prototype is true 267 PASS parametersPropertyValue.length is 4 192 268 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 193 269 PASS removeBaseURL(subValue.cssText) is "n 1" 270 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 271 PASS removeBaseURL(subValue.cssText) is "c rgb(0, 128, 0)" 194 272 PASS subValue.cssValueType is CSSValue.CSS_VALUE_LIST 195 273 PASS removeBaseURL(subValue.cssText) is "t rotate(0deg)" -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-custom-function-invalid.js
r141480 r148802 40 40 testInvalidFilterRule("No parameter value with multiple parameters.", "custom(my-filter, n1, n2, n3)"); 41 41 42 heading("Color parameter tests."); 43 testInvalidFilterRule("No rgb color values.", "custom(my-filter, c rgb(,,))"); 44 testInvalidFilterRule("No hsl color values.", "custom(my-filter, c hsl(,,))"); 45 testInvalidFilterRule("Hex with 8 characters.", "custom(my-filter, c #FF0000FF)"); 46 testInvalidFilterRule("Hex with 2 character.", "custom(my-filter, c #FF)"); 47 testInvalidFilterRule("Rgba with 3 values and 2 commas.", "custom(my-filter, c rgba(255, 0, 0))"); 48 42 49 heading("Transform parameter tests."); 43 50 testInvalidFilterRule("One invalid transform function.", "custom(my-filter, t invalid-rotate(0deg))"); … … 75 82 testInvalidFilterRule("Invalid value unit 'deg' in array.", "custom(my-filter, a array(1deg))"); 76 83 testInvalidFilterRule("Invalid value unit 'px' in array after valid values.", "custom(my-filter, a array(1, 2, 3, 4px))"); 84 85 heading("Mixing parameter types."); 86 testInvalidFilterRule("Number parameter with hex color.", "custom(my-filter, n1 1 2 #FF0000)"); 87 testInvalidFilterRule("Number parameter with color keyword.", "custom(my-filter, n1 1 2 red)"); 88 testInvalidFilterRule("Number parameter with rgb color.", "custom(my-filter, n1 1 2 rgb(255, 0, 0))"); 89 testInvalidFilterRule("Color with number parameter.", "custom(my-filter, a rgb(255, 0, 0) 1)"); 90 testInvalidFilterRule("Color in array.", "custom(my-filter, a array(0, rgb(255, 0, 0)))"); 91 testInvalidFilterRule("Color and array.", "custom(my-filter, a array(0, 0) rgb(255, 0, 0))"); 92 testInvalidFilterRule("Color with transform values.", "custom(my-filter, a rotate(45deg) rgb(255, 0, 0))"); 93 testInvalidFilterRule("Color with transform values.", "custom(my-filter, a rgb(255, 0, 0) rotate(45deg))"); -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-custom-function-valid.js
r141480 r148802 69 69 "custom(my-filter, background 0 1 0 1)"); 70 70 71 heading("Color parameter tests."); 72 testFilterProperty("Hex color.", 73 "custom(my-filter, c #00FF00)", 74 "custom(my-filter, c rgb(0, 255, 0))"); 75 testFilterProperty("Color keyword.", 76 "custom(my-filter, c green)", 77 "custom(my-filter, c rgb(0, 128, 0))"); 78 testFilterProperty("Color rgb function.", 79 "custom(my-filter, c rgb(0, 128, 0))", 80 "custom(my-filter, c rgb(0, 128, 0))"); 81 testFilterProperty("Color hsl function.", 82 "custom(my-filter, c hsl(120, 100%, 50%))", 83 "custom(my-filter, c rgb(0, 255, 0))"); 84 testFilterProperty("Color rgba function.", 85 "custom(my-filter, c rgba(0, 255, 0, 0.2))", 86 "custom(my-filter, c rgba(0, 255, 0, 0.2))"); 87 testFilterProperty("Color hsla function.", 88 "custom(my-filter, c hsla(120, 100%, 50%, 0.2))", 89 "custom(my-filter, c rgba(0, 255, 0, 0.2))"); 90 71 91 heading("Transform parameter tests.") 72 92 testFilterProperty("Transform parameter with one transform function.", … … 101 121 102 122 heading("Combined parameter tests."); 103 testFilterProperty("Number parameter, transform parameter, and array parameter.",104 "custom(my-filter, n 1, t rotate(0deg), a array(1))",105 "custom(my-filter, n 1, t rotate(0deg), a array(1))");123 testFilterProperty("Number parameter, color parameter, transform parameter, and array parameter.", 124 "custom(my-filter, n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1))", 125 "custom(my-filter, n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1))"); -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-parameters-property-invalid.js
r148227 r148802 30 30 testInvalidParametersProperty("No parameter value.", "n"); 31 31 testInvalidParametersProperty("No parameter value with multiple parameters.", "n1, n2, n3"); 32 33 heading("Color parameter tests."); 34 testInvalidParametersProperty("No rgb color values.", "c rgb(,,)"); 35 testInvalidParametersProperty("No hsl color values.", "c hsl(,,)"); 36 testInvalidParametersProperty("Hex with 8 characters.", "c #FF0000FF"); 37 testInvalidParametersProperty("Hex with 2 character.", "c #FF"); 38 testInvalidParametersProperty("Rgba with 3 values and 2 commas.", "c rgba(255, 0, 0)"); 32 39 33 40 heading("Transform parameter tests."); … … 63 70 testInvalidParametersProperty("Invalid value unit 'deg' in array.", "a array(1deg)"); 64 71 testInvalidParametersProperty("Invalid value unit 'px' in array after valid values.", "a array(1, 2, 3, 4px)"); 72 73 heading("Mixing parameter types."); 74 testInvalidParametersProperty("Number parameter with hex color.", "n1 1 2 #FF0000"); 75 testInvalidParametersProperty("Number parameter with color keyword.", "n1 1 2 red"); 76 testInvalidParametersProperty("Number parameter with rgb color.", "n1 1 2 rgb(255, 0, 0)"); 77 testInvalidParametersProperty("Color with number parameter.", "a rgb(255, 0, 0) 1"); 78 testInvalidParametersProperty("Color in array.", "a array(0, rgb(255, 0, 0))"); 79 testInvalidParametersProperty("Color and array.", "a array(0, 0) rgb(255, 0, 0)"); 80 testInvalidParametersProperty("Color with transform values.", "a rotate(45deg) rgb(255, 0, 0)"); 81 testInvalidParametersProperty("Color with transform values.", "a rgb(255, 0, 0) rotate(45deg)"); 82 -
trunk/LayoutTests/css3/filters/custom-with-at-rule-syntax/script-tests/parsing-parameters-property-valid.js
r148227 r148802 87 87 ["a1 array(1, -2.2, 3.14, 0.4, 5)", "a2 array(1, 2, 3)"]); 88 88 89 heading("Color parameter tests."); 90 testParametersProperty("Hex color.", 91 "c #00FF00", 92 "c rgb(0, 255, 0)", 93 ["c rgb(0, 255, 0)"]); 94 testParametersProperty("Color keyword.", 95 "c green", 96 "c rgb(0, 128, 0)", 97 ["c rgb(0, 128, 0)"]); 98 testParametersProperty("Color rgb function.", 99 "c rgb(0, 128, 0)", 100 "c rgb(0, 128, 0)", 101 ["c rgb(0, 128, 0)"]); 102 testParametersProperty("Color hsl function.", 103 "c hsl(120, 100%, 50%)", 104 "c rgb(0, 255, 0)", 105 ["c rgb(0, 255, 0)"]); 106 testParametersProperty("Color rgba function.", 107 "c rgba(0, 255, 0, 0.2)", 108 "c rgba(0, 255, 0, 0.2)", 109 ["c rgba(0, 255, 0, 0.2)"]); 110 testParametersProperty("Color hsla function.", 111 "c hsla(120, 100%, 50%, 0.2)", 112 "c rgba(0, 255, 0, 0.2)", 113 ["c rgba(0, 255, 0, 0.2)"]); 114 89 115 heading("Combined parameter tests."); 90 testParametersProperty("Number parameter, transform parameter,and array parameter.",91 "n 1, t rotate(0deg), a array(1)",92 "n 1, t rotate(0deg), a array(1)",93 ["n 1", " t rotate(0deg)", "a array(1)"]);116 testParametersProperty("Number parameter, color parameter, transform parameter and array parameter.", 117 "n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1)", 118 "n 1, c rgb(0, 128, 0), t rotate(0deg), a array(1)", 119 ["n 1", "c rgb(0, 128, 0)", "t rotate(0deg)", "a array(1)"]); -
trunk/Source/WebCore/ChangeLog
r148791 r148802 1 2013-04-20 Dirk Schulze <krit@webkit.org> 2 3 [Part 5] Parse color value for custom() function parameters 4 https://bugs.webkit.org/show_bug.cgi?id=114902 5 6 Reviewed by Dean Jackson. 7 8 Custom filter parameters should support color values. Added parsing 9 and style resolving bits to support color values. A later patch will 10 add the color values to the shader program. 11 12 https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html#custom-filter-parameters 13 14 Modified existing tests to cover changes. 15 16 * GNUmakefile.list.am: Added CustomFilterColorParameter to support color values 17 as custom filter parameters. 18 * Target.pri: 19 * WebCore.vcproj/WebCore.vcproj: 20 * WebCore.vcxproj/WebCore.vcxproj: 21 * WebCore.vcxproj/WebCore.vcxproj.filters: 22 * WebCore.xcodeproj/project.pbxproj: 23 * css/CSSComputedStyleDeclaration.cpp: 24 (WebCore::valueForCustomFilterColorParameter): 25 (WebCore): 26 (WebCore::valueForCustomFilterParameter): 27 * css/CSSParser.cpp: 28 (WebCore::CSSParser::parseCustomFilterParameters): 29 * css/StyleResolver.cpp: 30 (WebCore::StyleResolver::parseCustomFilterColorParameter): 31 (WebCore): 32 (WebCore::StyleResolver::parseCustomFilterParameter): 33 * css/StyleResolver.h: 34 (StyleResolver): 35 * platform/graphics/filters/CustomFilterColorParameter.h: Added. 36 (WebCore): 37 (WebCore::blendFunc): 38 (CustomFilterColorParameter): 39 (WebCore::CustomFilterColorParameter::create): 40 (WebCore::CustomFilterColorParameter::blend): 41 (WebCore::CustomFilterColorParameter::color): 42 (WebCore::CustomFilterColorParameter::setColor): 43 (WebCore::CustomFilterColorParameter::operator==): 44 (WebCore::CustomFilterColorParameter::CustomFilterColorParameter): 45 (WebCore::CustomFilterColorParameter::~CustomFilterColorParameter): 46 * platform/graphics/filters/CustomFilterParameter.h: 47 (CustomFilterParameter): 48 * platform/graphics/filters/CustomFilterRenderer.cpp: 49 (WebCore::CustomFilterRenderer::bindProgramParameters): 50 1 51 2013-04-20 Glenn Adams <glenn@skynav.com> 2 52 -
trunk/Source/WebCore/GNUmakefile.list.am
r148785 r148802 5565 5565 Source/WebCore/platform/graphics/cairo/TransformationMatrixCairo.cpp \ 5566 5566 Source/WebCore/platform/graphics/filters/CustomFilterArrayParameter.h \ 5567 Source/WebCore/platform/graphics/filters/CustomFilterColorParameter.h \ 5567 5568 Source/WebCore/platform/graphics/filters/CustomFilterConstants.h \ 5568 5569 Source/WebCore/platform/graphics/filters/CustomFilterGlobalContext.cpp \ -
trunk/Source/WebCore/Target.pri
r148785 r148802 2189 2189 platform/graphics/filters/texmap/TextureMapperPlatformCompiledProgram.h \ 2190 2190 platform/graphics/filters/CustomFilterArrayParameter.h \ 2191 platform/graphics/filters/CustomFilterColorParameter.h \ 2191 2192 platform/graphics/filters/CustomFilterConstants.h \ 2192 2193 platform/graphics/filters/CustomFilterGlobalContext.h \ -
trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj
r148785 r148802 32434 32434 </File> 32435 32435 <File 32436 RelativePath="..\platform\graphics\filters\CustomFilterColorParameter.h" 32437 > 32438 </File> 32439 <File 32436 32440 RelativePath="..\platform\graphics\filters\CustomFilterCompiledProgram.cpp" 32437 32441 > -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r148753 r148802 11827 11827 <ClInclude Include="..\platform\graphics\transforms\TranslateTransformOperation.h" /> 11828 11828 <ClInclude Include="..\platform\graphics\filters\CustomFilterArrayParameter.h" /> 11829 <ClInclude Include="..\platform\graphics\filters\CustomFilterColorParameter.h" /> 11829 11830 <ClInclude Include="..\platform\graphics\filters\CustomFilterCompiledProgram.h" /> 11830 11831 <ClInclude Include="..\platform\graphics\filters\CustomFilterConstants.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r148753 r148802 9820 9820 <Filter>platform\graphics\filters</Filter> 9821 9821 </ClInclude> 9822 <ClInclude Include="..\platform\graphics\filters\CustomFilterColorParameter.h"> 9823 <Filter>platform\graphics\filters</Filter> 9824 </ClInclude> 9822 9825 <ClInclude Include="..\platform\graphics\filters\CustomFilterCompiledProgram.h"> 9823 9826 <Filter>platform\graphics\filters</Filter> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r148785 r148802 12618 12618 FABE72FB1059C21100D999DD /* MathMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLElementFactory.cpp; sourceTree = "<group>"; }; 12619 12619 FABE72FC1059C21100D999DD /* MathMLNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MathMLNames.cpp; sourceTree = "<group>"; }; 12620 FB1A66D917225A6600BAA7AF /* CustomFilterColorParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CustomFilterColorParameter.h; path = filters/CustomFilterColorParameter.h; sourceTree = "<group>"; }; 12620 12621 FB2C15C2165D64900039C9F8 /* CachedSVGDocumentReference.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocumentReference.h; sourceTree = "<group>"; }; 12621 12622 FB3056C1169E5DAC0096A232 /* CSSGroupingRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGroupingRule.h; sourceTree = "<group>"; }; … … 16630 16631 children = ( 16631 16632 15B3FC1715FB217800A81BCB /* CustomFilterArrayParameter.h */, 16633 FB1A66D917225A6600BAA7AF /* CustomFilterColorParameter.h */, 16632 16634 50D4060F147D49DE00D30BB5 /* CustomFilterCompiledProgram.cpp */, 16633 16635 50D40610147D49DE00D30BB5 /* CustomFilterCompiledProgram.h */, -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r148414 r148802 73 73 #if ENABLE(CSS_SHADERS) 74 74 #include "CustomFilterArrayParameter.h" 75 #include "CustomFilterColorParameter.h" 75 76 #include "CustomFilterNumberParameter.h" 76 77 #include "CustomFilterOperation.h" … … 840 841 } 841 842 843 static PassRefPtr<CSSValue> valueForCustomFilterColorParameter(const CustomFilterColorParameter* colorParameter) 844 { 845 RefPtr<CSSValueList> colorParameterValue = CSSValueList::createSpaceSeparated(); 846 colorParameterValue->append(cssValuePool().createColorValue(colorParameter->color().rgb())); 847 return colorParameterValue.release(); 848 } 849 842 850 static PassRefPtr<CSSValue> valueForCustomFilterNumberParameter(const CustomFilterNumberParameter* numberParameter) 843 851 { … … 864 872 case CustomFilterParameter::ARRAY: 865 873 return valueForCustomFilterArrayParameter(static_cast<const CustomFilterArrayParameter*>(parameter)); 874 case CustomFilterParameter::COLOR: 875 return valueForCustomFilterColorParameter(static_cast<const CustomFilterColorParameter*>(parameter)); 866 876 case CustomFilterParameter::NUMBER: 867 877 return valueForCustomFilterNumberParameter(static_cast<const CustomFilterNumberParameter*>(parameter)); -
trunk/Source/WebCore/css/CSSParser.cpp
r148414 r148802 8561 8561 } else 8562 8562 parameterValue = parseCustomFilterTransform(argsList); 8563 } else {8563 } else if (validUnit(arg, FNumber, CSSStrictMode)) { 8564 8564 RefPtr<CSSValueList> paramValueList = CSSValueList::createSpaceSeparated(); 8565 arg = argsList->current();8566 8565 while (arg) { 8567 8566 // If we hit a comma, it means that we finished this parameter's values. … … 8576 8575 return 0; 8577 8576 parameterValue = paramValueList.release(); 8577 } 8578 if (!parameterValue && arg) { 8579 // All parameter values need to be CSSValueLists. 8580 RefPtr<CSSValueList> paramValueList = CSSValueList::createSpaceSeparated(); 8581 RefPtr<CSSPrimitiveValue> colorValue = parseColor(arg); 8582 if (!colorValue) 8583 return 0; 8584 paramValueList->append(colorValue.release()); 8585 parameterValue = paramValueList.release(); 8586 arg = argsList->next(); 8578 8587 } 8579 8588 -
trunk/Source/WebCore/css/StyleResolver.cpp
r148753 r148802 155 155 #if ENABLE(CSS_SHADERS) 156 156 #include "CustomFilterArrayParameter.h" 157 #include "CustomFilterColorParameter.h" 157 158 #include "CustomFilterConstants.h" 158 159 #include "CustomFilterNumberParameter.h" … … 3694 3695 } 3695 3696 3697 PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterColorParameter(const String& name, CSSValueList* values) 3698 { 3699 ASSERT(values->length()); 3700 CSSPrimitiveValue* firstPrimitiveValue = static_cast<CSSPrimitiveValue*>(values->itemWithoutBoundsCheck(0)); 3701 RefPtr<CustomFilterColorParameter> colorParameter = CustomFilterColorParameter::create(name); 3702 colorParameter->setColor(Color(firstPrimitiveValue->getRGBA32Value())); 3703 return colorParameter.release(); 3704 } 3705 3696 3706 PassRefPtr<CustomFilterParameter> StyleResolver::parseCustomFilterNumberParameter(const String& name, CSSValueList* values) 3697 3707 { … … 3721 3731 { 3722 3732 // FIXME: Implement other parameters types parsing. 3723 // booleans: https://bugs.webkit.org/show_bug.cgi?id=764383724 3733 // textures: https://bugs.webkit.org/show_bug.cgi?id=71442 3725 3734 // mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444 … … 3743 3752 return parseCustomFilterTransformParameter(name, values); 3744 3753 3745 // We can have only arrays of booleans or numbers, so use the first value to choose between those two.3754 // We can only have arrays of colors or numbers, so use the first value to choose between those two. 3746 3755 // We need up to 4 values (all booleans or all numbers). 3747 3756 if (!values->itemWithoutBoundsCheck(0)->isPrimitiveValue() || values->length() > 4) … … 3752 3761 return parseCustomFilterNumberParameter(name, values); 3753 3762 3754 // FIXME: Implement the boolean array parameter here.3755 // https://bugs.webkit.org/show_bug.cgi?id=764383763 if (firstPrimitiveValue->primitiveType() == CSSPrimitiveValue::CSS_RGBCOLOR) 3764 return parseCustomFilterColorParameter(name, values); 3756 3765 3757 3766 return 0; -
trunk/Source/WebCore/css/StyleResolver.h
r148753 r148802 316 316 PassRefPtr<CustomFilterParameter> parseCustomFilterParameter(const String& name, CSSValue*); 317 317 PassRefPtr<CustomFilterParameter> parseCustomFilterArrayParameter(const String& name, CSSValueList*); 318 PassRefPtr<CustomFilterParameter> parseCustomFilterColorParameter(const String& name, CSSValueList*); 318 319 PassRefPtr<CustomFilterParameter> parseCustomFilterNumberParameter(const String& name, CSSValueList*); 319 320 PassRefPtr<CustomFilterParameter> parseCustomFilterTransformParameter(const String& name, CSSValueList*); -
trunk/Source/WebCore/platform/graphics/filters/CustomFilterParameter.h
r128626 r148802 41 41 public: 42 42 // FIXME: Implement other parameters types: 43 // booleans: https://bugs.webkit.org/show_bug.cgi?id=7643844 43 // textures: https://bugs.webkit.org/show_bug.cgi?id=71442 45 // 3d-transforms: https://bugs.webkit.org/show_bug.cgi?id=7144346 44 // mat2, mat3, mat4: https://bugs.webkit.org/show_bug.cgi?id=71444 47 45 enum ParameterType { 48 46 ARRAY, 47 COLOR, 49 48 NUMBER, 50 49 TRANSFORM -
trunk/Source/WebCore/platform/graphics/filters/CustomFilterRenderer.cpp
r137754 r148802 216 216 bindProgramArrayParameters(uniformLocation, static_cast<CustomFilterArrayParameter*>(parameter)); 217 217 break; 218 case CustomFilterParameter::COLOR: 219 // FIXME: Bind color to context. 220 break; 218 221 case CustomFilterParameter::NUMBER: 219 222 bindProgramNumberParameters(uniformLocation, static_cast<CustomFilterNumberParameter*>(parameter));
Note: See TracChangeset
for help on using the changeset viewer.