mask-valid.sub.html (4700B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Masking Module Level 1: parsing mask with valid values</title> 6 <link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-mask"> 7 <meta name="assert" content="mask supports the full '<mask-layer>#' grammar."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/support/parsing-testcommon.js"></script> 11 <script src="/css/support/shorthand-testcommon.js"></script> 12 </head> 13 <body> 14 <script> 15 // <mask-layer> = <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || 16 // <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode> 17 18 // <mask-reference> = none | <image> | <mask-source> 19 test_valid_value('mask', 'none'); 20 test_valid_value('mask', 'linear-gradient(to left bottom, red, blue)'); 21 test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) luminance'); 22 test_valid_value('mask', 'url("https://{{host}}/")'); 23 24 // <position> [ / <bg-size> ]? 25 test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) 1px 2px'); 26 test_valid_value('mask', 'url("https://{{host}}/") 1px 2px / contain'); 27 28 // <repeat-style> = repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2} 29 test_valid_value('mask', 'repeat-y'); 30 31 // <geometry-box> = <shape-box> | fill-box | stroke-box | view-box 32 // <shape-box> = <box> 33 // <box> = border-box | padding-box | content-box 34 test_valid_value('mask', 'border-box', 'none'); 35 test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) padding-box'); 36 test_valid_value('mask', 'content-box'); 37 test_valid_value('mask', 'url("https://{{host}}/") fill-box'); 38 test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) stroke-box'); 39 test_valid_value('mask', 'view-box'); 40 41 // [ <geometry-box> | no-clip ] 42 test_valid_value('mask', 'no-clip'); 43 44 // <compositing-operator> = add | subtract | intersect | exclude 45 test_valid_value('mask', 'url("https://{{host}}/") add', 'url("https://{{host}}/")'); 46 test_valid_value('mask', 'subtract'); 47 test_valid_value('mask', 'url("https://{{host}}/") intersect'); 48 test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) exclude'); 49 50 // <masking-mode> = alpha | luminance | auto 51 test_valid_value('mask', 'alpha'); 52 test_valid_value('mask', 'url("https://{{host}}/") alpha'); 53 54 // Test the combination of mask-origin and mask-clip. 55 test_valid_value('mask', 'border-box border-box', 'none'); 56 test_valid_value('mask', 'content-box content-box', 'content-box'); 57 test_valid_value('mask', 'border-box content-box', 'border-box content-box'); 58 test_valid_value('mask', 'border-box no-clip', 'no-clip'); 59 60 // <mask-layer> = <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || 61 // <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode> 62 test_valid_value('mask', 63 'intersect no-clip space round 1px 2px / contain stroke-box linear-gradient(to left bottom, red, blue) luminance', 64 'linear-gradient(to left bottom, red, blue) 1px 2px / contain space round stroke-box no-clip intersect luminance'); 65 test_valid_value('mask', 66 'intersect no-clip space round 1px 2px / contain view-box, stroke-box linear-gradient(to left bottom, red, blue) luminance', 67 '1px 2px / contain space round view-box no-clip intersect, linear-gradient(to left bottom, red, blue) stroke-box luminance'); 68 69 // Earlier versions of the mask shorthand always required a <mask-reference>. 70 // To avoid unnecessarily losing test coverage, keep one of the test cases from back then. 71 test_valid_value('mask', 'none alpha', 'alpha'); 72 73 test_shorthand_value('mask', 'none', { 74 'mask-image': 'none', 75 'mask-position': '0% 0%', 76 'mask-size': 'auto', 77 'mask-repeat': 'repeat', 78 'mask-origin': 'border-box', 79 'mask-clip': 'border-box', 80 'mask-composite': 'add', 81 'mask-mode': 'match-source', 82 'mask-border-source': 'none', 83 'mask-border-outset': '0', 84 'mask-border-repeat': 'stretch', 85 'mask-border-slice': '0', 86 'mask-border-width': 'auto' 87 }) 88 test_shorthand_value('mask', 'none, linear-gradient(to left bottom, red, blue) padding-box', { 89 'mask-image': 'none, linear-gradient(to left bottom, red, blue)', 90 'mask-position': '0% 0%, 0% 0%', 91 'mask-size': 'auto, auto', 92 'mask-repeat': 'repeat, repeat', 93 'mask-origin': 'border-box, padding-box', 94 'mask-clip': 'border-box, padding-box', 95 'mask-composite': 'add, add', 96 'mask-mode': 'match-source, match-source', 97 'mask-border-source': 'none', 98 'mask-border-outset': '0', 99 'mask-border-repeat': 'stretch', 100 'mask-border-slice': '0', 101 'mask-border-width': 'auto' 102 }) 103 104 </script> 105 </body> 106 </html>