|
| 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 | +</head> |
| 12 | +<body> |
| 13 | +<script> |
| 14 | +// <mask-layer> = <mask-reference> <masking-mode>? || <position> [ / <bg-size> ]? || |
| 15 | +// <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> |
| 16 | + |
| 17 | +// <mask-reference> <masking-mode>? |
| 18 | +// <mask-reference> = none | <image> | <mask-source> |
| 19 | +// <masking-mode> = alpha | luminance | auto |
| 20 | +test_valid_value('mask', 'none'); |
| 21 | +test_valid_value('mask', 'none alpha'); |
| 22 | +test_valid_value('mask', 'linear-gradient(to left bottom, red, blue)'); |
| 23 | +test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) luminance'); |
| 24 | +test_valid_value('mask', 'url("https://{{host}}/")'); |
| 25 | +test_valid_value('mask', 'url("https://{{host}}/") alpha'); |
| 26 | + |
| 27 | +// <position> [ / <bg-size> ]? |
| 28 | +test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) 1px 2px'); |
| 29 | +test_valid_value('mask', 'url("https://{{host}}/") 1px 2px / contain'); |
| 30 | + |
| 31 | +// <repeat-style> = repeat-x | repeat-y | [repeat | space | round | no-repeat]{1,2} |
| 32 | +test_valid_value('mask', 'none repeat-y'); |
| 33 | + |
| 34 | +// <geometry-box> = <shape-box> | fill-box | stroke-box | view-box |
| 35 | +// <shape-box> = <box> | margin-box |
| 36 | +// <box> = border-box | padding-box | content-box |
| 37 | +test_valid_value('mask', 'none border-box', 'none'); |
| 38 | +test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) padding-box'); |
| 39 | +test_valid_value('mask', 'none content-box'); |
| 40 | +test_valid_value('mask', 'none margin-box'); |
| 41 | +test_valid_value('mask', 'url("https://{{host}}/") fill-box'); |
| 42 | +test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) stroke-box'); |
| 43 | +test_valid_value('mask', 'none view-box'); |
| 44 | + |
| 45 | +// [ <geometry-box> | no-clip ] |
| 46 | +test_valid_value('mask', 'none no-clip', 'none border-box no-clip'); |
| 47 | + |
| 48 | +// <compositing-operator> = add | subtract | intersect | exclude |
| 49 | +test_valid_value('mask', 'url("https://{{host}}/") add', 'url("https://{{host}}/")'); |
| 50 | +test_valid_value('mask', 'none subtract'); |
| 51 | +test_valid_value('mask', 'url("https://{{host}}/") intersect'); |
| 52 | +test_valid_value('mask', 'linear-gradient(to left bottom, red, blue) exclude'); |
| 53 | + |
| 54 | + |
| 55 | +// <mask-layer> = <mask-reference> <masking-mode>? || <position> [ / <bg-size> ]? || |
| 56 | +// <repeat-style> || <geometry-box> || [ <geometry-box> | no-clip ] || <compositing-operator> |
| 57 | +test_valid_value('mask', 'intersect no-clip space round 1px 2px / contain stroke-box linear-gradient(to left bottom, red, blue) luminance', 'linear-gradient(to left bottom, red, blue) luminance 1px 2px / contain space round stroke-box no-clip intersect'); |
| 58 | + |
| 59 | +test_valid_value('mask', 'intersect no-clip space round 1px 2px / contain view-box, stroke-box linear-gradient(to left bottom, red, blue) luminance', 'none 1px 2px / contain space round view-box no-clip intersect, linear-gradient(to left bottom, red, blue) luminance stroke-box'); |
| 60 | +</script> |
| 61 | +</body> |
| 62 | +</html> |
0 commit comments