mask-computed.html (5059B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Masking Module Level 1: getComputedStyle().mask</title> 6 <link rel="help" href="https://www.w3.org/TR/css-masking-1/#the-mask"> 7 <meta name="assert" content="mask computed value is as specified."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/support/computed-testcommon.js"></script> 11 </head> 12 <body> 13 <div id="target" style="display:none"></div> 14 <script> 15 // value: <mask-layer># 16 // <mask-layer> = 17 // <mask-reference> || 18 // <position> [ / <bg-size> ]? || 19 // <repeat-style> || 20 // <geometry-box> || 21 // [ <geometry-box> | no-clip ] || 22 // <compositing-operator> || 23 // <masking-mode> 24 25 // <mask-reference> = none | <image> | <mask-source> 26 test_computed_value('mask', 'none'); 27 test_computed_value('mask', 28 'linear-gradient(to left bottom, red, blue)', 29 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255))'); 30 test_computed_value('mask', 31 'linear-gradient(to left bottom, red, blue) luminance', 32 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255)) luminance'); 33 test_computed_value('mask', 34 'linear-gradient(calc(90deg - 45deg), rgb(0, 128, 0), rgb(0, 0, 255)', 35 'linear-gradient(45deg, rgb(0, 128, 0), rgb(0, 0, 255))'); 36 test_computed_value('mask', 37 'radial-gradient(circle calc(-0.5em + 10px) at calc(-1em + 10px) calc(-2em + 10px), rgb(255, 0, 0), rgb(0, 0, 255))', 38 'radial-gradient(2px at -6px -22px, rgb(255, 0, 0), rgb(0, 0, 255))'); 39 test_computed_value('mask', 40 'radial-gradient(ellipse calc(-0.5em + 10px) calc(0.5em + 10px) at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))', 41 'radial-gradient(2px 18px at 20px 30px, rgb(255, 0, 0), rgb(0, 0, 255))'); 42 test_computed_value('mask', 43 'conic-gradient(gold calc(100% / 2), #f06 calc(360deg * 4 / 5))', 44 'conic-gradient(rgb(255, 215, 0) 50%, rgb(255, 0, 102) 288deg)'); 45 test_computed_value('mask', 46 'conic-gradient(black 1turn, white', 47 'conic-gradient(rgb(0, 0, 0) 360deg, rgb(255, 255, 255))'); 48 test_computed_value('mask', 'url("https://example.com/")'); 49 50 // <position> [ / <bg-size> ]? 51 test_computed_value('mask', 52 'linear-gradient(to left bottom, red, blue) 1px 2px', 53 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255)) 1px 2px'); 54 test_computed_value('mask', 'url("https://example.com/") 1px 2px / contain'); 55 56 // <repeat-style> = repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2} 57 test_computed_value('mask', 'repeat-y'); 58 59 // <geometry-box> = <shape-box> | fill-box | stroke-box | view-box 60 // <shape-box> = <box> 61 // <box> = border-box | padding-box | content-box 62 test_computed_value('mask', 'border-box', 'none'); 63 test_computed_value('mask', 64 'linear-gradient(to left bottom, red, blue) padding-box', 65 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255)) padding-box'); 66 test_computed_value('mask', 'content-box'); 67 test_computed_value('mask', 'url("https://example.com/") fill-box'); 68 test_computed_value('mask', 69 'linear-gradient(to left bottom, red, blue) stroke-box', 70 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255)) stroke-box'); 71 test_computed_value('mask', 'view-box'); 72 73 // [ <geometry-box> | no-clip ] 74 test_computed_value('mask', 'no-clip'); 75 76 // <compositing-operator> = add | subtract | intersect | exclude 77 test_computed_value('mask', 78 'url("https://example.com/") add', 79 'url("https://example.com/")'); 80 test_computed_value('mask', 'subtract'); 81 test_computed_value('mask', 'url("https://example.com/") intersect'); 82 test_computed_value('mask', 83 'linear-gradient(to left bottom, red, blue) exclude', 84 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255)) exclude'); 85 86 // <masking-mode> = alpha | luminance | auto 87 test_computed_value('mask', 'alpha'); 88 test_computed_value('mask', 'url("https://example.com/") alpha'); 89 90 // Test the combination of mask-origin and mask-clip. 91 test_computed_value('mask', 'border-box border-box', 'none'); 92 test_computed_value('mask', 'content-box content-box', 'content-box'); 93 test_computed_value('mask', 'border-box content-box', 'border-box content-box'); 94 test_computed_value('mask', 'border-box no-clip', 'no-clip'); 95 96 // <mask-layer> = <mask-reference> || <position> [ / <bg-size> ]? || <repeat-style> || 97 // <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> || <masking-mode> 98 test_computed_value('mask', 99 'intersect no-clip space round 1px 2px / contain stroke-box linear-gradient(to left bottom, red, blue) luminance', 100 'linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255)) 1px 2px / contain space round stroke-box no-clip intersect luminance'); 101 test_computed_value('mask', 102 'intersect no-clip space round 1px 2px / contain view-box, stroke-box linear-gradient(to left bottom, red, blue) luminance', 103 '1px 2px / contain space round view-box no-clip intersect, linear-gradient(to left bottom, rgb(255, 0, 0), rgb(0, 0, 255)) stroke-box luminance'); 104 105 test_computed_value('mask', 'none alpha', 'alpha'); 106 107 </script> 108 </body> 109 </html>