diff options
Diffstat (limited to 'testing/web-platform/tests/css/compositing')
148 files changed, 8989 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_filter-ref.html b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_filter-ref.html new file mode 100644 index 0000000000..ad512028ad --- /dev/null +++ b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_filter-ref.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html> +<head> + <title>mix-blend-mode with isolated groups API Test: Blending in a group with filter</title> + <link rel="author" title="windtale" href="mailto:windtale@163.com"> + <link rel="help" href="http://www.w3.org/TR/compositing-1/"> + <link rel="help" href=""> + <meta name="flags" content="dom"> + <meta name="assert" content="Blending in a group with filter"> + <style type="text/css"> + #svgMain { + top: 100px; + left: 100px; + width: 200px; + height: 200px; + background: blue; + } + </style> + +</head> +<body> + +<svg id="svgMain"> + <rect id="redSquare" width="100" height="100" fill="red"></rect> +</svg> + +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_filter.html b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_filter.html new file mode 100644 index 0000000000..77c0903002 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_filter.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> + <title>mix-blend-mode with isolated groups API Test: Blending in a group with filter</title> + <link rel="author" title="windtale" href="mailto:windtale@163.com"> + <link rel="help" href="http://www.w3.org/TR/compositing-1/#mix-blend-mode"> + <meta name="flags" content="svg"> + <meta name="assert" content="Blending in a group with filter"> + <style type="text/css"> + #redSquare { + mix-blend-mode: lighten; + } + #svgMain { + top: 100px; + left: 100px; + width: 200px; + height: 200px; + background: blue; + } + #group{ + filter: alpha(opacity=50,finishopacity=50,style=2); + } + </style> + +</head> +<body> + +<svg id="svgMain"> + <g id="group"> + <rect id="redSquare" width="100" height="100" fill="red"></rect> + </g> +</svg> + +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_opacity-ref.html b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_opacity-ref.html new file mode 100644 index 0000000000..6f22489948 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_opacity-ref.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> + <link rel="author" title="windtale" href="mailto:windtale@163.com"> + <style type="text/css"> + #svgMain { + top: 100px; + left: 100px; + width: 200px; + height: 200px; + background: blue; + } + </style> + +</head> +<body> + +<svg id="svgMain"> + <rect id="redSquare" width="100" height="100" fill="red" opacity=".59"></rect> +</svg> + +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_opacity.html b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_opacity.html new file mode 100644 index 0000000000..40b1044112 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/Blending_in_a_group_with_opacity.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> + <title>mix-blend-mode with isolated groups API Test: Blending in a group with opacity</title> + <link rel="author" title="windtale" href="mailto:windtale@163.com"> + <link rel="help" href="http://www.w3.org/TR/compositing-1/#mix-blend-mode"> + <meta name="flags" content="svg"> + <meta name="assert" content="Blending in a group with opacity"> + <style type="text/css"> + #greenSquare { + mix-blend-mode: darken; + } + #redSquare { + mix-blend-mode: lighten; + } + #svgMain { + top: 100px; + left: 100px; + width: 200px; + height: 200px; + background: blue; + } + </style> + +</head> +<body> + +<svg id="svgMain"> + <g opacity="0.59"> + <rect id="redSquare" width="100" height="100" fill="red"></rect> + </g> +</svg> + +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/META.yml b/testing/web-platform/tests/css/compositing/META.yml new file mode 100644 index 0000000000..73541d894b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/META.yml @@ -0,0 +1,5 @@ +spec: https://drafts.fxtf.org/compositing/ +suggested_reviewers: + - chrishtr + - plinss + - nikosandronikos diff --git a/testing/web-platform/tests/css/compositing/Text_with_SVG_background-ref.html b/testing/web-platform/tests/css/compositing/Text_with_SVG_background-ref.html new file mode 100644 index 0000000000..7ccc63a555 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/Text_with_SVG_background-ref.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS Reference File</title> + <link rel="author" title="windtale" href="mailto:windtale@163.com"> + <style type="text/css"> + #svgMain { + top: 100px; + left: 100px; + width: 200px; + height: 200px; + background: blue; + } + </style> + +</head> +<body> + +<svg id="svgMain"> + <text id="lblTxt" y="55">Text with SVG background</text> +</svg> + +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/Text_with_SVG_background.html b/testing/web-platform/tests/css/compositing/Text_with_SVG_background.html new file mode 100644 index 0000000000..5ee919ba8c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/Text_with_SVG_background.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> +<head> + <title>mix-blend-mode with simple SVG graphical elements API Test: Text with SVG background</title> + <link rel="author" title="windtale" href="mailto:windtale@163.com"> + <link rel="help" href="http://www.w3.org/TR/compositing-1/#mix-blend-mode"> + <meta name="flags" content="svg"> + <meta name="assert" content="Text with SVG background"> + <style type="text/css"> + #lblTxt { + mix-blend-mode: darken; + } + #svgMain { + top: 100px; + left: 100px; + width: 200px; + height: 200px; + background: blue; + } + </style> + +</head> +<body> + +<svg id="svgMain"> + <text id="lblTxt" y="55">Text with SVG background</text> +</svg> + +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/background-blending/background-blend-mode-gradient-image.html b/testing/web-platform/tests/css/compositing/background-blending/background-blend-mode-gradient-image.html new file mode 100644 index 0000000000..986fcda9ac --- /dev/null +++ b/testing/web-platform/tests/css/compositing/background-blending/background-blend-mode-gradient-image.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between multiple backgrounds (gradient and image) using background-blend-mode</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#background-blend-mode"> + <meta name="assert" content="Test checks that setting background-blend-mode property for an element with two background layers (a gradient and a png image) results in blending between the two layers."> + <link rel="match" href="reference/background-blend-mode-gradient-image-ref.html"> + <style> + div { + margin: 5px; + width: 130px; + height: 130px; + background: url('support/red.png') no-repeat 0 0 /100% 100%, linear-gradient(to right, lime 50%, blue 51%); + /*lime: rgb(0,255,0); + blue: rgb(0,0,255);*/ + display: block; + float: left; + background-blend-mode: multiply, normal; + } + </style> + </head> + <body> + <p>Test passes if there is no red square on the screen. <br> + You should see a black square.</p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/background-blending/background-blend-mode-plus-lighter.html b/testing/web-platform/tests/css/compositing/background-blending/background-blend-mode-plus-lighter.html new file mode 100644 index 0000000000..bb237b38b3 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/background-blending/background-blend-mode-plus-lighter.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<title>background-blend-mode: plus-lighter test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> +<link rel="match" href="reference/background-blend-mode-plus-lighter-ref.html"> +<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-4294967295"> +<style> + .test { + width: 100px; + height: 100px; + background-blend-mode: plus-lighter; + } +</style> +<script type="module"> + import { tests } from '../support/plus-lighter.js'; + import { toCSSColor } from '../support/utils.js'; + + // Create a solid color CSS image. + const colorImage = (pixel) => + `linear-gradient(to right, ${toCSSColor(pixel)}, ${toCSSColor(pixel)})`; + + const createBackgrounds = (colors) => colors + // Backgrounds are top first + .slice().reverse() + .map((color) => colorImage(color)) + .join(', '); + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test" style="background-image: ${createBackgrounds(colors)}"></div> + `); + } +</script> diff --git a/testing/web-platform/tests/css/compositing/background-blending/reference/background-blend-mode-gradient-image-ref.html b/testing/web-platform/tests/css/compositing/background-blending/reference/background-blend-mode-gradient-image-ref.html new file mode 100644 index 0000000000..4389960d78 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/background-blending/reference/background-blend-mode-gradient-image-ref.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <style> + div { + margin: 5px; + width: 130px; + height: 130px; + background: black;/*rgb(0,0,0);*/ + display: block; + float: left; + } + </style> + </head> + <body> + <p>Test passes if there is no red square on the screen. <br> + You should see a black square.</p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html b/testing/web-platform/tests/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html new file mode 100644 index 0000000000..550981986b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/background-blending/reference/background-blend-mode-plus-lighter-ref.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<title>background-blend-mode: plus-lighter test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#background-blend-mode"> +<style> + .test { + width: 100px; + height: 100px; + } +</style> +<script type="module"> + import { tests, plusLighter } from '../../support/plus-lighter.js'; + import { toCSSColor } from '../../support/utils.js'; + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> + `); + } +</script> diff --git a/testing/web-platform/tests/css/compositing/background-blending/support/red.png b/testing/web-platform/tests/css/compositing/background-blending/support/red.png Binary files differnew file mode 100644 index 0000000000..acc86d4770 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/background-blending/support/red.png diff --git a/testing/web-platform/tests/css/compositing/compositing_simple_div-ref.html b/testing/web-platform/tests/css/compositing/compositing_simple_div-ref.html new file mode 100644 index 0000000000..2f46217812 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/compositing_simple_div-ref.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<head> +<title>[simple<div>] blending reference</title> + +<link rel="author" title="Aili Wang" href="mailto:augur521@hotmail.com"> +<link rel="help" href="http://www.w3.org/TR/compositing-1/"> + + + +<style> + #b{background-color:rgb(0,255,0); width:100px;height:100px + } + +</style> +</head> +<body> + +<div id="b"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/compositing_simple_div.html b/testing/web-platform/tests/css/compositing/compositing_simple_div.html new file mode 100644 index 0000000000..44f138b5a6 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/compositing_simple_div.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<head> +<title>[simple<div>] blending</title> + +<link rel="author" title="Aili Wang" href="mailto:augur521@hotmail.com"> +<link rel="help" href="http://www.w3.org/TR/compositing-1/#mix-blend-mode"> +<link rel="match" href="compositing_simple_div-ref.html"> + + +<style> + #b{background-color:rgb(255,0,255); mix-blend-mode:difference; width:100px;height:100px + } + +</style> +</head> +<body> + +<div id="b"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/inheritance.html b/testing/web-platform/tests/css/compositing/inheritance.html new file mode 100644 index 0000000000..8bd08672ed --- /dev/null +++ b/testing/web-platform/tests/css/compositing/inheritance.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Inheritance of Compositing and Blending properties</title> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#property-index"> +<meta name="assert" content="Properties do not inherit."> +<meta name="assert" content="Properties have initial values according to the spec."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/inheritance-testcommon.js"></script> +</head> +<body> +<div id="container"> + <div id="target"></div> +</div> +<script> +assert_not_inherited('background-blend-mode', 'normal', 'multiply'); +assert_not_inherited('isolation', 'auto', 'isolate'); +assert_not_inherited('mix-blend-mode', 'normal', 'overlay'); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/isolation/blend-isolation.html b/testing/web-platform/tests/css/compositing/isolation/blend-isolation.html new file mode 100644 index 0000000000..d1aa412ecf --- /dev/null +++ b/testing/web-platform/tests/css/compositing/isolation/blend-isolation.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS Compositing and Blending: isolation applied to a group containing blending</title> + <link rel="author" title="cabanier" href="mailto:cabanier@adobe.com"> + <link rel="help" href="http://www.w3.org/TR/compositing-1/#isolation"> + <meta name="assert" content="Isolation on a group with blending"> +<style> +.a { + background-color: rgb(0,255,0); +} +#b { + width: 200px; + height: 210px; +} +.c { + width: 100px; + height: 100px; + mix-blend-mode: difference; +} +#d { + isolation: isolate; +} +</style> +<p>Test passes if you see a solid green rectangle</p> +<div id="b" class="a"> + <div id="d"> + <div class="a c"></div> + </div> +</div> +</html> diff --git a/testing/web-platform/tests/css/compositing/line-with-svg-background-ref.html b/testing/web-platform/tests/css/compositing/line-with-svg-background-ref.html new file mode 100644 index 0000000000..0d992bc75a --- /dev/null +++ b/testing/web-platform/tests/css/compositing/line-with-svg-background-ref.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS mix-blend-mode API Test</title> + <link rel="author" title="dmyang" href="mailto:yangdemo@gmail.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"><!-- 11-09-2013 @TestTWF Shenzhen --> + <meta name="flags" content="svg"> + <style type="text/css"> + .svg { + background-color: #888; + width: 500px; + display: block; + height: 60px; + margin: 10px auto; + } + .svg text { + font-size: 25px; + line-height: 50px; + mix-blend-mode: normal; + } + </style> +</head> +<body> + <svg class="svg"> + <line class="multiply" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="screen" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="overlay" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="darken" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="lighten" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="color-dodge" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="hard-light" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="soft-light" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="difference" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="exclusion" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> +</body> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/css/compositing/line-with-svg-background.html b/testing/web-platform/tests/css/compositing/line-with-svg-background.html new file mode 100644 index 0000000000..194096e66c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/line-with-svg-background.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS mix-blend-mode API Test</title> + <link rel="author" title="dmyang" href="mailto:yangdemo@gmail.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"><!-- 11-09-2013 @TestTWF Shenzhen --> + <link rel="help" href="http://www.w3.org/TR/compositing-1/#mix-blend-mode"> + <meta name="flags" content="svg"> + <style type="text/css"> + .svg { + background-color: #888; + width: 500px; + display: block; + height: 60px; + margin: 10px auto; + } + .svg text { + font-size: 25px; + line-height: 50px; + } + .multiply {mix-blend-mode: multiply;} + .screen {mix-blend-mode: screen;} + .overlay {mix-blend-mode: overlay;} + .darken {mix-blend-mode: darken;} + .color-dodge {mix-blend-mode: color-dodge;} + .color-burn {mix-blend-mode: color-burn;} + .hard-light {mix-blend-mode: hard-light;} + .soft-light {mix-blend-mode: soft-light;} + .difference {mix-blend-mode: difference;} + .exclusion {mix-blend-mode: exclusion;} + </style> +</head> +<body> + <svg class="svg"> + <line class="multiply" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="screen" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="overlay" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="darken" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="lighten" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="color-dodge" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="hard-light" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="soft-light" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="difference" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> + <svg class="svg"> + <line class="exclusion" x1="10" y1="30" x2="300" y2="30" style="stroke:blue; stroke-width:20;" /> + </svg> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-animation.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-animation.html new file mode 100644 index 0000000000..55618485d8 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-animation.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with animation</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode and animation blends with the parent element."> + <meta name="fuzzy" content="0-2;0-11000"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-animation-ref.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #FF0; + } + + @keyframes changeOpacity + { + from { opacity: 0.9; } + 50% { opacity: 0.9; } + to { opacity: 0.1; } + } + + #blender { + background: #F00; + mix-blend-mode: difference; + animation: changeOpacity 10s; + } + </style> + </head> + <body> + <p>Test passes if you can see a fading green box after 5 seconds.</p> + <div><div id="blender"></div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-interposed.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-interposed.html new file mode 100644 index 0000000000..768352de02 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-interposed.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode having a child blends with the parent element."> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="match" href="reference/green-square.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + } + .parent { + background: #FF0; + } + .blender { + background: #345; + mix-blend-mode: difference; + } + .child { + background: #F00; + } + </style> + </head> + <body> + <p>Test passes if you can see a green square on the screen.</p> + <div class="parent"> + <div class="blender"> + <div class="child"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-overflow-hidden-and-border-radius.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-overflow-hidden-and-border-radius.html new file mode 100644 index 0000000000..305e0e2e0c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-overflow-hidden-and-border-radius.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element and its child having overflow:hidden and border-radius</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element having mix-blend-mode, overflow:hidden and border-radius blends correctly with its parent element."> + <meta name="fuzzy" content="0-10;0-5"> + <link rel="match" href="reference/mix-blend-mode-blended-element-overflow-hidden-and-border-radius-ref.html"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 150px; + height: 150px; + position: relative; + z-index: 1; + } + .blended { + width: 150px; + height: 150px; + overflow: hidden; + border-radius: 2em 2em; + mix-blend-mode: multiply; + } + .childOfBlended { + background: yellow;/*rgb(255,255,0);*/ + width: 150px; + height: 150px; + } + </style> + </head> + <body> + <p>The test passes if you see a lime rectangle with aqua rounded corners.</p> + <div class="parent"> + <div class="blended"> + <div class="childOfBlended"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-overflow-scroll.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-overflow-scroll.html new file mode 100644 index 0000000000..8952b39452 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-overflow-scroll.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element and its child having overflow:scroll</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode and overflow:scroll blends with its parent element"> + <link rel="match" href="reference/mix-blend-mode-blended-element-overflow-scroll-ref.html"> + <style type="text/css"> + .parent { + background: yellow;/*rgb(0,255,255);*/ + width: 100px; + height: 100px; + position: relative; + z-index: 1; + overflow: hidden; + } + .blended { + background: red;/*rgb(255,0,0);*/ + width: 150px; + height: 150px; + overflow:scroll; + mix-blend-mode: difference; + } + .scrollingContent { + width: 200px; + height: 200px; + } + </style> + </head> + <body> + <p>Test passes if you see a lime rectangle.</p> + <div class="parent"> + <div class="blended"> + <div class="scrollingContent"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-with-transparent-pixels.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-with-transparent-pixels.html new file mode 100644 index 0000000000..6fd3a8bad7 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-element-with-transparent-pixels.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element with transparent pixels and a child element</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that blending is performed with a parent + that creates a stacking context, but not with any of its underlying content. + The element, including its children, must blend with the parent as a whole."> + <link rel="match" href="reference/mix-blend-mode-blended-element-with-transparent-pixels-ref.html"> + <style type="text/css"> + .parent { + position: absolute; + z-index: 1; + background: #00F; + width: 100px; + height: 100px; + margin: 10px; + } + .blender { + width: 120px; + height: 120px; + background: transparent; + mix-blend-mode: difference; + margin: -10px; + } + .blendedChild { + width: 120px; + height: 120px; + background: #0FF; + } + </style> + </head> + <body> + <p>Test passes if you can see a lime square with aqua borders.<br> + If the borders are red, the test fails.</p> + <div class="parent"> + <div class="blender"> + <div class="blendedChild"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-with-3D-transform.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-with-3D-transform.html new file mode 100644 index 0000000000..1739e01382 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-with-3D-transform.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode between an element and its child with 3D transform </title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that the element with mix-blend-mode and 3D transform blends correctly with its parent"> + <meta name="fuzzy" content="0-255;0-350"> + <link rel="match" href="reference/mix-blend-mode-blended-with-3D-transform-ref.html"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + position:relative; + z-index: 1; + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + transform:rotateX(20deg); + mix-blend-mode: difference; + } + </style> + </head> + <body> + <p>You should see a fuchsia square overlapping an aqua square. <br> + The overlapping area should be yellow. </p> + <div class="parent"> + <div class="blended"> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-with-transform-and-perspective.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-with-transform-and-perspective.html new file mode 100644 index 0000000000..46189afc58 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blended-with-transform-and-perspective.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element and its child having mix-blend-mode and perspective</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element having mix-blend-mode and perspective blends correctly with its parent"> + <link rel="match" href="reference/mix-blend-mode-blended-with-transform-and-perspective-ref.html"> + <style type="text/css"> + div { + height: 150px; + width: 150px; + } + .container { + position: relative; + z-index: 1; + background-color: lime;/*rgb(0,255,0);*/ + } + .transformed { + transform: perspective(600px) translateZ(-200px); + background-color: red;/*rgb(255,0,0);*/ + mix-blend-mode: difference; + } + </style> + </head> + <body> + <p>You should see a yellow square inside a green container.</p> + <div class="container"> + <div class="transformed"> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blending-with-sibling.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blending-with-sibling.html new file mode 100644 index 0000000000..80f197c40b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-blending-with-sibling.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode between an element and its sibling</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode blends with a sibling element"> + <link rel="match" href="reference/green-square.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + } + .container { + position: fixed; + z-index: 0; + background: #FFF; + } + .blender { + background: #FF0; + mix-blend-mode: difference; + } + .sibling { + margin-top: -100px; + background: #F00; + } + </style> + </head> + <body> + <p>Test passes if you can see a green square on the screen.</p> + <div class="container"> + <div class="blender"></div> + <div class="sibling"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-border-image.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-border-image.html new file mode 100644 index 0000000000..7309e37372 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-border-image.html @@ -0,0 +1,36 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with border image</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks if mix-blend-mode is applied for an element with border-image."> + <meta name="flags" content="svg"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-border-image-ref.html"> + <style type="text/css"> + .parent { + width: 120px; + height: 120px; + background: #FF0; + position: fixed; + z-index: 1; + } + + .child { + width: 100px; + height: 100px; + background: #F00; + mix-blend-mode: difference; + border-width: 10px; + border-image: url('support/red_square.svg') 10 repeat; + } + </style> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the div is displayed with red. </p> + <div class="parent"><div class="child"></div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-both-parent-and-blended-with-3D-transform.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-both-parent-and-blended-with-3D-transform.html new file mode 100644 index 0000000000..59fca74f84 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-both-parent-and-blended-with-3D-transform.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode between an element and its child (both with 3D transform) </title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that the element with mix-blend-mode blends with the parent element (both with 3D transform)"> + <meta name="fuzzy" content="0-128;0-1000"> + <link rel="match" href="reference/mix-blend-mode-both-parent-and-blended-with-3D-transform-ref.html"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + transform:rotateX(20deg); + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + transform:rotateX(20deg); + mix-blend-mode: difference; + } + p { + will-change: transform; + } + </style> + </head> + <body> + <p>You should see a fuchsia square overlapping an aqua square. <br> + The overlapping area should be yellow. </p> + <div class="parent"> + <div class="blended"> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-canvas-parent.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-canvas-parent.html new file mode 100644 index 0000000000..5107207e36 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-canvas-parent.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Canvas with mix-blend-mode blends with the parent element.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that a canvas element having mix-blend-mode applied blends with the content of the parent element."> + <meta name="flags" content="dom"/> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-canvas-parent-ref.html"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + <div style="width: 100px; height: 100px; background: #FF0;"> + <canvas id="cvs" width="100" height="100" style="mix-blend-mode: difference;"></canvas> + <script type="text/javascript"> + var cvs = document.getElementById("cvs"); + var ctx = cvs.getContext("2d"); + ctx.fillStyle = "#F00"; + ctx.fillRect(0, 0, 100, 100); + </script> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-canvas-sibling.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-canvas-sibling.html new file mode 100644 index 0000000000..2ecffbf51e --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-canvas-sibling.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Canvas with mix-blend-mode blends with sibling element</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that a canvas element having mix-blend-mode applied blends with a sibling element."> + <meta name="flags" content="dom"/> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-canvas-sibling-ref.html"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + <div style="width: 100px; height: 100px; background: #FF0;"></div> + <canvas id="cvs" width="100" height="100" style="mix-blend-mode: difference; position: relative; top: -100px;"></canvas> + <script type="text/javascript"> + var canvas = document.getElementById("cvs"); + var context = canvas.getContext("2d"); + + context.fillStyle = "#F00"; + context.fillRect(0, 0, 100, 100); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-creates-stacking-context.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-creates-stacking-context.html new file mode 100644 index 0000000000..2d24a3f589 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-creates-stacking-context.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: an element with mix-blend-mode other than normal creates a stacking context</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="flags" content="dom"> + <meta name="assert" content="Test checks that applying a blendmode other than normal + to the element must establish a new stacking context."> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="blender"></div> + <script type="text/javascript"> + var blendModes = ["multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", + "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"]; + + test(function() { + var blender = document.getElementById("blender"); + for (var i = 0; i < blendModes.length; ++i) { + blender.style.mixBlendMode = blendModes[i]; + var blenderStyle = window.getComputedStyle(blender); + assert_not_equals(blenderStyle.zIndex, "auto"); + } + }); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-filter.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-filter.html new file mode 100644 index 0000000000..d95866f839 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-filter.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with filter.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element having a filter effect and mix-blend-mode blends with its parent element."> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-filter-ref.html"> + </head> + <style type="text/css"> + div { + width: 100px; + height: 100px; + } + </style> + <body> + <p>Test passes if you can see a green blurred square. <br> + The test fails if the square is drawn with red. </p> + + <div style="background: #FF0;"> + <div style="background: #F00; mix-blend-mode: difference; filter: opacity(0.9);"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-iframe-parent.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-iframe-parent.html new file mode 100644 index 0000000000..a24a5f933e --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-iframe-parent.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: an iframe element with mix-blend-mode should blend with its parent element.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an iframe element blends with its parent element."> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-iframe-parent-ref.html"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + + <div style="width: 100px; height: 100px; background: #FF0;"> + <iframe src="support/red_square.html" frameborder="0" style="margin-top: -8px; margin-left: -8px; mix-blend-mode: difference;"></iframe> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-iframe-sibling.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-iframe-sibling.html new file mode 100644 index 0000000000..d1a5518b8c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-iframe-sibling.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: an iframe element with mix-blend-mode should blend with a sibling element.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an iframe element blends with a sibling element."> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-iframe-sibling-ref.html"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + + <div style="width: 100px; height: 100px; background: #FF0;"></div> + <iframe src="support/red_square.html" frameborder="0" style="margin-top: -108px; margin-left: -8px; mix-blend-mode: difference;"></iframe> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-image.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-image.html new file mode 100644 index 0000000000..bd0ef8eb7c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-image.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Image element with mix-blend-mode.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that mix-blend-mode is applied to an img element."> + <meta name="flags" content="image"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="mismatch" href="reference/mix-blend-mode-image-notref.html"> + <style type="text/css"> + div { + width: 100px; + height: 75px; + background: #FF0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green rectangle.</p> + <div> + <img src="support/red.png" style="max-width:100%; max-height:100%; mix-blend-mode: difference;"> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.html new file mode 100644 index 0000000000..8317473821 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode between an element and its child having overflow:hidden and border-radius, when the blending element overlaps a sibling element</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that the element with mix-blend-mode, overflow:hidden and border-radius blends correctly with its parent, as well as with the sibling element where they overlap."> + <meta name="fuzzy" content="0-10;0-50"> + <link rel="match" href="reference/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius-ref.html"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 150px; + height: 150px; + position: relative; + z-index: 1; + } + .blended { + background: fuchsia; + width: 150px; + height: 75px; + margin-top: -75px; + mix-blend-mode: difference; + } + .siblingOfBlended { + background: yellow;/*rgb(255,255,0);*/ + width: 150px; + height: 150px; + overflow: hidden; + border-radius: 2em 2em; + } + </style> + </head> + <body> + <p> This test passes if you can see a rectangle split in two pieces: the top half is yellow with aqua rounded borders and the bottom half is aqua with yellow borders.</p> + <div class="parent"> + <div class="siblingOfBlended"></div> + <div class="blended"> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-mask.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-mask.html new file mode 100644 index 0000000000..2a7072febb --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-mask.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with masking.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element having mask and mix-blend-mode blends with its parent element."> + <meta name="flags" content="svg"> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-mask-ref.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + } + </style> + </head> + <body> + <p>Test passes if you can see a green circle. <br> + The test fails if the circle is drawn with red. </p> + + <div style="background: #FF0"> + <div style="background: #F00; mix-blend-mode: difference; mask-image: url('support/red_circle.svg');"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-overflowing-child-of-blended-element.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-overflowing-child-of-blended-element.html new file mode 100644 index 0000000000..8096cf7f3d --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-overflowing-child-of-blended-element.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blend an element having an overflowing child.</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that a group consisting of an element + with mix-blend-mode and an overflowing child blends as a whole with the + underlying stacking context."> + <link rel="match" href="reference/mix-blend-mode-blended-element-with-transparent-pixels-ref.html"> + <style type="text/css"> + .parent { + position: absolute; + z-index: 1; + background: #00F; + width: 100px; + height: 100px; + margin: 10px; + } + .blender { + background: #777; + width: 120px; + height: 120px; + margin: -10px; + mix-blend-mode: difference; + } + .child { + background: #0FF; + width: 120px; + height: 120px; + } + </style> + </head> + <body> + <p>Test passes if you can see a lime square with aqua borders.<br> + If the borders are red, the test fails.</p> + <div class="parent"> + <div class="blender"> + <div class="child"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-overflowing-child.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-overflowing-child.html new file mode 100644 index 0000000000..de808bab0b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-overflowing-child.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: blended element overflows parent</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an overflowing element with mix-blend-mode blends with the parent element."> + <link rel="match" href="reference/mix-blend-mode-overflowing-child-ref.html"> + <style type="text/css"> + body { + background: lightgray; + } + .container { + position: absolute; + z-index: 1; + width: 100px; + height: 100px; + background: #0F0; + } + .blender { + background: #0F0; + margin: 50px; + width: 100px; + height: 100px; + mix-blend-mode: difference; + } + </style> + </head> + <body> + <p>Test passes if you can see two green squares and a black square as their intersection,<br> + drawn over a light gray background.</p> + <div class="container"> + <div class="blender"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-paragraph-background-image.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-paragraph-background-image.html new file mode 100644 index 0000000000..51744dc783 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-paragraph-background-image.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Paragraph element with mix-blend-mode over parent with background image.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that test a paragraph element blends with the parent element having background image."> + <meta name="flags" content="svg"> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-paragraph-background-image-ref.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background-image: url('support/yellow_square.svg'); + } + + #blender { + mix-blend-mode: difference; + color: #F00; + } + </style> + </head> + <body> + <p>Test passes if the paragraph text is drawn with green.</p> + <div> + <p id="blender">This should be drawn with green.</p> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-paragraph.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-paragraph.html new file mode 100644 index 0000000000..e0f4e383a5 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-paragraph.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Paragraph element with mix-blend-mode.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that test a paragraph element blends with the parent element."> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-paragraph-ref.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #FF0; + } + + #blender { + mix-blend-mode: difference; + color: #F00; + } + </style> + </head> + <body> + <p>Test passes if the paragraph text is drawn with green.</p> + <div> + <p id="blender">This should be drawn with green.</p> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-hidden-and-border-radius.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-hidden-and-border-radius.html new file mode 100644 index 0000000000..840d2626bc --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-hidden-and-border-radius.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element having overflow:hidden and border-radius and its child</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element having mix-blend-mode blends with the parent element having overflow:hidden and border-radius"> + <meta name="fuzzy" content="0-128;0-400"> + <link rel="match" href="reference/mix-blend-mode-parent-element-overflow-hidden-and-border-radius-ref.html"> + <style type="text/css"> + .parent { + background: red; + width: 140px; + height: 140px; + position: relative; + z-index: 1; + overflow: hidden; + border-radius: 1em 5em; + } + .blended { + background: yellow; + width: 200px; + height: 200px; + mix-blend-mode: difference; + } + </style> + </head> + <body> + <p> Test passes if you see a lime square with rounded corners.</p> + <div class="parent"> + <div class="blended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-scroll-blended-position-fixed.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-scroll-blended-position-fixed.html new file mode 100644 index 0000000000..5b0c246834 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-scroll-blended-position-fixed.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element having overflow:scroll and its child having position: fixed</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode blends with the parent element with overflow:scroll"> + <link rel="match" href="reference/mix-blend-mode-parent-element-overflow-scroll-blended-position-fixed-ref.html"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 150px; + height: 150px; + position: relative; + z-index: 1; + overflow:scroll; + } + + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + width: 100px; + height: 100px; + mix-blend-mode: multiply; + position: fixed; + } + + .scrollableContent { + width: 200px; + height: 200px; + } + </style> + </head> + <body> + <p>Test passes if you see a blue square inside an aqua container. <br> + The aqua container should have scrollbars on the left and bottom.</p> + <div class="parent"> + <div class="blended"></div> + <div class="scrollableContent"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-scroll.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-scroll.html new file mode 100644 index 0000000000..81c110c496 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-element-overflow-scroll.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element with overflow:scroll and its child</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode blends its parent having overflow:scroll"> + <link rel="match" href="reference/mix-blend-mode-parent-element-overflow-scroll-ref.html"> + <style type="text/css"> + .parent { + background: yellow; + width: 140px; + height: 140px; + position: relative; + z-index: 1; + overflow:scroll; + } + .blended { + background: red; + width: 200px; + height: 200px; + mix-blend-mode: difference; + } + </style> + </head> + <body> + <p>Test passes if you see a scrollable lime rectangle.</p> + <div class="parent"> + <div class="blended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-3D-transform-and-transition.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-3D-transform-and-transition.html new file mode 100644 index 0000000000..cd5f0e462b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-3D-transform-and-transition.html @@ -0,0 +1,65 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element having 3D transitions and its child</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="flags" content="dom"/> + <meta name="assert" content="Test checks that an element having mix-blend-mode blends with its parent element having 3D transform and transition"> + <style type="text/css"> + .parent { + background: yellow; + width: 140px; + height: 140px; + position:relative; + z-index: 1; + margin: 10px; + float: left; + transition: transform 2s; + + } + .rotated { + transform: rotateX(60deg) rotateZ(10deg) rotateY(180deg); + } + .blended { + background: red; + width: 140px; + height: 140px; + mix-blend-mode: difference; + } + .ref { + background: none; + } + .ref .blended { + background: lime; + mix-blend-mode: normal; + } + </style> + </head> + <body> + <p>Test passes if you can see two rotating lime rectangles, both identical.</p> + <div> + <div class="parent" id="parent"> + <div class="blended"></div> + </div> + <div class="parent ref" id="parentref"> + <div class="blended"></div> + </div> + </div> + <script type="text/javascript"> + var parent = document.getElementById('parent'); + var parentref = document.getElementById('parentref'); + function rotate (el, cl) { + if (el.className === cl + ' rotated') + el.className = cl; + else + el.className = cl + ' rotated'; + } + setTimeout(function () { rotate(parent, 'parent'); rotate(parentref, 'parent ref'); }, 0); + setInterval(function () { rotate(parent, 'parent'); rotate(parentref, 'parent ref'); }, 2000); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-3D-transform.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-3D-transform.html new file mode 100644 index 0000000000..d2175cfbd9 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-3D-transform.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode between an element with 3D transform and its child</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode blends with its parent having 3D transform"> + <link rel="match" href="reference/mix-blend-mode-parent-with-3D-transform-ref.html"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + transform:rotateX(20deg); + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + mix-blend-mode: difference; + } + </style> + </head> + <body> + <p>You should see a fuchsia square overlapping an aqua square. <br> + The overlapping area should be yellow. </p> + <div class="parent"> + <div class="blended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-border-radius.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-border-radius.html new file mode 100644 index 0000000000..e6562706d8 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-border-radius.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending with parent having border radius</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode blends + with the parent element having border-radius."> + <meta name="fuzzy" content="0-5;0-200"> + <link rel="match" href="reference/mix-blend-mode-parent-with-border-radius-ref.html"> + <style type="text/css"> + body { + background: lightgray; + } + .parent { + position: absolute; + z-index: 1; + width: 100px; + height: 100px; + background: #F00; + border-radius: 50px; + } + .blended { + background: #FF0; + width: 100px; + height: 100px; + mix-blend-mode: difference; + } + + </style> + </head> + <body> + <p>Test passes if a green circle is drawn on top of a yellow square, over a lightgray background.</p> + <div class="parent"> + <div class="blended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-text.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-text.html new file mode 100644 index 0000000000..274bebe539 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parent-with-text.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: check that the stacking context created by the parent element isolates blending.</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode only blends with the contents + of a parent that creates a stacking context."> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="match" href="reference/mix-blend-mode-parent-with-text-ref.html"> + <style type="text/css"> + .parent { + position: absolute; + z-index: 1; + width: 100px; + height: 100px; + } + .blender { + background: #FF0; + width: 100px; + height: 100px; + margin-top: -60px; + mix-blend-mode: difference; + } + .text { + height: 60px; + color: #F00; + } + body { + background: lightgray; + } + </style> + </head> + <body> + <p>Test passes if a yellow square with green text is drawn over a lightgray background.</p> + <div class="parent"> + <div class="text">Red text that becomes green after blending </div> + <div class="blender"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parsing.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parsing.html new file mode 100644 index 0000000000..1cf84dd826 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-parsing.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: parsing mix-blend-mode property</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="flags" content="dom"> + <meta name="assert" content="Test checks that the value specified for mix-blend-mode property is correctly parsed"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + </head> + <body> + <div id="log"></div> + <script type="text/javascript"> + function testParse(declaration) { + var div = document.createElement("div"); + div.setAttribute("style", declaration); + return div.style.mixBlendMode; + } + + var blendModes = ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", + "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity", "plus-lighter"]; + + for (var i = 0; i < blendModes.length; i++) { + test(function() {assert_equals(testParse("mix-blend-mode: " + blendModes[i]), blendModes[i] )}, "Mix-blend-mode " + blendModes[i]); + }; + </script> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html new file mode 100644 index 0000000000..fcf2d172af --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-basic.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<link rel="match" href="reference/mix-blend-mode-plus-lighter-basic-ref.html"> + +<style> +.container { + position: relative; + isolation: isolate; + width: 500px; + height: 500px; +} +.blue { background: #000064; } +.green { background: #006400; } +.common { + position: absolute; + width: 100px; + height: 100px; + opacity: 0.6; +} +.one { + top: 10px; + left: 10px; +} +.two { + top: 65px; + left: 30px; + mix-blend-mode: plus-lighter; +} +.three { + top: 120px; + left: 50px; + mix-blend-mode: plus-lighter; +} +</style> + +<div class=container> + <div class="one common blue"></div> + <div class="two common blue"></div> + <div class="three common green"></div> +</div> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html new file mode 100644 index 0000000000..c7c3ae9b97 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg-basic.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter SVG test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-basic-ref.html"> + +<style> +.isolate { isolation: isolate; } +rect { + opacity: 0.6; + mix-blend-mode: plus-lighter; +} +</style> + +<svg width=500 height=500> + <g class="isolate"> + <rect x="10" y="10" width="100" height="100" fill="#000064"></rect> + <rect x="30" y="65" width="100" height="100" fill="#000064"></rect> + <rect x="50" y="120" width="100" height="100" fill="#006400"></rect> + </g> +</svg> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html new file mode 100644 index 0000000000..630dcd777b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter-svg.html @@ -0,0 +1,38 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter SVG test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<link rel="match" href="reference/mix-blend-mode-plus-lighter-svg-ref.html"> +<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-4294967295"> +<style> + .blend-group { + isolation: isolate; + } + .layer { + mix-blend-mode: plus-lighter; + } +</style> +<script type="module"> + import { tests } from '../support/plus-lighter.js'; + import { toCSSColor } from '../support/utils.js'; + + function createRects(colors) { + let html = ''; + + for (const color of colors) { + html += `<rect class="layer" x="0" y="0" width="100%" height="100%" fill="${toCSSColor(color)}" />`; + } + + return html; + } + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <svg width="100" height="100"> + <g class="blend-group"> + ${createRects(colors)} + </g> + </svg> + `); + } +</script> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html new file mode 100644 index 0000000000..86bf1cc3f4 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-plus-lighter.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<link rel="match" href="reference/mix-blend-mode-plus-lighter-ref.html"> +<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-4294967295"> +<style> + .test { + width: 100px; + height: 100px; + position: relative; + isolation: isolate; + } + .layer { + position: absolute; + inset: 0; + mix-blend-mode: plus-lighter; + } +</style> +<script type="module"> + import { tests } from '../support/plus-lighter.js'; + import { toCSSColor } from '../support/utils.js'; + + function createLayers(colors) { + let html = ''; + + for (const color of colors) { + html += `<div class="layer" style="background-color: ${toCSSColor(color)}"></div>`; + } + + return html; + } + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test">${createLayers(colors)}</div> + `); + } +</script> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-rotated-clip.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-rotated-clip.html new file mode 100644 index 0000000000..63db5cbbe1 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-rotated-clip.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<title>mix-blend-mode under rotated clip</title> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> +<link rel="match" href="reference/mix-blend-mode-rotated-clip-ref.html"> +<meta name="fuzzy" content="0-1;0-30"> +<style>div { width: 100px; height: 100px; }</style> +<div style="background: lime; overflow: hidden"> + <div style="transform: rotate(45deg)"> + <div style="background: lime; overflow: hidden"> + <div style="background: red; transform: rotate(-45deg); mix-blend-mode: overlay; will-change: transform"></div> + </div> + </div> +</div> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-script.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-script.html new file mode 100644 index 0000000000..e842d0b395 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-script.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Set mix-blend-mode from script.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that mix-blend-mode is applied when set from script."> + <meta name="flags" content="dom"/> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-script-ref.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #FF0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green box.</p> + <div><div id="blender" style="background: #F00;"></div></div> + <script type="text/javascript"> + document.getElementById("blender").style.mixBlendMode = "difference"; + </script> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-sibling-with-3D-transform-and-transition.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-sibling-with-3D-transform-and-transition.html new file mode 100644 index 0000000000..798b1e2618 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-sibling-with-3D-transform-and-transition.html @@ -0,0 +1,76 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element and its sibling having 3D transform and transition</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="flags" content="dom"/> + <meta name="assert" content="Test checks that an element having mix-blend-mode blends with an overlapping sibling element having 3D transform and transition"> + <style type="text/css"> + .parent { + position: relative; + z-index: 1; + float: left; + margin-left: 10px; + } + .blended { + background: blue; + margin-top: -120px; + width: 140px; + position: relative; + z-index: 1; + height: 140px; + mix-blend-mode: difference; + } + .siblingOfBlended { + background: aqua; + width: 100px; + height: 100px; + margin-top: 20px; + margin-left: 20px; + transition: transform 2s; + } + .rotated { + transform: rotateX(60deg) rotateY(10deg) rotateZ(90deg); + } + + .ref .blended { + mix-blend-mode: normal; + } + .ref .siblingOfBlended { + z-index: 2; + position: relative; + background: lime; + } + </style> + </head> + <body> + <p>Test passes if you can see two blue rectangles having inside a lime rotating rectangle each.<br> + Lime rectangles should look identical when while rotating.</p> + <div> + <div class="parent"> + <div class="siblingOfBlended" id="sibling"></div> + <div class="blended"></div> + </div> + <div class="parent ref"> + <div class="siblingOfBlended ref" id="siblingref"></div> + <div class="blended"></div> + </div> + </div> + <script type="text/javascript"> + var sibling = document.getElementById('sibling'); + var siblingref = document.getElementById('siblingref'); + function rotate (el, cl) { + if (el.className === cl + ' rotated') + el.className = cl; + else + el.className = cl + ' rotated'; + } + setTimeout(function () { rotate(sibling, 'siblingOfBlended'); rotate(siblingref, 'siblingOfBlended ref'); }, 0); + setInterval(function () { rotate(sibling, 'siblingOfBlended'); rotate(siblingref, 'siblingOfBlended ref'); }, 2000); + </script> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-sibling-with-3D-transform.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-sibling-with-3D-transform.html new file mode 100644 index 0000000000..a9a9d1bd25 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-sibling-with-3D-transform.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: blending between an element and its sibling element having 3D transform</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode blends with both parent element and with sibling element having 3D transform"> + <link rel="match" href="reference/mix-blend-mode-sibling-with-3D-transform-ref.html"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + position: relative; + z-index: 1; + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: -200px; + margin-left: 20px; + width: 200px; + height: 200px; + mix-blend-mode: difference; + } + .siblingOfBlended { + background: red;/*rgb(255,0,0);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + transform: perspective(600px) translateZ(-200px); + } + </style> + </head> + <body> + <p>You should see three overlapping squares, from back to front, having the following colors: aqua, fuchsia and blue. <br> + The intersection area between aqua and fuchsia squares, which is not overlapped by the blue square, should be yellow.</p> + <div class="parent"> + <div class="siblingOfBlended"></div> + <div class="blended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-simple.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-simple.html new file mode 100644 index 0000000000..b00f81694e --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-simple.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: An element with mix-blend-mode blends with its parent element.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an element with mix-blend-mode blends with its parent element."> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="match" href="reference/green-square.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + } + .parent { + background: #FF0; + } + .child { + background: #F00; + mix-blend-mode: difference; + } + </style> + </head> + <body> + <p>Test passes if you can see a green square on the screen.</p> + <div class="parent"> + <div class="child"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-stacking-context-001.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-stacking-context-001.html new file mode 100644 index 0000000000..6fc7c21f33 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-stacking-context-001.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode between an element and its child</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that the element with mix-blend-mode and opacity blends with the parent element"> + <link rel="match" href="reference/mix-blend-mode-stacking-context-001-ref.html"> + <style> + .simple{ + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + display:inline-block; + } + .mixed { + opacity: 0.9; + background: red;/*rgb(255,0,0);*/ + margin-top: 20px; + margin-left: 20px; + width: 100px; + height: 100px; + mix-blend-mode: multiply; + } + </style> + </head> + <body> + <p>Test passes if you see a black rectangle with large aqua borders. + You should not see a red rectangle on the page. </p> + <div class="simple"> + <div class="mixed"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-stacking-context-creates-isolation.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-stacking-context-creates-isolation.html new file mode 100644 index 0000000000..79edf0f090 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-stacking-context-creates-isolation.html @@ -0,0 +1,46 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: stacking context creates isolated group</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <meta name="assert" content="Test checks that properties that cause the creation of stacking context cause a group to be isolated"> + <link rel="match" href="reference/mix-blend-mode-stacking-context-creates-isolation-ref.html"> + <style> + .container{ + margin: 30px; + width: 130px; + height: 130px; + float: left; + background: yellow;/*rgb(255,255,0);*/ + } + .simple{ + background: lime;/* rgb(0,255,0);*/ + width: 100px; + height: 100px; + position: fixed; + } + .mixed { + background: red;/*rgb(255,0,0);*/ + margin-top: 20px; + margin-left: 20px; + width: 100px; + height: 100px; + mix-blend-mode: multiply; + } + </style> + </head> + <body> + <p>Test passes if there is no complete red square on the screen. <br> + You should see two overlapping lime and red squares on top of a yellow one. <br> + At the intersection of the lime and red squares, a black square will be created. </p> + <div class="container"> + <div class="simple"> + <div class="mixed"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-svg.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-svg.html new file mode 100644 index 0000000000..b7b9f89e92 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-svg.html @@ -0,0 +1,29 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: SVG element is blended.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that an SVG element blends with the parent container."> + <meta name="flags" content="svg"> + <meta name="fuzzy" content="0-1;0-10"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="match" href="reference/mix-blend-mode-svg-ref.html"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #FF0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green box.</p> + <div> + <svg width="100" height="100" style="mix-blend-mode: difference;"> + <rect width="100" height="100" style="fill: #F00;"> + </svg> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-video-sibling.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-video-sibling.html new file mode 100644 index 0000000000..87d7d1eac6 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-video-sibling.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode blending between a video element and an overlapping sibling</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that a video element blends with an overlapping sibling element with some text inside"> + <link rel="mismatch" href="reference/mix-blend-mode-video-sibling-notref.html"> + <style type="text/css"> + div { + mix-blend-mode: difference; + margin-top: -361px; + background-color: #FF0; + width: 300px; + height: 350px; + color: #F00; + } + </style> + </head> + <body> + <p>Test passes if you can see text and a circle moving from the top to the bottom of the page,<br> + both drawn with green, over a blue background.</p> + <video autoplay> + <source type="video/mp4" src="support/red_circle.mp4"> + </video> + <div>Some text inside the div.</div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-video.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-video.html new file mode 100644 index 0000000000..298ba99080 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-video.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Video element with mix-blend-mode.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that mix-blend-mode is applied to a video element."> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="reviewer" title="Mirela Budaes" href="mailto:mbudaes@adobe.com"> + <link rel="mismatch" href="reference/mix-blend-mode-video-notref.html"> + <style type="text/css"> + div { + width: 480px; + height: 352px; + background: #FF0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green circle over a blue background.</p> + <div> + <video autoplay style="mix-blend-mode: difference"> + <source src="support/red_circle.mp4" type="video/mp4"> + </video> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-with-transform-and-preserve-3D.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-with-transform-and-preserve-3D.html new file mode 100644 index 0000000000..6d27a40ff2 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/mix-blend-mode-with-transform-and-preserve-3D.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode between an element and its child having 3D transform and preserve 3D</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="assert" content="Test checks that mix-blend-mode overrides the behavior of transform-style:preserve-3d"> + <meta name="fuzzy" content="0-50;0-300"> + <link rel="match" href="reference/mix-blend-mode-with-transform-and-preserve-3D-ref.html"> + <style type="text/css"> + div { + height: 150px; + width: 150px; + } + .container { + position: relative; + z-index: 1; + background-color: lime;/*rgb(0,255,0);*/ + } + .transformed { + transform-style: preserve-3d; + transform: rotateY(50deg); + background-color: aqua;/*rgb(0,255,255);*/ + mix-blend-mode: difference; + } + .child { + transform-origin: top left; + transform: rotateX(40deg); + background-color: red;/*rgb(255,0,0);*/ + } + </style> + </head> + <body> + <p>You should see 2 small rectangles (yellow and blue) drawn inside a lime container.<br> + The edges for all the rectangles should be either horizontal, or vertical (not skewed).</p> + <div class="container"> + <div class="transformed"> + <div class="child"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/green-square.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/green-square.html new file mode 100644 index 0000000000..bfc4f715ef --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/green-square.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + background: #0F0; + width: 100px; + height: 100px; + } + </style> + </head> + <body> + <p>Test passes if you can see a green square on the screen.</p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-animation-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-animation-ref.html new file mode 100644 index 0000000000..1dc65d8131 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-animation-ref.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with animation</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #FF0; + } + + @keyframes changeOpacity + { + from { opacity: 0.9; } + 50% { opacity: 0.9; } + to { opacity: 0.1; } + } + + #blender { + background: #0F0; + animation: changeOpacity 10s; + } + </style> + </head> + <body> + <p>Test passes if you can see a fading green box after 5 seconds.</p> + <div><div id="blender"></div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-overflow-hidden-and-border-radius-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-overflow-hidden-and-border-radius-ref.html new file mode 100644 index 0000000000..32e73e7fe9 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-overflow-hidden-and-border-radius-ref.html @@ -0,0 +1,39 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 150px; + height: 150px; + position: relative; + z-index: 1; + } + .blended { + width: 150px; + height: 150px; + overflow: hidden; + border-radius: 2em 2em; + } + .childOfBlended { + background: lime;/*rgb(0,255,0);*/ + width: 150px; + height: 150px; + } + </style> + </head> + <body> + <p>The test passes if you see a lime rectangle with aqua rounded corners.</p> + <div class="parent"> + <div class="blended"> + <div class="childOfBlended"> + </div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-overflow-scroll-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-overflow-scroll-ref.html new file mode 100644 index 0000000000..12bc979025 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-overflow-scroll-ref.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background-color: lime; + } + </style> + </head> + <body> + <p>Test passes if you see a lime rectangle.</p> + <div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-with-transparent-pixels-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-with-transparent-pixels-ref.html new file mode 100644 index 0000000000..ee77433640 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-element-with-transparent-pixels-ref.html @@ -0,0 +1,31 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <style type="text/css"> + .parent { + position: absolute; + z-index: 1; + background: #0FF; + width: 120px; + height: 120px; + } + .child { + background: #0F0; + width: 100px; + height: 100px; + margin: 10px; + } + </style> + </head> + <body> + <p>Test passes if you can see a lime square with aqua borders.<br> + If the borders are red, the test fails.</p> + <div class="parent"> + <div class="child"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-with-3D-transform-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-with-3D-transform-ref.html new file mode 100644 index 0000000000..83ee7deef1 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-with-3D-transform-ref.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + position:relative; + z-index: 1; + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + transform:rotateX(20deg); + } + .childOfBlended { + background: yellow;/*rgb(255,255,0);*/ + width: 120px; + height: 122px; + } + </style> + </head> + <body> + <p>You should see a fuchsia square overlapping an aqua square. <br> + The overlapping area should be yellow. </p> + <div class="parent"> + <div class="blended"> + <div class="childOfBlended"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-with-transform-and-perspective-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-with-transform-and-perspective-ref.html new file mode 100644 index 0000000000..3219d0f65e --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-blended-with-transform-and-perspective-ref.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + height: 150px; + width: 150px; + } + .container { + position: relative; + z-index: 1; + background-color: lime;/*rgb(0,255,0);*/ + } + .transformed { + transform: perspective(600px) translateZ(-200px); + background-color: yellow;/*rgb(255,255,0);*/ + } + </style> + </head> + <body> + <p>You should see a yellow square inside a green container.</p> + <div class="container"> + <div class="transformed"> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-border-image-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-border-image-ref.html new file mode 100644 index 0000000000..9f12587738 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-border-image-ref.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with border image</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style> + div { + width: 120px; + height: 120px; + background: #0F0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the div is displayed with red. </p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-both-parent-and-blended-with-3D-transform-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-both-parent-and-blended-with-3D-transform-ref.html new file mode 100644 index 0000000000..b59802a229 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-both-parent-and-blended-with-3D-transform-ref.html @@ -0,0 +1,44 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + transform:rotateX(20deg); + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + transform:rotateX(20deg); + } + .childOfBlended { + background: yellow;/*rgb(255,255,0);*/ + width: 120px; + height: 122px; + } + p { + will-change: transform; + } + </style> + </head> + <body> + <p>You should see a fuchsia square overlapping an aqua square. <br> + The overlapping area should be yellow. </p> + <div class="parent"> + <div class="blended"> + <div class="childOfBlended"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-canvas-parent-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-canvas-parent-ref.html new file mode 100644 index 0000000000..44a9f48aac --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-canvas-parent-ref.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Canvas with mix-blend-mode blends with the parent element.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + <div style="width: 100px; height: 100px; background: #0F0;"> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-canvas-sibling-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-canvas-sibling-ref.html new file mode 100644 index 0000000000..cf4ce40117 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-canvas-sibling-ref.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Canvas with mix-blend-mode blends with sibling element</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + <div style="width: 100px; height: 100px; background: #0F0"></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-filter-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-filter-ref.html new file mode 100644 index 0000000000..282d525753 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-filter-ref.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with filter.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + } + </style> + </head> + <body> + <p>Test passes if you can see a green blurred square. <br> + The test fails if the square is drawn with red. </p> + + <div style="background: #0F0; filter: opacity(0.9);"></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-iframe-parent-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-iframe-parent-ref.html new file mode 100644 index 0000000000..f1c8e9d105 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-iframe-parent-ref.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: an iframe element with mix-blend-mode should blend with its parent element.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + + <div style="width: 100px; height: 100px; background: #0F0;"></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-iframe-sibling-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-iframe-sibling-ref.html new file mode 100644 index 0000000000..0be26410ce --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-iframe-sibling-ref.html @@ -0,0 +1,13 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: an iframe element with mix-blend-mode should blend with a sibling element.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + </head> + <body> + <p>Test passes if you can see a green rectangle. <br> + If blending is not performed, the canvas is displayed with red. </p> + + <div style="width: 100px; height: 100px; background: #0F0;"></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-image-notref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-image-notref.html new file mode 100644 index 0000000000..963697d84b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-image-notref.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Image element with mix-blend-mode.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 100px; + height: 75px; + background: #FF0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green rectangle.</p> + <div> + <img src="../support/red.png" style="max-width:100%; max-height:100%;"> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius-ref.html new file mode 100644 index 0000000000..96ac8b3e31 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-intermediate-element-overflow-hidden-and-border-radius-ref.html @@ -0,0 +1,55 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: aqua; + width: 150px; + height: 150px; + position: relative; + z-index: 1; + } + .blended { + background: yellow; + width: 150px; + height: 150px; + border-radius: 2em 2em; + } + .blended1 { + background: yellow; + width: 150px; + height: 75px; + margin-top: -75px; + } + .child1 { + background: aqua; + width: 150px; + height: 75px; + border-radius: 0 0 2em 2em; + } + .siblingOfBlended { + background: yellow; + width: 150px; + height: 150px; + overflow: hidden; + border-radius: 2em 2em; + } + </style> + </head> + <body> + <p> This test passes if you can see a rectangle split in two pieces: the top half is yellow with aqua rounded borders and the bottom half is aqua with yellow borders.</p> + <div class="parent"> + <div class="blended"> + <div class="child"></div> + </div> + <div class="blended1"> + <div class="child1"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-mask-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-mask-ref.html new file mode 100644 index 0000000000..530a5d5ec7 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-mask-ref.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Blended element with masking.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + </head> + <style type="text/css"> + div { + width: 100px; + height: 100px; + } + </style> + <body> + <p>Test passes if you can see a green circle. <br> + The test fails if the circle is drawn with red. </p> + + <div style="background: #FF0;"><div style="background: #0F0; mask-image: url('../support/red_circle.svg');"></div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-overflowing-child-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-overflowing-child-ref.html new file mode 100644 index 0000000000..a083cbc532 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-overflowing-child-ref.html @@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <style type="text/css"> + body { + background: lightgray; + } + .container { + position: absolute; + z-index: 1; + width: 100px; + height: 100px; + background: #0F0; + } + .blender { + background: #0F0; + margin: 50px; + width: 100px; + height: 100px; + } + .intersection { + background: #000; + width: 50px; + height: 50px; + margin-top: -150px; + margin-left: 50px; + } + </style> + </head> + <body> + <p>Test passes if you can see two green squares and a black square as their intersection,<br> + drawn over a light gray background.</p> + <div class="container"> + <div class="blender"></div> + <div class="intersection"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-paragraph-background-image-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-paragraph-background-image-ref.html new file mode 100644 index 0000000000..3a89df453b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-paragraph-background-image-ref.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Paragraph element with mix-blend-mode over parent with background image.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background-image: url('../support/yellow_square.svg'); + } + + #blender { + color: #0F0; + } + </style> + </head> + <body> + <p>Test passes if the paragraph text is drawn with green.</p> + <div> + <p id="blender">This should be drawn with green.</p> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-paragraph-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-paragraph-ref.html new file mode 100644 index 0000000000..dc8b21654a --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-paragraph-ref.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Paragraph element with mix-blend-mode.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <meta name="assert" content="Test checks that test a paragraph element blends with the parent element."> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #FF0; + } + + #blender { + color: #0F0; + } + </style> + </head> + <body> + <p>Test passes if the paragraph text is drawn with green.</p> + <div> + <p id="blender">This should be drawn with green.</p> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-hidden-and-border-radius-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-hidden-and-border-radius-ref.html new file mode 100644 index 0000000000..d415624f20 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-hidden-and-border-radius-ref.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: lime; + width: 140px; + height: 140px; + border-radius: 1em 5em; + } + </style> + </head> + <body> + <p> Test passes if you see a lime square with rounded corners.</p> + <div class="parent"> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-scroll-blended-position-fixed-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-scroll-blended-position-fixed-ref.html new file mode 100644 index 0000000000..fd780ee3cc --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-scroll-blended-position-fixed-ref.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 150px; + height: 150px; + position: relative; + z-index: 1; + overflow:scroll; + } + + .blended { + background: blue;/*rgb(0,0,255);*/ + width: 100px; + height: 100px; + position: fixed; + } + + .scrollableContent { + width: 200px; + height: 200px; + } + </style> + </head> + <body> + <p>Test passes if you see a blue square inside an aqua container. <br> + The aqua container should have scrollbars on the left and bottom.</p> + <div class="parent"> + <div class="blended"></div> + <div class="scrollableContent"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-scroll-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-scroll-ref.html new file mode 100644 index 0000000000..1e583b349c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-element-overflow-scroll-ref.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + width: 140px; + height: 140px; + position: relative; + z-index: 1; + overflow:scroll; + } + .blended { + background: lime; + width: 200px; + height: 200px; + } + </style> + </head> + <body> + <p>Test passes if you see a scrollable lime rectangle.</p> + <div class="parent"> + <div class="blended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-3D-transform-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-3D-transform-ref.html new file mode 100644 index 0000000000..d512e70d6c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-3D-transform-ref.html @@ -0,0 +1,40 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + transform:rotateX(20deg); + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + } + .childOfBlended { + background: yellow;/*rgb(255,255,0);*/ + width: 120px; + height: 120px; + } + </style> + </head> + <body> + <p>You should see a fuchsia square overlapping an aqua square. <br> + The overlapping area should be yellow. </p> + <div class="parent"> + <div class="blended"> + <div class="childOfBlended"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-border-radius-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-border-radius-ref.html new file mode 100644 index 0000000000..68e97ecff9 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-border-radius-ref.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <style type="text/css"> + body { + background: lightgray; + } + .parent { + position: absolute; + z-index: 1; + width: 100px; + height: 100px; + background: #FF0; + } + .blended { + background: #0F0; + width: 100px; + height: 100px; + border-radius: 50px; + } + </style> + </head> + <body> + <p>Test passes if a green circle is drawn on top of a yellow square, over a lightgray background.</p> + <div class="parent"> + <div class="blended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-text-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-text-ref.html new file mode 100644 index 0000000000..275105c5db --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-parent-with-text-ref.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Horia Olaru" href="mailto:olaru@adobe.com"> + <style type="text/css"> + .container { + background: #FF0; + width: 100px; + height: 100px; + } + .text { + color: #0F0; + } + body { + background: lightgray; + } + </style> + </head> + <body> + <p>Test passes if a yellow square with green text is drawn over a lightgray background.</p> + <div class="container"> + <div class="text">Red text that becomes green after blending</div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html new file mode 100644 index 0000000000..e5acd26b6f --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-basic-ref.html @@ -0,0 +1,57 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> + +<style> +.container { + isolation: isolate; + position: relative; + width: 500px; + height: 500px; +} +.blue { background: #000064; } +.green { background: #006400; } +.common { + position: absolute; + width: 100px; + height: 100px; + opacity: 0.6; +} +.one { + top: 10px; + left: 10px; +} +.two { + top: 65px; + left: 30px; +} +.three { + top: 120px; + left: 50px; +} +.one_and_two { + position: absolute; + width: 80px; + height: 45px; + top: 65px; + left: 30px; + background: #000078; +} +.two_and_three { + position: absolute; + width: 80px; + height: 45px; + top: 120px; + left: 50px; + background: #003C3C; +} +</style> + +<div class=container> + <div class="one common blue"></div> + <div class="two common blue"></div> + <div class="three common green"></div> + <div class="one_and_two"></div> + <div class="two_and_three"></div> +</div> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html new file mode 100644 index 0000000000..4709ab8b68 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-ref.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<style> + .test { + width: 100px; + height: 100px; + } +</style> +<script type="module"> + import { tests, plusLighter } from '../../support/plus-lighter.js'; + import { toCSSColor } from '../../support/utils.js'; + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <div class="test" style="background-color: ${toCSSColor(plusLighter(colors))}"></div> + `); + } +</script> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html new file mode 100644 index 0000000000..9193bb574b --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-basic-ref.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter SVG test</title> +<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> + +<style> +.isolate { isolation: isolate; } +.original { opacity: 0.6; } +</style> + +<svg width=500 height=500> + <g class="isolate"> + <rect class="original" x="10" y="10" width="100" height="100" fill="#000064"></rect> + <rect class="original" x="30" y="65" width="100" height="100" fill="#000064"></rect> + <rect class="original" x="50" y="120" width="100" height="100" fill="#006400"></rect> + <rect x="30" y="65" width="80" height="45" fill="#000078"></rect> + <rect x="50" y="120" width="80" height="45" fill="#003C3C"></rect> + </g> +</svg> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html new file mode 100644 index 0000000000..8e1cb70759 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-plus-lighter-svg-ref.html @@ -0,0 +1,14 @@ +<!DOCTYPE html> +<title>mix-blend-mode: plus-lighter SVG test</title> +<link rel="author" title="Jake Archibald" href="mailto:jakearchibald@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-2/#mix-blend-mode"> +<script type="module"> + import { tests, plusLighter } from '../../support/plus-lighter.js'; + import { toCSSColor } from '../../support/utils.js'; + + for (const colors of tests) { + document.body.insertAdjacentHTML('beforeend', ` + <svg width="100" height="100" style="background-color: ${toCSSColor(plusLighter(colors))}"></svg> + `); + } +</script> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-rotated-clip-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-rotated-clip-ref.html new file mode 100644 index 0000000000..377ed7c879 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-rotated-clip-ref.html @@ -0,0 +1,2 @@ +<!DOCTYPE html> +<div style="width: 100px; height: 100px; background: lime"></div> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-script-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-script-ref.html new file mode 100644 index 0000000000..b18ed6cd3c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-script-ref.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Set mix-blend-mode from script.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #FF0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green box.</p> + <div><div style="background: #0F0;"></div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-sibling-with-3D-transform-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-sibling-with-3D-transform-ref.html new file mode 100644 index 0000000000..146f7b6307 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-sibling-with-3D-transform-ref.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + .parent { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + padding-top: 1px; + position: relative; + z-index: 1; + } + .blended { + background: fuchsia;/*rgb(255,0,255);*/ + margin-top: -200px; + margin-left: 20px; + width: 200px; + height: 200px; + } + .siblingOfBlended { + background: blue;/*rgb(0,0,255);*/ + margin-top: 20px; + margin-left: 20px; + width: 200px; + height: 200px; + transform: perspective(600px) translateZ(-200px); + } + .intersectionOfBlended { + background: yellow;/*rgb(255,255,0);*/ + margin-top: -200px; + margin-left: 20px; + width: 120px; + height: 120px; + } + </style> + </head> + <body> + <p>You should see three overlapping squares, from back to front, having the following colors: aqua, fuchsia and blue. <br> + The intersection area between aqua and fuchsia squares, which is not overlapped by the blue square, should be yellow.</p> + <div class="parent"> + <div class="siblingOfBlended"></div> + <div class="blended"></div> + <div class="intersectionOfBlended"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-stacking-context-001-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-stacking-context-001-ref.html new file mode 100644 index 0000000000..9b0710acec --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-stacking-context-001-ref.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <style> + .simple { + background: aqua;/*rgb(0,255,255);*/ + width: 140px; + height: 140px; + display:inline-block; + } + .mixed { + background: black;/*rgb(0,0,0);*/ + margin-top: 20px; + margin-left: 20px; + width: 100px; + height: 100px; + } + </style> + </head> + <body> + <p>Test passes if you see a black rectangle with large aqua borders. + You should not see a red rectangle on the page. </p> + <div class="simple"> + <div class="mixed"></div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-stacking-context-creates-isolation-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-stacking-context-creates-isolation-ref.html new file mode 100644 index 0000000000..806abe25e8 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-stacking-context-creates-isolation-ref.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <style> + .container{ + margin: 30px; + width: 130px; + height: 130px; + float: left; + background: yellow;/*rgb(255,255,0);*/ + } + .simple{ + background: lime;/* rgb(0,255,0);*/ + width: 100px; + height: 100px; + position: fixed; + } + .mixed { + background: red;/*rgb(255,0,0);*/ + margin-top: 20px; + margin-left: 20px; + width: 100px; + height: 100px; + } + .overlap { + background: black;/*rgb(0,0,0);*/ + width: 80px; + height: 80px; + } + </style> + </head> + <body> + <p>Test passes if there is no complete red square on the screen. <br> + You should see two overlapping lime and red squares on top of a yellow one. <br> + At the intersection of the lime and red squares, a black square will be created. </p> + <div class="container"> + <div class="simple"> + <div class="mixed"> + <div class="overlap"></div> + </div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-svg-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-svg-ref.html new file mode 100644 index 0000000000..2ebde9167c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-svg-ref.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: SVG element is blended.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 100px; + height: 100px; + background: #0F0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green box.</p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-video-notref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-video-notref.html new file mode 100644 index 0000000000..43b8e11e5a --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-video-notref.html @@ -0,0 +1,22 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Test: Video element with mix-blend-mode.</title> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + width: 480px; + height: 352px; + background: #FF0; + } + </style> + </head> + <body> + <p>Test passes if you can see a green circle over a blue background.</p> + <div> + <video autoplay> + <source src="../support/red_circle.mp4" type="video/mp4"> + </video> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-video-sibling-notref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-video-sibling-notref.html new file mode 100644 index 0000000000..f42bb53f26 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-video-sibling-notref.html @@ -0,0 +1,26 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode blending between a video element and an overlapping sibling</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Mihai Tica" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + margin-top: -361px; + background-color: #FF0; + width: 300px; + height: 350px; + color: #F00; + } + </style> + </head> + <body> + <p>Test passes if you can see text and a circle moving from the top to the bottom of the page,<br> + both drawn with green, over a blue background.</p> + <video autoplay> + <source src="../support/red_circle.mp4" type="video/mp4"> + </video> + <div>Some text inside the div.</div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-with-transform-and-preserve-3D-ref.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-with-transform-and-preserve-3D-ref.html new file mode 100644 index 0000000000..cb92384720 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/reference/mix-blend-mode-with-transform-and-preserve-3D-ref.html @@ -0,0 +1,41 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="author" title="Ion Roșca" href="mailto:rosca@adobe.com"> + <link rel="reviewer" title="Mihai Țică" href="mailto:mitica@adobe.com"> + <style type="text/css"> + div { + height: 150px; + width: 150px; + } + .container { + position: relative; + z-index: 1; + background-color: lime;/*rgb(0,255,0);*/ + } + .transformed { + /*transform-style: preserve-3d;*/ + transform: rotateY(50deg); + background-color: blue;/*rgb(0,0,255);*/ + /*mix-blend-mode: difference;*/ + } + .child { + transform-origin: top left; + transform: rotateX(40deg); + background-color: yellow;/*rgb(255,255,0);*/ + } + </style> + </head> + <body> + <p>You should see 2 small rectangles (yellow and blue) drawn inside a lime container.<br> + The edges for all the rectangles should be either horizontal, or vertical (not skewed).</p> + <div class="container"> + <div class="transformed"> + <div class="child"></div> + </div> + </div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.mov b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.mov Binary files differnew file mode 100644 index 0000000000..08e6b499cc --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.mov diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.mp4 b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.mp4 Binary files differnew file mode 100644 index 0000000000..0d0ac933ec --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.mp4 diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.oggtheora.ogv b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.oggtheora.ogv Binary files differnew file mode 100644 index 0000000000..baed6e2f5d --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.oggtheora.ogv diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.webmhd.webm b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.webmhd.webm Binary files differnew file mode 100644 index 0000000000..37e6862bca --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.webmhd.webm diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.webmsd.webm b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.webmsd.webm Binary files differnew file mode 100644 index 0000000000..51337c7cff --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/RGB_Circles.webmsd.webm diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red.png b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red.png Binary files differnew file mode 100644 index 0000000000..acc86d4770 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red.png diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_circle.mp4 b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_circle.mp4 Binary files differnew file mode 100644 index 0000000000..ff251316a5 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_circle.mp4 diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_circle.svg b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_circle.svg new file mode 100644 index 0000000000..3a8050ec30 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_circle.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> + <circle cx="50" cy="50" r="40" fill="#F00"/> +</svg> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_square.html b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_square.html new file mode 100644 index 0000000000..05bac7a135 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_square.html @@ -0,0 +1,6 @@ +<!DOCTYPE html> +<html> +<body> + <div style="width: 100px; height: 100px; background: #F00;"></div> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_square.svg b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_square.svg new file mode 100644 index 0000000000..a078e6b731 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/red_square.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> + <rect width="100" height="100" style="fill:rgb(255,0,0);"/> +</svg> diff --git a/testing/web-platform/tests/css/compositing/mix-blend-mode/support/yellow_square.svg b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/yellow_square.svg new file mode 100644 index 0000000000..9ab6394e2a --- /dev/null +++ b/testing/web-platform/tests/css/compositing/mix-blend-mode/support/yellow_square.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> + <rect width="100" height="100" style="fill:rgb(255,255,0);"/> +</svg> diff --git a/testing/web-platform/tests/css/compositing/opacity-and-transform-animation-crash.html b/testing/web-platform/tests/css/compositing/opacity-and-transform-animation-crash.html new file mode 100644 index 0000000000..294a823cd8 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/opacity-and-transform-animation-crash.html @@ -0,0 +1,27 @@ +<!DOCTYPE HTML> +<html class=test-wait> +<style type="text/css"> + @keyframes anim { + from { + opacity: 0.99; + } + to { + opacity: 0.9; + transform: scale(1, 1); + } + } +</style> +<div id="div" style="transform: scale(1, 10); animation: 50ms linear 0s anim;"></div> +<script> + function boom() { + div.style.transform = ''; + document.execCommand("SelectAll", false, ""); + requestAnimationFrame(function() { + requestAnimationFrame(function() { + document.documentElement.classList.remove('test-wait'); + }); + }); + } + setTimeout(boom, 50); +</script> +</html>
\ No newline at end of file diff --git a/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-computed.html b/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-computed.html new file mode 100644 index 0000000000..22d6a5f380 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-computed.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: getComputedStyle().backgroundBlendMode</title> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-background-blend-mode"> +<meta name="assert" content="background-blend-mode computed value is as specified."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/computed-testcommon.js"></script> +</head> +<body> +<div id="target"></div> +<script> +test_computed_value("background-blend-mode", "normal"); +test_computed_value("background-blend-mode", "multiply"); +test_computed_value("background-blend-mode", "screen"); +test_computed_value("background-blend-mode", "overlay"); +test_computed_value("background-blend-mode", "darken"); +test_computed_value("background-blend-mode", "lighten"); +test_computed_value("background-blend-mode", "color-dodge"); +test_computed_value("background-blend-mode", "color-burn"); +test_computed_value("background-blend-mode", "hard-light"); +test_computed_value("background-blend-mode", "soft-light"); +test_computed_value("background-blend-mode", "difference"); +test_computed_value("background-blend-mode", "exclusion"); +test_computed_value("background-blend-mode", "hue"); +test_computed_value("background-blend-mode", "saturation"); +test_computed_value("background-blend-mode", "color"); +test_computed_value("background-blend-mode", "luminosity"); + +test_computed_value("background-blend-mode", "normal, luminosity"); +test_computed_value("background-blend-mode", "screen, overlay"); +test_computed_value("background-blend-mode", "color, saturation"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-invalid.html b/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-invalid.html new file mode 100644 index 0000000000..4fdd3d36ed --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: parsing background-blend-mode with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-background-blend-mode"> +<meta name="assert" content="background-blend-mode supports only the grammar '<blend-mode>#'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("background-blend-mode", "auto"); +test_invalid_value("background-blend-mode", "normal luminosity"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-valid.html b/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-valid.html new file mode 100644 index 0000000000..151a01c75a --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/background-blend-mode-valid.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: parsing background-blend-mode with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-background-blend-mode"> +<meta name="assert" content="background-blend-mode supports the full grammar '<blend-mode>#'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("background-blend-mode", "normal"); +test_valid_value("background-blend-mode", "multiply"); +test_valid_value("background-blend-mode", "screen"); +test_valid_value("background-blend-mode", "overlay"); +test_valid_value("background-blend-mode", "darken"); +test_valid_value("background-blend-mode", "lighten"); +test_valid_value("background-blend-mode", "color-dodge"); +test_valid_value("background-blend-mode", "color-burn"); +test_valid_value("background-blend-mode", "hard-light"); +test_valid_value("background-blend-mode", "soft-light"); +test_valid_value("background-blend-mode", "difference"); +test_valid_value("background-blend-mode", "exclusion"); +test_valid_value("background-blend-mode", "hue"); +test_valid_value("background-blend-mode", "saturation"); +test_valid_value("background-blend-mode", "color"); +test_valid_value("background-blend-mode", "luminosity"); + +test_valid_value("background-blend-mode", "normal, luminosity"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/isolation-computed.html b/testing/web-platform/tests/css/compositing/parsing/isolation-computed.html new file mode 100644 index 0000000000..2f7a6e7924 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/isolation-computed.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: getComputedStyle().isolation</title> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-isolation"> +<meta name="assert" content="isolation computed value is as specified."> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/computed-testcommon.js"></script> +</head> +<body> +<div id="target"></div> +<script> +test_computed_value("isolation", "auto"); +test_computed_value("isolation", "isolate"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/isolation-invalid.html b/testing/web-platform/tests/css/compositing/parsing/isolation-invalid.html new file mode 100644 index 0000000000..d5b8f49c61 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/isolation-invalid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: parsing isolation with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-isolation"> +<meta name="assert" content="isolation supports only the grammar '<isolation-mode>'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("isolation", "none"); +test_invalid_value("isolation", "auto isolate"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/isolation-valid.html b/testing/web-platform/tests/css/compositing/parsing/isolation-valid.html new file mode 100644 index 0000000000..252ff138e0 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/isolation-valid.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: parsing isolation with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-isolation"> +<meta name="assert" content="isolation supports the full grammar '<isolation-mode>'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("isolation", "auto"); +test_valid_value("isolation", "isolate"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-computed.html b/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-computed.html new file mode 100644 index 0000000000..38a2c86351 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-computed.html @@ -0,0 +1,34 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: getComputedStyle().mixBlendMode</title> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-mix-blend-mode"> +<meta name="assert" content="mix-blend-mode computed value is as specified."> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/computed-testcommon.js"></script> +</head> +<body> +<div id="target"></div> +<script> +test_computed_value("mix-blend-mode", "normal"); +test_computed_value("mix-blend-mode", "multiply"); +test_computed_value("mix-blend-mode", "screen"); +test_computed_value("mix-blend-mode", "overlay"); +test_computed_value("mix-blend-mode", "darken"); +test_computed_value("mix-blend-mode", "lighten"); +test_computed_value("mix-blend-mode", "color-dodge"); +test_computed_value("mix-blend-mode", "color-burn"); +test_computed_value("mix-blend-mode", "hard-light"); +test_computed_value("mix-blend-mode", "soft-light"); +test_computed_value("mix-blend-mode", "difference"); +test_computed_value("mix-blend-mode", "exclusion"); +test_computed_value("mix-blend-mode", "hue"); +test_computed_value("mix-blend-mode", "saturation"); +test_computed_value("mix-blend-mode", "color"); +test_computed_value("mix-blend-mode", "luminosity"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-invalid.html b/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-invalid.html new file mode 100644 index 0000000000..e73d28e585 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-invalid.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: parsing mix-blend-mode with invalid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-mix-blend-mode"> +<meta name="assert" content="mix-blend-mode supports only the grammar '<blend-mode>'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_invalid_value("mix-blend-mode", "auto"); +test_invalid_value("mix-blend-mode", "normal luminosity"); +test_invalid_value("mix-blend-mode", "normal, luminosity"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-valid.html b/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-valid.html new file mode 100644 index 0000000000..c6393343df --- /dev/null +++ b/testing/web-platform/tests/css/compositing/parsing/mix-blend-mode-valid.html @@ -0,0 +1,33 @@ +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>Compositing and Blending Level 1: parsing mix-blend-mode with valid values</title> +<link rel="author" title="Eric Willigers" href="mailto:ericwilligers@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing-1/#propdef-mix-blend-mode"> +<meta name="assert" content="mix-blend-mode supports the full grammar '<blend-mode>'."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/css/support/parsing-testcommon.js"></script> +</head> +<body> +<script> +test_valid_value("mix-blend-mode", "normal"); +test_valid_value("mix-blend-mode", "multiply"); +test_valid_value("mix-blend-mode", "screen"); +test_valid_value("mix-blend-mode", "overlay"); +test_valid_value("mix-blend-mode", "darken"); +test_valid_value("mix-blend-mode", "lighten"); +test_valid_value("mix-blend-mode", "color-dodge"); +test_valid_value("mix-blend-mode", "color-burn"); +test_valid_value("mix-blend-mode", "hard-light"); +test_valid_value("mix-blend-mode", "soft-light"); +test_valid_value("mix-blend-mode", "difference"); +test_valid_value("mix-blend-mode", "exclusion"); +test_valid_value("mix-blend-mode", "hue"); +test_valid_value("mix-blend-mode", "saturation"); +test_valid_value("mix-blend-mode", "color"); +test_valid_value("mix-blend-mode", "luminosity"); +</script> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-background-transparency-ref.html b/testing/web-platform/tests/css/compositing/root-element-background-transparency-ref.html new file mode 100644 index 0000000000..4671d44c1c --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-background-transparency-ref.html @@ -0,0 +1,7 @@ +<!doctype HTML> +<title>Backround color transparency on the root element blends with a white backdrop</title> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<html style="background: rgb(150, 150, 150)"> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-background-transparency.html b/testing/web-platform/tests/css/compositing/root-element-background-transparency.html new file mode 100644 index 0000000000..910eb08e8d --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-background-transparency.html @@ -0,0 +1,8 @@ +<!doctype HTML> +<title>Backround color transparency on the root element blends with a white backdrop</title> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<link rel="match" href="root-element-background-transparency-ref.html"> +<html style="background: rgba(45, 45, 45, 0.5)"> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-blend-mode-ref.html b/testing/web-platform/tests/css/compositing/root-element-blend-mode-ref.html new file mode 100644 index 0000000000..14c99f7085 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-blend-mode-ref.html @@ -0,0 +1,6 @@ +<!doctype HTML> +<title>Blend-mode on the root stacking context blends with the root element's background.</title> +<html style="background: #000"> + <div style="width: 50px; height: 50px; background: #000"></div> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-blend-mode.html b/testing/web-platform/tests/css/compositing/root-element-blend-mode.html new file mode 100644 index 0000000000..2c97d8b5e8 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-blend-mode.html @@ -0,0 +1,9 @@ +<!doctype HTML> +<title>Blend-mode on the root stacking context blends with the root element's background.</title> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<link rel="match" href="root-element-blend-mode-ref.html"> +<html style="background: #000;"> + <div style="width: 50px; height: 50px; background: #E33; mix-blend-mode: multiply"></div> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-filter-background-clip-text-crash.html b/testing/web-platform/tests/css/compositing/root-element-filter-background-clip-text-crash.html new file mode 100644 index 0000000000..e12e4bb80f --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-filter-background-clip-text-crash.html @@ -0,0 +1,15 @@ +<!doctype html> +<link rel=help href="https://bugzilla.mozilla.org/show_bug.cgi?id=1782303"> +<style> +* { + filter: sepia(1); + background-color: rgb(179, 31, 172); + background-clip: text; +} +</style> +<script> +document.addEventListener('DOMContentLoaded', () => { + a.data = "#" +}) +</script> +<object id="a"> diff --git a/testing/web-platform/tests/css/compositing/root-element-filter-ref.html b/testing/web-platform/tests/css/compositing/root-element-filter-ref.html new file mode 100644 index 0000000000..27cfb11b8f --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-filter-ref.html @@ -0,0 +1,8 @@ +<!doctype HTML> +<title>A filter on the root element applies to its background</title> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<html style="background: #FFF"> + <div style="width: 50px; height: 50px; background: #1CC"></div> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-filter.html b/testing/web-platform/tests/css/compositing/root-element-filter.html new file mode 100644 index 0000000000..62bde9dfd9 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-filter.html @@ -0,0 +1,9 @@ +<!doctype HTML> +<title>A filter on the root element applies to its background</title> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<link rel="match" href="root-element-filter-ref.html"> +<html style="filter: invert(1); background: #000"> + <div style="width: 50px; height: 50px; background: #E33"></div> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-opacity-change-ref.html b/testing/web-platform/tests/css/compositing/root-element-opacity-change-ref.html new file mode 100644 index 0000000000..be3d371369 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-opacity-change-ref.html @@ -0,0 +1,4 @@ +<!doctype HTML> +<html style="font-size: 200px"> +TEST +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-opacity-change.html b/testing/web-platform/tests/css/compositing/root-element-opacity-change.html new file mode 100644 index 0000000000..de2599de49 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-opacity-change.html @@ -0,0 +1,14 @@ +<!doctype HTML> +<html class="test-wait" style="font-size: 200px; opacity: 0.5"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<link rel="match" href="root-element-opacity-change-ref.html"> +<meta name="assert" content="View background should be white after opacity changes from 0.5 to 1"> +<script src="/common/rendering-utils.js"></script> +TEST +<script> +waitForAtLeastOneFrame().then(() => { + document.documentElement.style.opacity=1; + document.documentElement.classList.remove('test-wait'); +}); +</script> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-opacity-ref.html b/testing/web-platform/tests/css/compositing/root-element-opacity-ref.html new file mode 100644 index 0000000000..be2348ab96 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-opacity-ref.html @@ -0,0 +1,7 @@ +<!doctype HTML> +<title>Opacity on the root element blends with a white backdrop</title> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<html style="background: #DDD"> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/root-element-opacity.html b/testing/web-platform/tests/css/compositing/root-element-opacity.html new file mode 100644 index 0000000000..4885d805ad --- /dev/null +++ b/testing/web-platform/tests/css/compositing/root-element-opacity.html @@ -0,0 +1,8 @@ +<!doctype HTML> +<title>Opacity on the root element blends with a white background</title> +<link rel="author" title="Chris Harrelson" href="mailto:chrishtr@chromium.org"> +<link rel="help" href="https://drafts.fxtf.org/compositing/#pagebackdrop"> +<link rel="match" href="root-element-opacity-ref.html"> +<html style="background: #BBB; opacity: 0.5"> + <div id=spacer style="width: 100px; height: 3000px"></div> +</html> diff --git a/testing/web-platform/tests/css/compositing/support/plus-lighter.js b/testing/web-platform/tests/css/compositing/support/plus-lighter.js new file mode 100644 index 0000000000..a5d1a34d7f --- /dev/null +++ b/testing/web-platform/tests/css/compositing/support/plus-lighter.js @@ -0,0 +1,47 @@ +import { clamp01, multiplyAlpha, unmultiplyAlpha } from "./utils.js"; + +export function plusLighter(pixels) { + if (pixels.length === 1) return pixels[0]; + + return pixels.reduce((destination, source) => { + const premultipliedSource = multiplyAlpha(source); + const premultipliedDestination = multiplyAlpha(destination); + const premultipliedResult = premultipliedDestination.map((channel, i) => + clamp01(channel + premultipliedSource[i]) + ); + return unmultiplyAlpha(premultipliedResult); + }); +} + +export const tests = [ + // Each test is a list of colors to composite. + // Each color is [r, g, b, a], unmultiplied, in the range 0-1. + [ + [1, 0, 0, 0.5], + [0, 0, 1, 0.5], + ], + [ + [1, 0, 0, 0.25], + [0, 0, 1, 0.25], + ], + [ + [0.5, 0, 0, 0.5], + [0, 0, 1, 0.5], + ], + // Test clamping + [ + [1, 0, 0, 1], + [0, 0, 1, 1], + ], + // Test more than two elements + [ + [1, 0, 0, 0.25], + [0, 0, 1, 0.25], + [0, 1, 0, 0.25], + [0.5, 0.4, 0.25, 0.25], + ], + // Test a single element + [ + [0.5, 0, 0, 0.25], + ], +]; diff --git a/testing/web-platform/tests/css/compositing/support/utils.js b/testing/web-platform/tests/css/compositing/support/utils.js new file mode 100644 index 0000000000..eb369ce2e5 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/support/utils.js @@ -0,0 +1,31 @@ +export function multiplyAlpha(pixel) { + return pixel.map((channel, i) => { + // Pass the alpha channel through unchanged + if (i === 3) return channel; + // Otherwise, multiply by alpha + return channel * pixel[3]; + }); +} + +export function unmultiplyAlpha(pixel) { + return pixel.map((channel, i) => { + // Pass the alpha channel through unchanged + if (i === 3) return channel; + // Avoid divide-by-zero + if (pixel[3] === 0) return channel; + // Divide by alpha + return channel / pixel[3]; + }); +} + +export function clamp01(value) { + if (value < 0) return 0; + if (value > 1) return 1; + return value; +} + +const toPercent = (num) => `${num * 100}%`; +export const toCSSColor = (pixel) => + `rgb(${toPercent(pixel[0])} ${toPercent(pixel[1])} ${toPercent(pixel[2])} / ${ + pixel[3] + })`; diff --git a/testing/web-platform/tests/css/compositing/svg/mix-blend-mode-in-svg-image.html b/testing/web-platform/tests/css/compositing/svg/mix-blend-mode-in-svg-image.html new file mode 100644 index 0000000000..ed0520e443 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/svg/mix-blend-mode-in-svg-image.html @@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Compositing and Blending: mix-blend-mode in an SVG linked as an image</title> + <link rel="author" title="Rik Cabanier" href="mailto:cabanier@adobe.com""> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#isolation"> + <link rel="reviewer" title="Dirk Schulze" href="mailto:dschulze@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_SVG"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="flags" content="svg"> + <link rel="match" href="reference/mix-blend-mode-in-svg-image-ref.html"> + </head> + <body> + <p>There should be a green rectangle on the screen. <br> + Test passes if you see a green rectangle.</p> + <img src="support/green_square_blending.svg"/> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/svg/mix-blend-mode-svg-rectangle.html b/testing/web-platform/tests/css/compositing/svg/mix-blend-mode-svg-rectangle.html new file mode 100644 index 0000000000..543586f098 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/svg/mix-blend-mode-svg-rectangle.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Test: mix-blend-mode for a simple SVG element - rectangle</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <link rel="reviewer" title="Mihai Balan" href="mailto:mibalan@adobe.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_SVG"> + <link rel="help" href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode"> + <meta name="flags" content="svg"> + <link rel="match" href="reference/mix-blend-mode-svg-rectangle-ref.html"> + </head> + <body> + <!-- The white background is to prevent alpha-blending differences in Chrome + for the antialiased pixels of the text. --> + <p style="background: white">There should be no red rectangle on the screen. <br> + Test passes if you see a black rectangle.</p> + <svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="400px" height="400px" > + <rect x="0" y="0" width="100" height="100" fill="aqua"/> + <rect x="0" y="0" width="100" height="100" fill="red" style="mix-blend-mode: multiply"/> + </svg> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/svg/reference/mix-blend-mode-in-svg-image-ref.html b/testing/web-platform/tests/css/compositing/svg/reference/mix-blend-mode-in-svg-image-ref.html new file mode 100644 index 0000000000..9a2a030737 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/svg/reference/mix-blend-mode-in-svg-image-ref.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <style> + div { + width: 100px; + height:100px; + background-color: #0F0; + } + </style> + </head> + <body> + <p>There should be a green rectangle on the screen. <br> + Test passes if you see a green rectangle.</p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/svg/reference/mix-blend-mode-svg-rectangle-ref.html b/testing/web-platform/tests/css/compositing/svg/reference/mix-blend-mode-svg-rectangle-ref.html new file mode 100644 index 0000000000..94e73b57c9 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/svg/reference/mix-blend-mode-svg-rectangle-ref.html @@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>CSS Reftest Reference</title> + <link rel="author" title="Mirela Budăeș" href="mailto:mbudaes@adobe.com"> + <style> + p { + background: white; + } + div { + width: 100px; + height:100px; + background-color: black;/*rgb(0,0,0);*/ + } + </style> + </head> + <body> + <p>There should be no red rectangle on the screen. <br> + Test passes if you see a black rectangle.</p> + <div></div> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/svg/support/green_square_blending.svg b/testing/web-platform/tests/css/compositing/svg/support/green_square_blending.svg new file mode 100644 index 0000000000..19d61e27fe --- /dev/null +++ b/testing/web-platform/tests/css/compositing/svg/support/green_square_blending.svg @@ -0,0 +1,3 @@ +<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> + <rect width="100" height="100" style="fill:rgb(0,255,0);mix-blend-mode: difference;"/> +</svg> diff --git a/testing/web-platform/tests/css/compositing/test-plan/css-blending-test-plan-proposal.html b/testing/web-platform/tests/css/compositing/test-plan/css-blending-test-plan-proposal.html new file mode 100644 index 0000000000..c82a543a4e --- /dev/null +++ b/testing/web-platform/tests/css/compositing/test-plan/css-blending-test-plan-proposal.html @@ -0,0 +1,1616 @@ + +<!DOCTYPE html> +<html> + <head> + <title>Compositing and Blending test plan</title> + <meta charset='utf-8'> + <script src='http://www.w3.org/Tools/respec/respec-w3c-common' + async class='remove'></script> + <script class='remove'> + var respecConfig = { + specStatus: "unofficial", + shortName: "css3-blending-test-plan", + editors: [ + { + name: "Mirela Budaes", + company: "Adobe Systems, Inc.", + companyURL: "http://www.adobe.com/" + }, + { + name: "Horia Olaru", + company: "Adobe Systems, Inc.", + companyURL: "http://www.adobe.com/" + }, + { + name: "Mihai Tica", + company: "Adobe Systems, Inc.", + companyURL: "http://www.adobe.com/" + }, + + ] + }; + </script> + <style> + table + { + border-collapse:collapse; + } + table, td, th + { + border:1px solid black; + padding: 13px; + } + table + { + width: 100%; + } + img + { + width: 400px; + } + </style> + </head> + <body> + <section id='abstract'> + <p> + This document is intended to be used as a guideline for the testing + activities related to the Compositing and Blending spec [[!compositing-1]]. Its main + goal is to provide an overview of the general testing areas and an informative + description of possible test cases. + </p> + <p> + This document is not meant to replace the spec in determining the + normative and non-normative assertions to be tested, but rather + complement it. + </p> + </section> + <section> + <h2>Goals</h2> + <section> + <h3>Providing guidance on testing</h3> + <p> + In order to increase the quality of the test contributions, this + document offers a set of test cases description for conducting testing (see + <a href="#test-cases-description" class="sectionRef"></a>). + </p> + </section> + <section> + <h3>Creating automation-friendly tests</h3> + <p> + In terms of actual tests produced for the CSS Compositing and Blending, the main goal + is to ensure that most tests are automatable (i.e. they're either + reftests or use <code>testharness.js</code>). Even where manual tests + are absolutely necessary they should be written so that they can be + easily automated – as there are on-going efforts to make + WebDriver [[webdriver]] automated tests a first class citizen in W3C + testing. This means that even if a manual test requires user + interaction, the validation or PASS/FAIL conditions should still be + clear enough as to allow automatic validation if said interaction is + later automated. + </p> + </section> + </section> + <section> + <h2>Approach</h2> + <p> + Since CSS blending has only three new CSS properties, + the approach is to deep dive into every aspect of the spec as much as possible. + + Tests will be created for the testing areas listed in <a href="#testig-areas" class="sectionRef"></a> + and having as guidance the test cases description from <a href="#test-cases-description" class="sectionRef"></a>. + </p> + </section> + <section> + <h2>Testing areas</h2> + <section> + <h3>Explicit testing areas</h3> + <p> + These testing areas cover things explicitly defined in the normative sections of the Blending and Compositing spec. Please note that while detailed, this list is not necessarily + exhaustive and some normative behaviors may not be contained in it. + When in doubt, consult the Blending and Compositing spec or ask a question on the + <a href="http://lists.w3.org/Archives/Public/www-style/">mailing + list</a>. + </p> + <p>Below is the list of explicit testing areas:</p> + <ol> + <li>Proper parsing of the CSS properties and rendering according to the spec + <ul><code>mix-blend-mode</code></ul> + <ul><code>isolation</code></ul> + <ul><code>background-blend-mode</code></ul> + </li> + <li>SVG blending</li> + <li>Canvas 2D blending</li> + </ol> + </section> + <section> + <h3>Implicit testing areas</h3> + <p> + These are testing areas either normatively defined in other specs + that explicitly refer to the Blending and Compositing spec (e.g. [[!css3-transforms]]) + or simply not explicitly defined, but implied by various aspects of + the spec (e.g. processing model, CSS 2.1 compliance, etc.). + Please note that while detailed, this list is not necessarily + exhaustive and some normative behaviors may not be contained in it. + When in doubt, consult the Blending and Compositing spec or ask a question on the + <a href="http://lists.w3.org/Archives/Public/www-style/">mailing + list</a>. + </p> + <p>Below is the list of implicit testing areas:</p> + <ol> + <li>Blending different types of elements + <ul> + <li><code><video></code></li> + <li><code><canvas></code></li> + <li><code><table></code></li> + </ul> + </li> + <li>Blending elements with specific style rules applied + <ul> + <li><code>transforms</code></li> + <li><code>transitions</code> </li> + <li><code>animations</code> </li> + </ul> + </li> + </ol> + </section> + </section> + <section> + <h2>Test cases description</h2> + <section> + <h3>Test cases for <code>mix-blend-mode</code></h3> + <p> + The following diagram describes a list of notations to be used later on in the document as well as the general document structure the test cases will follow. The test cases should not be limited to this structure. This should be a wireframe and people are encouraged to come up with complex test cases as well. + </p> + <p> + <img id="test_outline" src="test_template.png" alt="Mix-blend-mode sample elements"> + </p> + <p>The intended structure of the document is the following:</p> + <pre> +<body> + <div id="[P]"> + <div id="[IN-S]"></div> + <div id="[IN-P]"> + <div id="[B]"> + <div id="[CB]"></div> + </div> + </div> + </div> +</body> + </pre> + <p> Unless otherwise stated, test cases assume the following properties for the elements: <br> + <ul> + <li> default value for the <code>background-color</code> of the <code>body</code></li> + <li> <code>background-color</code> set to a fully opaque color for all the other elements </li> + </ul> + </p> + <p>The CSS associated to the elements used in the tests shouldn't use properties that creates a stacking context, except the ones specified in the test case descriptions.</p> + <p>Every test case has a description of the elements used. The notation from the image is used in the test case description too (e.g. for parent element the notation is [P]). Each test case uses only a subset of the elements while the other elements should just be removed. + </p></p> + <section> + <h4>An element with <code>mix-blend-mode</code> other than normal creates a stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a>: <q>Applying a blendmode other than ‘normal’ to the element must establish a new stacking context [CSS21].</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Simple <code><div></td> + <td>1 element required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td> + <td>The element [B] creates a stacking context</td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> blends with the content within the current stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q> </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending simple elements </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the parent element [P] mixes with the color of the child element [B].</td> + </tr> + <tr> + <td>Blending <code><video></code></td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><video></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) visually overlaping the <code><video></code> element <br> + [IN-S] has some text inside + </td> + <td>The content of the <code>video</code> element [B] mixes with the colors of the sibling element and the text from [IN-S].</td> + </tr> + <tr> + <td>Blending with a sibling</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling of the element [B] <br> + The [IN-S] element visually overlaps the [B] element + </td> + <td>The colors of the parent element [P] and the sibling element [IN-S] mixes with the color of the blended element [B].</td> + </tr> + <tr> + <td>Blending with two levels of ascendants</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-P] - Intermediate child element between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B].</td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> doesn't blend with anything outside the current stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q> An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending child overflows the parent</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + The blending element [B] has content that lies outside the parent element. <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default</td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code></td> + </tr> + <tr> + <td>Parent with transparent pixels</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + The element has some text inside and default value for <code>background-color</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + The <code>background-color</code> of the <code>body</code> has a value other than default</td> + <td>The color of the text from the parent element [P] mixes with the color of the child element [B]. <br> + No blending between the color of the <code>body</code> and the color of the blending element [B]. + </td> + </tr> + <tr> + <td>Parent with <code>border-radius</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>border-radius</code> specified (e.g.50%). <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [B] has content that lies outside the parent element, over a rounded corner. <br> + The <code>background-color</code> of the <code>body</code> has a value other than default. </td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element which draws over the rounded corner doesn't mix with the color of the <code>body</code></td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> other than normal must cause a group to be isolated</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation" >spec</a>: <q>operations that cause the creation of stacking context [CSS21] must cause a group to be isolated.</q> </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Child of the blended element has opacity</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [CB] - child of the element [B] with <code>opacity</code> less than one. </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]</td> + </tr> + <tr> + <td>Overflowed child of the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [CB] - child of the element [B] with content that lies outside the parent element [B]. + </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. There is only one color for the entire element [CB] </td> + </tr> + <tr> + <td>Blended element with transparent pixels</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transparent <code>background-color</code> <br> + [CB] - child of the element [B] + </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. </td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> must work properly with css transforms</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Parent with 3D transform</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed + </td> + </tr> + <tr> + <td>Blended element with 3D transform</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code> <br> + [CB] - child of the element [B] </td> + <td> The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed </td> + </tr> + <tr> + <td>Both parent and blended element with 3D transform</td> + <td> 2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code> + </td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The elements (and the content) of the elements [P] and [B] are properly transformed</td> + </tr> + <tr> + <td>Blended element with transform and preserve-3d</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>transform-style:preserve-3d</code> <br> + [CB] - child of the element [B]. It has 3D transform property</td> + <td> The child element [CB] will NOT preserve its 3D position. <br> + <code>mix-blend-mode</code> override the behavior of <code>transform-style:preserve-3d</code>: + creates a flattened representation of the descendant elements <br> + The color of the group created by the child elements([B] and [CB]) will blend with the color of the parent element [P] </td> + </tr> + <tr> + <td>Blended element with transform and perspective</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>perspective</code> set to positive length </td> + <td>The colors of the parent and the child are mixed ([P] and [B]) <br> + The element (and the content) of the element [B] is properly transformed + </td> + </tr> + <tr> + <td>Sibling with 3D transform between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling(of the element [B]) with <code>3D transform</code> between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br> + The element (and the content) of the element [IN-S] is properly transformed + </td> + </tr> + <tr> + <td>Parent with 3D transform and transition</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> and transition <br> + [B] - element with <code>mix-blend-mode</code> other than normal + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed + </td> + </tr> + <tr> + <td>Sibling with 3D transform(and transition) between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) with <code>3D transform</code> and transition between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br> + The element (and the content) of the element [IN-S] is properly transformed + </td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> must work properly with elements with <code>overflow</code> property</h4> + <table> + <tr> + <td>Parent element with <code>overflow:scroll</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:scroll</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal tat overflows the parents [P] dimensions so that it creates scrolling for the parent + <td>The color of the parent element [P] mixes with the color of the child element [B]. <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Blended element with <code>overflow:scroll</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:scroll</code> and a child element that creates overflow for [B]</td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Parent element with <code>overflow:scroll</code> and blended with <code>position:fixed</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:scroll</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>position:fixed</code> and should overflow the parents [P] dimensions so that it creates scrolling for the parent</td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The blending happens when scrolling the content of the parent element [P] too. <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Parent with <code>overflow:hidden</code> and <code>border-radius</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%) <br> + [B] - element with <code>mix-blend-mode</code> other than normal with content that lies outside the parent element, over a rounded corner <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default.</td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element which draws over the rounded corner is properly cut </td> + </tr> + <tr> + <td>Blended element with <code>overflow:hidden</code> and <code>border-radius</code></td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%). <br> + [CB] - child of the element [B], with content that lies outside the parent element, over a rounded corner. <br> </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. <br> + [CB] is properly clipped so no overflow is visible.</td> + </tr> + <tr> + <td>Intermediate child with <code>overflow:hidden</code> and <code>border-radius</code> between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal that overflows the parents [IN-P] dimensions + [IN-P] - child(of the element [P]) with <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%) + </td> + <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B]. <br> + [B] is is properly clipped so no overflow is visible + </td> + </tr> + </table> + </section> + <section> + <h4>Other test cases</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blended element with <code>border-image</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>border-image</code> specified as a png file + </td> + <td>The color of the parent element [P] mixes with the color of the child element. <br> + The color of the <code>border-image</code> mixes with the color of the parent element [P]. + </td> + </tr> + <tr> + <td>Blending with <code><canvas></code> </td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><canvas></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling of the <code><canvas></code> element with some text <br> + The [IN-S] element overlaps the <code><canvas></code> element + </td> + <td>The content of the <code><canvas></code> element mixes with the color of the sibling element and the text [IN-S].</td> + </tr> + <tr> + <td>Blended <code><canvas></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - Child <code><canvas></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><canvas></code> element [B] mixes with the color of the parent element [P] .</td> + </tr> + <tr> + <td>Blended <code><video></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><video></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><video></code> element mixes with the color of the parent element [P] .</td> + </tr> + <tr> + <td>Blending with <code><iframe></code> </td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><iframe></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) with some text <br> + The [IN-S] element visually overlaps the <code><iframe></code> element + </td> + <td>The color of the <code><iframe></code> element mixes with the color of the sibling element and the text [IN-S].</td> + </tr> + <tr> + <td>Blended <code><iframe></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><iframe></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><iframe></code> element [B] mixes with the color of the parent element [P]. </td> + </tr> + <tr> + <td>Blended element with <code>mask</code> property</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>mask</code> property specified to an SVG image (e.g. circle)</td> + <td>The colors of the parent and the masked child are mixed ([P] and [B])</td> + </tr> + <tr> + <td>Blended element with <code>clip-path</code> property </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>clip-path</code> property specified to a basic shape (e.g. ellipse)</td> + <td>The colors of the parent and the clipped child are mixed ([P] and [B])</td> + </tr> + <tr> + <td>Blended element with <code>filter</code> property</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>filter</code> property value other than none </td> + <td>The filter is applied and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Blended element with <code>transition</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>transition-property</code> for <code>opacity</code> </td> + <td>The transition is applied and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Blended element with <code>animation</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>animation</code> specified</td> + <td>The animation is applied to the child element and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Image element</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><img></code> element (.jpeg or .gif image) with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the <code><img></code> is mixed with the color of the <code><div></code>.</td> + </tr> + <tr> + <td>SVG element</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - SVG element with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the SVG is mixed with the color of the <code><div></code>.</td> + </tr> + <tr> + <td>Paragraph element</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - paragraph element with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the text from the paragraph element is mixed with the color of the <code><div></code></td> + </tr> + <tr> + <td>Paragraph element and background-image</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + and <code>background-image</code> <br> + [B] - Child <code>p</code> element with some text and <code>mix-blend-mode</code> other than normal</td> + <td>The color of the text from the <code>p</code> element is mixed with the background image of the <code><div></code>.</td> + </tr> + <tr> + <td>Set blending from JavaScript</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - Child <code><div></code> element with no <code>mix-blend-mode</code> specified<br> + From JavaScript, set the <code>mix-blend-mode</code> property for the child <code><div></code> to a value other than normal</td> + <td>The colors of the <code><div></code> elements are mixed.</td> + </tr> + </table> + </section> + </section> + <section> + <h3>Test cases for SVG elements with <code>mix-blend-mode</code></h4> + <section> + <h4><code>mix-blend-mode</code> with simple SVG graphical elements</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a> : <q><code>mix-blend-mode</code> applies to svg, g, use, image, path, rect, circle, ellipse, line, polyline, polygon, text, tspan, and marker.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Circle with SVG background</td> + <td>Set a background color for the SVG.<br> + Create 16 <code>circle</code> elements and fill them with a solid color. + <br>Apply each <code>mix-blend-mode</code> on them.</td> + <td>The color of the <code>circle</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Ellipse with SVG background</td> + <td>Set a background color for the SVG.<br> + Create an <code>ellipse</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>ellipse</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Image with SVG background</td> + <td>Set a background color for the SVG. + <br>Create an <code>image</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td> + <td>The <code>image</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Line with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>line</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>line</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Path with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>path</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>path</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Polygon with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>polygon</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>polygon</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Polyline with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>polyline</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>polyline</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Rect with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>rect</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Text with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>text</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td> + <td>The text is mixed with the color of the background.</td> + </tr> + <tr> + <td>Text having tspan with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>text</code> element and a <code>tspan</code> inside it. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>tspan</code>.</td> + <td>The text is mixed with the color of the background.</td> + </tr> + <tr> + <td>Gradient with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a <code>gradient</code>. + <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td> + <td>The gradient is mixed with the color of the background.</td> + </tr> + <tr> + <td>Pattern with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a <code>pattern</code>. + <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td> + <td>The pattern is mixed with the color of the background.</td> + </tr> + <tr> + <td>Set blending on an element from JavaScript</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from JavaScript.</td> + <td>The color of the <code>rect</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Marker with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>line</code> element containing a marker. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The marker color is mixed with the color of the background.</td> + </tr> + <tr> + <td>Metadata with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>metadata</code> element containing an embedded pdf. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The metadata content is not mixed with the color of the background.</td> + </tr> + <tr> + <td>ForeignObject with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>foreignObject</code> element containing a simple xhtml file. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The foreignObject content is not mixed with the color of the background.</td> + </tr> + </table> + </section> + <section> + <h4><code>mix-blend-mode</code> with SVG groups</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Group of overlapping elements with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group.</td> + <td>The <code>group</code> is mixed as a whole with the color of the background.</td> + </tr> + </table> + </section> + <section> + <h4><code>mix-blend-mode</code> with isolated groups</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a>: + <br><q>By default, every element must create a non-isolated group.<br> + However, certain operations in SVG will create isolated groups.<br> + If one of the following features is used, the group must become isolated: + <ul> + <li>opacity</li> + <li>filters</li> + <li>3D transforms (2D transforms must NOT cause isolation)</li> + <li>blending</li> + <li>masking</li> + </ul> + </q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending two elements in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td> + <td>Only the intersection of the <code>rect</code> elements should mix.</td> + </tr> + <tr> + <td>Blending in a group with opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with filter</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>filter</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with 2D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>transform</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with 3D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a 3d transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with a mask</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>mask</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with mix-blend-mode</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </table> + </section> + <section> + <h4>Other test cases for SVG</h4> + <table> + <tr> + <td>Blend with element having opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke-opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke</code>, <code>stroke-opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke-dasharray</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke-dasharray</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having transform</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>transform</code> (any combination of <code>translate</code>, <code>rotate</code>, <code>scale</code>, <code>skew</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with SVG having viewbox and preserveAspectRatio set</td> + <td>Set a background color for the SVG, as well as <code>viewbox</code> and <code>preserveAspectRatio</code>.<br> + Create a <code>rect</code> element filled with a different solid color and apply a <code>mix-blend-mode</code> other than <code>normal</code> on it.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having color-profile set</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>color-profile</code> (<code>sRGB</code>, for example) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having overflow</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> larger than the SVG.<br> + Apply <code>overflow</code> (<code>visible</code>, <code>hidden</code>, <code>scroll</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having clip-path</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>clip-path</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having a mask</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element.<br> + Apply a <code>mask</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having a filter</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element.<br> + Apply a <code>filter</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an animated element</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply an <code>animateTransform</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Set blending from an SVG script element</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element and fill it with a solid color.<br> + Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from an svg <code>script</code> element.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + </table> + </section> + </section> + <section> + <h3>Test cases for <code>background-blend-mode</code></h3> + <section> + <h4>Blending between the background layers and the background color for an element with <code>background-blend-mode</code> </h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Each background layer must blend with the element's background layer that are below it and the element's background color.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Images with different formats</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + Tests should be created for <code><image></code> with different formats such as PNG, JPEG or SVG + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Gradient and background color</td> + <td> + Element with + <ul> + <li><code>background-image</code> set to an <code><gradient></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Image and gradient</td> + <td> + Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> on top of a <code><gradient></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code><image></code> is mixed with the content of the <code><gradient></code> + </td> + </tr> + <tr> + <td>Gradient and image</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code><gradient></code> on top of an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code><image></code> is mixed with the content of the <code><gradient></code></td> + </tr> + <tr> + <td>Two gradients</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code><gradient></code> on top of another <code><gradient></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul></td> + <td>The content of the two gradients is mixed</td> + </tr> + <tr> + <td>Two images</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> on top of another <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul></td> + <td>The content of the two images is mixed</td> + </tr> + <tr> + <td>Image and background color with transparency</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> with transparency(e.g. PNG images)</li> + <li><code>background-color</code> set to a transparent color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Cross-fade image and gradient</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <q>cross-fade()</q> image on top of a <code><gradient></code> </li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the cross-faded image is mixed with the content of the <code><gradient></code></td> + </tr> + <tr> + <td>SVG image and background color</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a data URI for an SVG image </li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + <tr> + <td>Animated gif image and background color</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an animated gif image</li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + <tr> + <td>Set <code>background-blend-mode</code> from JavaScript</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code>gradient</code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li>no <code>background-blend-mode</code> explicitly specified</li> + From JavaScript, set the <code>background-blend-mode</code> property to a value other than normal. + </ul> + </td> + <td>The content of the gradient is mixed with the color of the background</td> + </tr> + <tr> + <td><code>background-blend-mode</code> on element with 3D transform</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + <li><code>transform</code> set to a 3D function like rotateX, rotateY or translateZ</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + </table> + </section> + <section> + <h4>Background layers do not blend with content outside the background (or behind the element)</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Background layer must not blend with the content that is behind the element instead they must act as if they are rendered into an isolated group.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>One background layer</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The <code>background-image</code> is not mixed with anything outside the element</td> + </tr> + <tr> + <td>Two elements</td> + <td>2 elements required: a parent element with a child. <br> + Each one with the following properties: + <ul> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + <td>No blending between the background colors of the two elements</td> + </tr> + <tr> + <td>Parent and child with <code>background-blend-mode</code></td> + <td>2 elements required: a parent element with a child <br> + Parent properties: <br> + <ul> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + Child properties: <br> + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + <td>The content of the image from the child element does not mixes with the background color from the parent element</td> + </tr> + </table> + </section> + <section> + <h4> <code>background-blend-mode</code> list values apply to the corresponding background layer</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>The ‘background-blend-mode’ list must be applied in the same order as ‘background-image’[CSS3BG]. This means that the first element in the list will apply to the layer that is on top.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Different blend modes applied between layers</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image-list></code> containing three images: (e.g. I1, I2 and I3 ) </li> + <li><code>background-blend-mode</code> set to different <code>blendmode</code> for every image: (e.g. multiply, difference, screen) </li> + </ul></td> + <td>The content of the three images is correctly mixed <br> + (multiply for I1, difference for I2 and screen for I3) + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> list values are repeated if the list is shorter than the background layer list</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If a property doesn't have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blend mode list repeat</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image-list></code> containing three images</li> + <li><code>background-blend-mode</code> set to two different <code>blendmode</code> values</li> + </ul></td> + <td>The unspecified blend modes should be obtained by repeating the blend mode list from the beginning</td> + </tr> + </table> + </section> + <section> + <h4>The default <code>background-blend-mode</code> value for the <code>background</code> shorthand is 'normal' </h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If the ‘background’ [CSS3BG] shorthand is used, the ‘background-blend-mode’ property for that element must be reset to its initial value.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Default blend mode for 'background' shorthand</td> + <td>Element with + <ul> + <li><code>background</code> property set to an image and a color</li> + <li>No value explicitly set for <code>background-blend-mode</code> </li> + </ul></td> + <td> The computed value of <code>background-blend-mode</code> is 'normal' + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-position</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-position</code> percentage</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-position</code> specified in percentage, such as 50% 50%</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> is correctly positioned + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-size</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Background size defined in pixels</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> specified in pixels</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size defined in percentage (second phase)</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> specified in percentage</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size cover</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> set to <code>cover</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size contain</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> set to <code>contain</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-repeat</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-repeat</code> set to no-repeat</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>no-repeat</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> is not repeated + </td> + </tr> + <tr> + <td><code>background-repeat</code> set to space</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>space</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + </td> + </tr> + <tr> + <td><code>background-repeat</code> set to round</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>round</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-clip</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-clip</code> set to <code>padding-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-clip</code> set to <code>padding-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + No background is drawn below the border (background extends to the outside edge of the padding) + </td> + </tr> + <tr> + <td><code>background-clip</code> set to <code>content-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-clip</code> set to <code>content-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background is painted within (clipped to) the content box + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-origin</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-origin</code> set to <code>border-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-origin</code> set to <code>border-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background extends to the outside edge of the border (but underneath the border in z-ordering) + </td> + </tr> + <tr> + <td><code>background-origin</code> set to <code>content-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-origin</code> set to <code>content-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background is painted within (clipped to) the content box + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-attachement</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-attachment</code> set to <code>fixed</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-attachment</code> set to <code>fixed</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background image will not scroll with its containing element, instead remaining stationary within the viewport + </td> + </tr> + <tr> + <td>2 background images with <code>background-attachment</code> set to <code>fixed, scroll</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to 2 <code><image></code>(s)</li> + <li><code>background-attachment</code> set to <code>fixed, scroll</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The background images will be mixed when they overlap while scrolling + </td> + </tr> + </table> + </section> + </section> + <section> + <h3>Test cases for <code>isolation</code></h3> + <section> + <h4>An element with <code>isolation:isolate</code> creates a stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>For CSS, setting ‘isolation’ to ‘isolate’ will turn the element into a stacking context [CSS21].</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation isolate</td> + <td>Have an element with <code>isolation</code> set to <code>isolate</code></td> + <td>The element creates a stacking context.</td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>isolation:isolate</code> creates an isolated group for blended children</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation of blended child which overflows</td> + <td>3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + This element has <code>isolation:isolate</code> set.<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br> + The blending element [B] has content that lies outside the parent element. <br> + </td> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + The area of the child element outside of the intermediate parent element does not mix with the color of the parent element [P], or of the <code>body</code>. + </td> + </tr> + <tr> + <td>Isolation on intermediate element with transparent pixels</td> + <td>3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); the element <code>background-color</code> is other than <code>transparent</code><br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + The intermediate element has text content, default value for <code>background-color</code> and <code>isolation:isolate</code> set<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</d <br> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + There is no blending between the color of the parent element [P] and the color of the blended element [B]. + </td> + </tr> + <tr> + <td>Isolate inside a stacking context created by a 3d transform</td> + <td> + 3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a <code>3D transform</code> applied<br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + The intermediate element has <code>isolation:isolate</code> set<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code><br> + </td> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + There is no blending between the color of the parent element [P] and the color of the blended element [B]. + </td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>isolation:auto</code> set does not change the elements existing stacking context behavior</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation auto</td> + <td>Have an element with <code>isolation</code> explicitly set to <code>auto</code>, and no other style that would create a stacking context</td> + <td>The element does not create a stacking context - the computed value of its <code>z-index</code> is value <code>auto</code></td> + </tr> + <tr> + <td>Stacking context not affected by isolation</td> + <td>2 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); This element has <code>isolation</code> explicitly set to <code>auto</code> <br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br> + The blending element [B] has content that lies outside the parent element. <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default + </td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code>.<br> + In other words, setting the <code>isolation</code> to <code>auto</code> does not affect the creation of a stacking context by other properties. + </td> + </tr> + </table> + </section> + </section> + <section> + <h4>Test cases for <code>isolation</code> in SVG</h4> + <section> + <h4>In SVG, an element with <code>isolation:isolate</code> creates an isolated group for blended children</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation">spec</a>: <q>In SVG, this defines whether an element is isolated or not.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending two elements in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br> + Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td> + <td>Only the intersection of the <code>rect</code> elements should mix.</td> + </tr> + <tr> + <td>Blending in an isolated group with 2D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:isolate</code> and 2D transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Set isolation on an element from JavaScript</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color and a <code>mix-blend-mode</code> other than <code>normal</code>. + <br>Apply <code>isolation:isolate</code> on it from JavaScript.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </table> + </section> + <section> + <h4>In SVG, an element with <code>isolation:auto</code> set does not change the rendering behaviour</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending a group with <code>isolation:auto</code></td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The element will mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 and <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </table> + </section> + </section> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/test-plan/test-plan.html b/testing/web-platform/tests/css/compositing/test-plan/test-plan.html new file mode 100644 index 0000000000..4a18cbe798 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/test-plan/test-plan.html @@ -0,0 +1,1819 @@ +<!DOCTYPE html> +<html lang="en" dir="ltr" typeof="bibo:Document " about="" property="dcterms:language" content="en" prefix="bibo: http://purl.org/ontology/bibo/ w3p: http://www.w3.org/2001/02pd/rec54#"><head> + <title>Compositing and Blending Test Plan</title> + <meta charset="utf-8"> + + + <style> + table + { + border-collapse:collapse; + } + table, td, th + { + border:1px solid black; + padding: 13px; + } + table + { + width: 100%; + } + img + { + width: 400px; + } + </style> + <style>/***************************************************************** + * ReSpec 3 CSS + * Robin Berjon - http://berjon.com/ + *****************************************************************/ + +/* --- INLINES --- */ +em.rfc2119 { + text-transform: lowercase; + font-variant: small-caps; + font-style: normal; + color: #900; +} + +h1 acronym, h2 acronym, h3 acronym, h4 acronym, h5 acronym, h6 acronym, a acronym, +h1 abbr, h2 abbr, h3 abbr, h4 abbr, h5 abbr, h6 abbr, a abbr { + border: none; +} + +dfn { + font-weight: bold; +} + +a.internalDFN { + color: inherit; + border-bottom: 1px solid #99c; + text-decoration: none; +} + +a.externalDFN { + color: inherit; + border-bottom: 1px dotted #ccc; + text-decoration: none; +} + +a.bibref { + text-decoration: none; +} + +cite .bibref { + font-style: normal; +} + +code { + color: #ff4500; +} + +/* --- TOC --- */ +.toc a, .tof a { + text-decoration: none; +} + +a .secno, a .figno { + color: #000; +} + +ul.tof, ol.tof { + list-style: none outside none; +} + +.caption { + margin-top: 0.5em; + font-style: italic; +} + +/* --- TABLE --- */ +table.simple { + border-spacing: 0; + border-collapse: collapse; + border-bottom: 3px solid #005a9c; +} + +.simple th { + background: #005a9c; + color: #fff; + padding: 3px 5px; + text-align: left; +} + +.simple th[scope="row"] { + background: inherit; + color: inherit; + border-top: 1px solid #ddd; +} + +.simple td { + padding: 3px 10px; + border-top: 1px solid #ddd; +} + +.simple tr:nth-child(even) { + background: #f0f6ff; +} + +/* --- DL --- */ +.section dd > p:first-child { + margin-top: 0; +} + +.section dd > p:last-child { + margin-bottom: 0; +} + +.section dd { + margin-bottom: 1em; +} + +.section dl.attrs dd, .section dl.eldef dd { + margin-bottom: 0; +} +</style><link rel="stylesheet" href="https://www.w3.org/StyleSheets/TR/w3c-unofficial"><!--[if lt IE 9]><script src='https://www.w3.org/2008/site/js/html5shiv.js'></script><![endif]--></head> + <body class="h-entry" style="" role="document" id="respecDocument"><div class="head" role="contentinfo" id="respecHeader"> + <p> + + </p> + <h1 class="title p-name" id="title" property="dcterms:title">Compositing and Blending Test Plan</h1> + + <h2 property="dcterms:issued" datatype="xsd:dateTime" content="2013-12-03T10:52:36.000Z" id="unofficial-draft-03-december-2013">Unofficial Draft <time class="dt-published" datetime="2013-12-03">03 December 2013</time></h2> + <dl> + + + + + + + + <dt>Editors:</dt> + <dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Mirela Budaes</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.adobe.com/">Adobe Systems, Inc.</a></span> +</dd> +<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Horia Olaru</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.adobe.com/">Adobe Systems, Inc.</a></span> +</dd> +<dd class="p-author h-card vcard" rel="bibo:editor" inlist=""><span typeof="foaf:Person"><span property="foaf:name" class="p-name fn">Mihai Tica</span>, <a rel="foaf:workplaceHomepage" class="p-org org h-org h-card" href="http://www.adobe.com/">Adobe Systems, Inc.</a></span> +</dd> + + + + </dl> + + + + + + + <p class="copyright"> + This document is licensed under a + <a class="subfoot" href="http://creativecommons.org/licenses/by/3.0/" rel="license">Creative Commons + Attribution 3.0 License</a>. + </p> + + + + <hr> +</div> + <section id="abstract" class="introductory" property="dcterms:abstract" datatype="" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_abstract">Abstract</h2> + <p> + This document is intended to be used as a guideline for the testing + activities related to the Compositing and Blending spec [<cite><a class="bibref" href="#bib-compositing-1">compositing-1</a></cite>]. Its main + goal is to provide an overview of the general testing areas and an informative + description of possible test cases. + </p> + <p> + This document is not meant to replace the spec in determining the + normative and non-normative assertions to be tested, but rather + complement it. + </p> + </section><section id="sotd" class="introductory" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h2 aria-level="1" role="heading" id="h2_sotd">Status of This Document</h2> + + <p> + This document is merely a public working draft of a potential specification. It has + no official standing of any kind and does not represent the support or consensus of any + standards organisation. + </p> + + +</section><section id="toc"><h2 class="introductory" aria-level="1" role="heading" id="h2_toc">Table of Contents</h2><ul class="toc" role="directory" id="respecContents"><li class="tocline"><a href="#goals" class="tocxref"><span class="secno">1. </span>Goals</a><ul class="toc"><li class="tocline"><a href="#providing-guidance-on-testing" class="tocxref"><span class="secno">1.1 </span>Providing guidance on testing</a></li><li class="tocline"><a href="#creating-automation-friendly-tests" class="tocxref"><span class="secno">1.2 </span>Creating automation-friendly tests</a></li></ul></li><li class="tocline"><a href="#approach" class="tocxref"><span class="secno">2. </span>Approach</a></li><li class="tocline"><a href="#testing-areas" class="tocxref"><span class="secno">3. </span>Testing areas</a><ul class="toc"><li class="tocline"><a href="#explicit-testing-areas" class="tocxref"><span class="secno">3.1 </span>Explicit testing areas</a></li><li class="tocline"><a href="#implicit-testing-areas" class="tocxref"><span class="secno">3.2 </span>Implicit testing areas</a></li></ul></li><li class="tocline"><a href="#test-cases-description" class="tocxref"><span class="secno">4. </span>Test cases description</a><ul class="toc"><li class="tocline"><a href="#test-cases-for-mix-blend-mode" class="tocxref"><span class="secno">4.1 </span>Test cases for <code>mix-blend-mode</code></a><ul class="toc"><li class="tocline"><a href="#an-element-with-mix-blend-mode-other-than-normal-creates-a-stacking-context" class="tocxref"><span class="secno">4.1.1 </span>An element with <code>mix-blend-mode</code> other than normal creates a stacking context</a></li><li class="tocline"><a href="#an-element-with-mix-blend-mode-blends-with-the-content-within-the-current-stacking-context" class="tocxref"><span class="secno">4.1.2 </span>An element with <code>mix-blend-mode</code> blends with the content within the current stacking context</a></li><li class="tocline"><a href="#an-element-with-mix-blend-mode-doesn-t-blend-with-anything-outside-the-current-stacking-context" class="tocxref"><span class="secno">4.1.3 </span>An element with <code>mix-blend-mode</code> doesn't blend with anything outside the current stacking context</a></li><li class="tocline"><a href="#an-element-with-mix-blend-mode-other-than-normal-must-cause-a-group-to-be-isolated" class="tocxref"><span class="secno">4.1.4 </span>An element with <code>mix-blend-mode</code> other than normal must cause a group to be isolated</a></li><li class="tocline"><a href="#an-element-with-mix-blend-mode-must-work-properly-with-css-transforms" class="tocxref"><span class="secno">4.1.5 </span>An element with <code>mix-blend-mode</code> must work properly with css transforms</a></li><li class="tocline"><a href="#an-element-with-mix-blend-mode-must-work-properly-with-elements-with-overflow-property" class="tocxref"><span class="secno">4.1.6 </span>An element with <code>mix-blend-mode</code> must work properly with elements with <code>overflow</code> property</a></li><li class="tocline"><a href="#other-test-cases" class="tocxref"><span class="secno">4.1.7 </span>Other test cases</a></li></ul></li><li class="tocline"><a href="#test-cases-for-svg-elements-with-mix-blend-mode" class="tocxref"><span class="secno">4.2 </span>Test cases for SVG elements with <code>mix-blend-mode</code></a><ul class="toc"><li class="tocline"><a href="#mix-blend-mode-with-simple-svg-graphical-elements" class="tocxref"><span class="secno">4.2.1 </span><code>mix-blend-mode</code> with simple SVG graphical elements</a></li><li class="tocline"><a href="#mix-blend-mode-with-svg-groups" class="tocxref"><span class="secno">4.2.2 </span><code>mix-blend-mode</code> with SVG groups</a></li><li class="tocline"><a href="#mix-blend-mode-with-isolated-groups" class="tocxref"><span class="secno">4.2.3 </span><code>mix-blend-mode</code> with isolated groups</a></li><li class="tocline"><a href="#other-test-cases-for-svg" class="tocxref"><span class="secno">4.2.4 </span>Other test cases for SVG</a></li></ul></li><li class="tocline"><a href="#test-cases-for-background-blend-mode" class="tocxref"><span class="secno">4.3 </span>Test cases for <code>background-blend-mode</code></a><ul class="toc"><li class="tocline"><a href="#blending-between-the-background-layers-and-the-background-color-for-an-element-with-background-blend-mode" class="tocxref"><span class="secno">4.3.1 </span>Blending between the background layers and the background color for an element with <code>background-blend-mode</code> </a></li><li class="tocline"><a href="#background-layers-do-not-blend-with-content-outside-the-background-or-behind-the-element" class="tocxref"><span class="secno">4.3.2 </span>Background layers do not blend with content outside the background (or behind the element)</a></li><li class="tocline"><a href="#background-blend-mode-list-values-apply-to-the-corresponding-background-layer" class="tocxref"><span class="secno">4.3.3 </span> <code>background-blend-mode</code> list values apply to the corresponding background layer</a></li><li class="tocline"><a href="#background-blend-mode-list-values-are-repeated-if-the-list-is-shorter-than-the-background-layer-list" class="tocxref"><span class="secno">4.3.4 </span><code>background-blend-mode</code> list values are repeated if the list is shorter than the background layer list</a></li><li class="tocline"><a href="#the-default-background-blend-mode-value-for-the-background-shorthand-is-normal" class="tocxref"><span class="secno">4.3.5 </span>The default <code>background-blend-mode</code> value for the <code>background</code> shorthand is 'normal' </a></li><li class="tocline"><a href="#background-blend-mode-for-an-element-with-background-position" class="tocxref"><span class="secno">4.3.6 </span><code>background-blend-mode</code> for an element with <code>background-position</code></a></li><li class="tocline"><a href="#background-blend-mode-for-an-element-with-background-size" class="tocxref"><span class="secno">4.3.7 </span><code>background-blend-mode</code> for an element with <code>background-size</code></a></li><li class="tocline"><a href="#background-blend-mode-for-an-element-with-background-repeat" class="tocxref"><span class="secno">4.3.8 </span><code>background-blend-mode</code> for an element with <code>background-repeat</code></a></li><li class="tocline"><a href="#background-blend-mode-for-an-element-with-background-clip" class="tocxref"><span class="secno">4.3.9 </span><code>background-blend-mode</code> for an element with <code>background-clip</code></a></li><li class="tocline"><a href="#background-blend-mode-for-an-element-with-background-origin" class="tocxref"><span class="secno">4.3.10 </span><code>background-blend-mode</code> for an element with <code>background-origin</code></a></li><li class="tocline"><a href="#background-blend-mode-for-an-element-with-background-attachement" class="tocxref"><span class="secno">4.3.11 </span><code>background-blend-mode</code> for an element with <code>background-attachement</code></a></li></ul></li><li class="tocline"><a href="#test-cases-for-isolation" class="tocxref"><span class="secno">4.4 </span>Test cases for <code>isolation</code></a><ul class="toc"><li class="tocline"><a href="#an-element-with-isolation-isolate-creates-a-stacking-context" class="tocxref"><span class="secno">4.4.1 </span>An element with <code>isolation:isolate</code> creates a stacking context</a></li><li class="tocline"><a href="#an-element-with-isolation-isolate-creates-an-isolated-group-for-blended-children" class="tocxref"><span class="secno">4.4.2 </span>An element with <code>isolation:isolate</code> creates an isolated group for blended children</a></li><li class="tocline"><a href="#an-element-with-isolation-auto-set-does-not-change-the-elements-existing-stacking-context-behavior" class="tocxref"><span class="secno">4.4.3 </span>An element with <code>isolation:auto</code> set does not change the elements existing stacking context behavior</a></li></ul></li><li class="tocline"><a href="#test-cases-for-isolation-in-svg" class="tocxref"><span class="secno">4.5 </span>Test cases for <code>isolation</code> in SVG</a><ul class="toc"><li class="tocline"><a href="#in-svg-an-element-with-isolation-isolate-creates-an-isolated-group-for-blended-children" class="tocxref"><span class="secno">4.5.1 </span>In SVG, an element with <code>isolation:isolate</code> creates an isolated group for blended children</a></li><li class="tocline"><a href="#in-svg-an-element-with-isolation-auto-set-does-not-change-the-rendering-behaviour" class="tocxref"><span class="secno">4.5.2 </span>In SVG, an element with <code>isolation:auto</code> set does not change the rendering behaviour</a></li></ul></li></ul></li><li class="tocline"><a href="#references" class="tocxref"><span class="secno">A. </span>References</a><ul class="toc"><li class="tocline"><a href="#normative-references" class="tocxref"><span class="secno">A.1 </span>Normative references</a></li><li class="tocline"><a href="#informative-references" class="tocxref"><span class="secno">A.2 </span>Informative references</a></li></ul></li></ul></section> + <section id="goals"> + <!--OddPage--><h2 aria-level="1" role="heading" id="h2_goals"><span class="secno">1. </span>Goals</h2> + <section id="providing-guidance-on-testing"> + <h3 aria-level="2" role="heading" id="h3_providing-guidance-on-testing"><span class="secno">1.1 </span>Providing guidance on testing</h3> + <p> + In order to increase the quality of the test contributions, this + document offers a set of test cases description for conducting testing (see + <a href="#test-cases-description" class="sectionRef sec-ref">section <span class="secno">4.</span> <span class="sec-title">Test cases description</span></a>). + </p> + </section> + <section id="creating-automation-friendly-tests"> + <h3 aria-level="2" role="heading" id="h3_creating-automation-friendly-tests"><span class="secno">1.2 </span>Creating automation-friendly tests</h3> + <p> + In terms of actual tests produced for the CSS Compositing and Blending, the main goal + is to ensure that most tests are automatable (i.e. they're either + reftests or use <code>testharness.js</code>). Even where manual tests + are absolutely necessary they should be written so that they can be + easily automated. This means that even if a manual test requires user + interaction, the validation or PASS/FAIL conditions should still be + clear enough as to allow automatic validation if said interaction is + later automated. + </p> + </section> + </section> + <section id="approach"> + <!--OddPage--><h2 aria-level="1" role="heading" id="h2_approach"><span class="secno">2. </span>Approach</h2> + <p> + Since CSS blending has only three new CSS properties, + the approach is to deep dive into every aspect of the spec as much as possible. + + Tests will be created for the testing areas listed in <a href="#testig-areas" class="sectionRef"></a> + and having as guidance the test cases description from <a href="#test-cases-description" class="sectionRef sec-ref">section <span class="secno">4.</span> <span class="sec-title">Test cases description</span></a>. + </p> + </section> + <section id="testing-areas"> + <!--OddPage--><h2 aria-level="1" role="heading" id="h2_testing-areas"><span class="secno">3. </span>Testing areas</h2> + <section id="explicit-testing-areas"> + <h3 aria-level="2" role="heading" id="h3_explicit-testing-areas"><span class="secno">3.1 </span>Explicit testing areas</h3> + <p> + These testing areas cover things explicitly defined in the normative sections of the Blending and Compositing spec. Please note that while detailed, this list is not necessarily + exhaustive and some normative behaviors may not be contained in it. + When in doubt, consult the Blending and Compositing spec or ask a question on the + <a href="http://lists.w3.org/Archives/Public/www-style/">mailing + list</a>. + </p> + <p>Below is the list of explicit testing areas:</p> + <ol> + <li>Proper parsing of the CSS properties and rendering according to the spec + <ul><code>mix-blend-mode</code></ul> + <ul><code>isolation</code></ul> + <ul><code>background-blend-mode</code></ul> + </li> + <li>SVG blending</li> + <li>Canvas 2D blending</li> + </ol> + </section> + <section id="implicit-testing-areas"> + <h3 aria-level="2" role="heading" id="h3_implicit-testing-areas"><span class="secno">3.2 </span>Implicit testing areas</h3> + <p> + These are testing areas either normatively defined in other specs + that explicitly refer to the Blending and Compositing spec (e.g. [<cite><a class="bibref" href="#bib-css3-transforms">css3-transforms</a></cite>]) + or simply not explicitly defined, but implied by various aspects of + the spec (e.g. processing model, CSS 2.1 compliance, etc.). + Please note that while detailed, this list is not necessarily + exhaustive and some normative behaviors may not be contained in it. + When in doubt, consult the Blending and Compositing spec or ask a question on the + <a href="http://lists.w3.org/Archives/Public/www-style/">mailing + list</a>. + </p> + <p>Below is the list of implicit testing areas:</p> + <ol> + <li>Blending different types of elements + <ul> + <li><code><video></code></li> + <li><code><canvas></code></li> + <li><code><table></code></li> + </ul> + </li> + <li>Blending elements with specific style rules applied + <ul> + <li><code>transforms</code></li> + <li><code>transitions</code> </li> + <li><code>animations</code> </li> + </ul> + </li> + </ol> + </section> + </section> + <section id="test-cases-description"> + <!--OddPage--><h2 aria-level="1" role="heading" id="h2_test-cases-description"><span class="secno">4. </span>Test cases description</h2> + <section id="test-cases-for-mix-blend-mode"> + <h3 aria-level="2" role="heading" id="h3_test-cases-for-mix-blend-mode"><span class="secno">4.1 </span>Test cases for <code>mix-blend-mode</code></h3> + <p> + The following diagram describes a list of notations to be used later on in the document as well as the general document structure the test cases will follow. The test cases should not be limited to this structure. This should be a wireframe and people are encouraged to come up with complex test cases as well. + </p> + <p> + <img id="test_outline" src="test_template.png" alt="Mix-blend-mode sample elements"> + </p> + <p>The intended structure of the document is the following:</p> + <pre><body> + <div id="[P]"> + <div id="[IN-S]"></div> + <div id="[IN-P]"> + <div id="[B]"> + <div id="[CB]"></div> + </div> + </div> + </div> +</body> + </pre> + <p> Unless otherwise stated, test cases assume the following properties for the elements: <br> + </p><ul> + <li> default value for the <code>background-color</code> of the <code>body</code></li> + <li> <code>background-color</code> set to a fully opaque color for all the other elements </li> + </ul> + <p></p> + <p>The CSS associated to the elements used in the tests shouldn't use properties that creates a stacking context, except the ones specified in the test case descriptions.</p> + <p><a href="http://www.w3.org/TR/CSS2/visuren.html#propdef-z-index">Here you can find a description of stacking contexts.</a> Note that z-index applied to positioned elements creates a stacking context. This means that for [P], we must set the z-index and position (absolute, for example) properties to make sure it creates the stacking context.</p> + <p>Every test case has a description of the elements used. The notation from the image is used in the test case description too (e.g. for parent element the notation is [P]). Each test case uses only a subset of the elements while the other elements should just be removed. + </p><p></p> + <section id="an-element-with-mix-blend-mode-other-than-normal-creates-a-stacking-context"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-mix-blend-mode-other-than-normal-creates-a-stacking-context"><span class="secno">4.1.1 </span>An element with <code>mix-blend-mode</code> other than normal creates a stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode">spec</a>: <q>Applying a blendmode other than ‘normal’ to the element must establish a new stacking context [CSS21].</q></p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Simple <code><div></code></td> + <td>1 element required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td> + <td>The element [B] creates a stacking context</td> + </tr> + </tbody></table> + </section> + <section id="an-element-with-mix-blend-mode-blends-with-the-content-within-the-current-stacking-context"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-mix-blend-mode-blends-with-the-content-within-the-current-stacking-context"><span class="secno">4.1.2 </span>An element with <code>mix-blend-mode</code> blends with the content within the current stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q><br> + This section tests if the blending operation is performed. </p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending simple elements </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the parent element [P] mixes with the color of the child element [B].</td> + </tr> + <tr> + <td>Blending with a sibling</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling of the element [B] <br> + The [IN-S] element visually overlaps the [B] element + </td> + <td>The colors of the parent element [P] and the sibling element [IN-S] mixes with the color of the blended element [B].</td> + </tr> + <tr> + <td>Blending with two levels of ascendants</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-P] - Intermediate child element between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B].</td> + </tr> + </tbody></table> + </section> + <section id="an-element-with-mix-blend-mode-doesn-t-blend-with-anything-outside-the-current-stacking-context"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-mix-blend-mode-doesn-t-blend-with-anything-outside-the-current-stacking-context"><span class="secno">4.1.3 </span>An element with <code>mix-blend-mode</code> doesn't blend with anything outside the current stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q> An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q> <br> + This section tests if the isolation is performed. </p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending child overflows the parent</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + The blending element [B] has content that lies outside the parent element. <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default</td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code></td> + </tr> + <tr> + <td>Parent with transparent pixels</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + The element has some text inside and default value for <code>background-color</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + The <code>background-color</code> of the <code>body</code> has a value other than default</td> + <td>The color of the text from the parent element [P] mixes with the color of the child element [B]. <br> + No blending between the color of the <code>body</code> and the color of the blending element [B]. + </td> + </tr> + <tr> + <td>Parent with <code>border-radius</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>border-radius</code> specified (e.g.50%). <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [B] has content that lies outside the parent element, over a rounded corner. <br> + The <code>background-color</code> of the <code>body</code> has a value other than default. </td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element which draws over the rounded corner doesn't mix with the color of the <code>body</code></td> + </tr> + </tbody></table> + </section> + <section id="an-element-with-mix-blend-mode-other-than-normal-must-cause-a-group-to-be-isolated"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-mix-blend-mode-other-than-normal-must-cause-a-group-to-be-isolated"><span class="secno">4.1.4 </span>An element with <code>mix-blend-mode</code> other than normal must cause a group to be isolated</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation">spec</a>: <q>operations that cause the creation of stacking context [CSS21] must cause a group to be isolated.</q> <br> + The following section also tests that mix-blend-mode is not inheritable. If you set mix-blend-mode on a parent, the child should not blend with the parent. Instead, the whole group should blend as a whole, using the parent's blending operator.</p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Child of the blended element has opacity</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [CB] - child of the element [B] with <code>opacity</code> less than one. </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]</td> + </tr> + <tr> + <td>Overflowed child of the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [CB] - child of the element [B] with content that lies outside the parent element [B]. + </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. There is only one color for the entire element [CB] </td> + </tr> + <tr> + <td>Blended element with transparent pixels</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transparent <code>background-color</code> <br> + [CB] - child of the element [B] + </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. </td> + </tr> + </tbody></table> + </section> + <section id="an-element-with-mix-blend-mode-must-work-properly-with-css-transforms"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-mix-blend-mode-must-work-properly-with-css-transforms"><span class="secno">4.1.5 </span>An element with <code>mix-blend-mode</code> must work properly with css transforms</h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Parent with 3D transform</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td><td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed + </td> + </tr> + <tr> + <td>Blended element with 3D transform</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code> <br> + [CB] - child of the element [B] </td> + <td> The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed </td> + </tr> + <tr> + <td>Both parent and blended element with 3D transform</td> + <td> 2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code> + </td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The elements (and the content) of the elements [P] and [B] are properly transformed</td> + </tr> + <tr> + <td>Blended element should force transform-style to flat</td> + <td>1 element required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>transform-style</code>. + </td> + <td>For each value of the <code>transform-style</code> (<code>preserve-3d</code> or <code>flat</code>), [B]'s computed value of <code>transform-style</code> is equal to <code>flat</code></td> + </tr> + <tr> + <td>Blended element with transform and preserve-3d</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>transform-style:preserve-3d</code> <br> + [CB] - child of the element [B]. It has 3D transform property</td> + <td> The child element [CB] will NOT preserve its 3D position. <br> + <code>mix-blend-mode</code> override the behavior of <code>transform-style:preserve-3d</code>: + creates a flattened representation of the descendant elements <br> + The color of the group created by the child elements([B] and [CB]) will blend with the color of the parent element [P] </td> + </tr> + <tr> + <td>Blended element with transform and perspective</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>perspective</code> set to positive length </td> + <td>The colors of the parent and the child are mixed ([P] and [B]) <br> + The element (and the content) of the element [B] is properly transformed + </td> + </tr> + <tr> + <td>Sibling with 3D transform between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling(of the element [B]) with <code>3D transform</code> between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br> + The element (and the content) of the element [IN-S] is properly transformed + </td> + </tr> + <tr> + <td>Parent with 3D transform and transition</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> and transition <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td><td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed + </td> + </tr> + <tr> + <td>Sibling with 3D transform(and transition) between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) with <code>3D transform</code> and transition between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br> + The element (and the content) of the element [IN-S] is properly transformed + </td> + </tr> + </tbody></table> + </section> + <section id="an-element-with-mix-blend-mode-must-work-properly-with-elements-with-overflow-property"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-mix-blend-mode-must-work-properly-with-elements-with-overflow-property"><span class="secno">4.1.6 </span>An element with <code>mix-blend-mode</code> must work properly with elements with <code>overflow</code> property</h4> + <table> + <tbody><tr> + <td>Parent element with <code>overflow:scroll</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:scroll</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal tat overflows the parents [P] dimensions so that it creates scrolling for the parent + </td><td>The color of the parent element [P] mixes with the color of the child element [B]. <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Blended element with <code>overflow:scroll</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:scroll</code> and a child element that creates overflow for [B]</td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Parent element with <code>overflow:scroll</code> and blended with <code>position:fixed</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:scroll</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>position:fixed</code> and should overflow the parents [P] dimensions so that it creates scrolling for the parent</td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The blending happens when scrolling the content of the parent element [P] too. <br> + The scrolling mechanism is not affected. + </td> + </tr> + + <tr> + <td>Parent with <code>overflow:hidden</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:hidden</code><br> + [B] - element with <code>mix-blend-mode</code> other than normal with content that lies outside the parent element<br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default.</td> + <td>The color of the parent element mixes with the color of the child element.</td> + </tr> + <tr> + <td>Blended element with <code>overflow:hidden</code></td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the element [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>overflow:hidden</code>. <br> + [CB] - child of the element [B], with content that lies outside the parent element. <br> </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. <br> + [CB] is properly clipped so no overflow is visible.</td> + </tr> + <tr> + <td>Intermediate child with <code>overflow:hidden</code>between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal that overflows the parents [IN-P] dimensions + [IN-P] - child(of the element [P]) with <code>overflow:hidden</code> + </td> + <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B]. <br> + [B] is is properly clipped so no overflow is visible + </td> + </tr> + + <tr> + <td>Parent with <code>overflow:hidden</code> and <code>border-radius</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%) <br> + [B] - element with <code>mix-blend-mode</code> other than normal with content that lies outside the parent element, over a rounded corner <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default.</td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element which draws over the rounded corner is properly cut </td> + </tr> + <tr> + <td>Blended element with <code>overflow:hidden</code> and <code>border-radius</code></td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the element [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%). <br> + [CB] - child of the element [B], with content that lies outside the parent element, over a rounded corner. <br> </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. <br> + [CB] is properly clipped so no overflow is visible.</td> + </tr> + <tr> + <td>Intermediate child with <code>overflow:hidden</code> and <code>border-radius</code> between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal that overflows the parents [IN-P] dimensions + [IN-P] - child(of the element [P]) with <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%) + </td> + <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B]. <br> + [B] is is properly clipped so no overflow is visible + </td> + </tr> + </tbody></table> + </section> + <section id="other-test-cases"> + <h4 aria-level="3" role="heading" id="h4_other-test-cases"><span class="secno">4.1.7 </span>Other test cases</h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blended element with <code>border-image</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>border-image</code> specified as a png file + </td> + <td>The color of the parent element [P] mixes with the color of the child element. <br> + The color of the <code>border-image</code> mixes with the color of the parent element [P]. + </td> + </tr> + <tr> + <td>Blending with <code><canvas></code> </td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><canvas></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling of the <code><canvas></code> element with some text <br> + The [IN-S] element overlaps the <code><canvas></code> element + </td> + <td>The content of the <code><canvas></code> element mixes with the color of the sibling element and the text [IN-S].</td> + </tr> + <tr> + <td>Blended <code><canvas></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - Child <code><canvas></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><canvas></code> element [B] mixes with the color of the parent element [P] .</td> + </tr> + <tr> + <td>Blending with <code><video></code></td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><video></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) visually overlaping the <code><video></code> element <br> + [IN-S] has some text inside + </td> + <td>The content of the <code>video</code> element [B] mixes with the colors of the sibling element and the text from [IN-S].</td> + </tr> + <tr> + <td>Blended <code><video></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><video></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><video></code> element mixes with the color of the parent element [P] .</td> + </tr> + <tr> + <td>Blending with <code><iframe></code> </td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><iframe></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) with some text <br> + The [IN-S] element visually overlaps the <code><iframe></code> element + </td> + <td>The color of the <code><iframe></code> element mixes with the color of the sibling element and the text [IN-S].</td> + </tr> + <tr> + <td>Blended <code><iframe></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><iframe></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><iframe></code> element [B] mixes with the color of the parent element [P]. </td> + </tr> + <tr> + <td>Blended element with <code>mask</code> property</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>mask</code> property specified to an SVG image (e.g. circle)</td> + <td>The colors of the parent and the masked child are mixed ([P] and [B])</td> + </tr> + <tr> + <td>Blended element with <code>clip-path</code> property </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>clip-path</code> property specified to a basic shape (e.g. ellipse)</td> + <td>The colors of the parent and the clipped child are mixed ([P] and [B])</td> + </tr> + <tr> + <td>Blended element with <code>filter</code> property</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>filter</code> property value other than none </td> + <td>The filter is applied and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Blended element with <code>transition</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>transition-property</code> for <code>opacity</code> </td> + <td>The transition is applied and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Blended element with <code>animation</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>animation</code> specified</td> + <td>The animation is applied to the child element and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Blending with Image</td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><img></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling of the <code><img></code> element<br> + The [IN-S] element overlaps the <code><img></code> element + </td> + <td>The content of the <code><img></code> element mixes with the color of the sibling element [IN-S].</td> + </tr> + <tr> + <td>Blended Image</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><img></code> element (.jpeg or .gif image) with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the <code><img></code> is mixed with the color of the <code><div></code>.</td> + </tr> + <tr> + <td>Blending with SVG</td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><svg></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling of the <code><svg></code> element<br> + The [IN-S] element overlaps the <code><svg></code> element + </td> + <td>The content of the <code><svg></code> element mixes with the color of the sibling element [IN-S].</td> + </tr> + <tr> + <td>Blended SVG</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - SVG element with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the SVG is mixed with the color of the <code><div></code>.</td> + </tr> + <tr> + <td>Linking SVG in an image</td> + <td>1 element required: <a href="#test_outline" <a href="#test_outline" title="img element">[B]</a> <br> + [B] - <code>img</code> linking an <code>svg</code> element that has content with <code>mix-blend-mode</code>. <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default. + </td> + <td>The contents of the SVG is not mixed with the color of the <code><body></code>.</td> + </tr> + <tr> + <td>Paragraph element</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - paragraph element with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the text from the paragraph element is mixed with the color of the <code><div></code></td> + </tr> + <tr> + <td>Paragraph element and background-image</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + and <code>background-image</code> <br> + [B] - Child <code>p</code> element with some text and <code>mix-blend-mode</code> other than normal</td> + <td>The color of the text from the <code>p</code> element is mixed with the background image of the <code><div></code>.</td> + </tr> + <tr> + <td>Set blending from JavaScript</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - Child <code><div></code> element with no <code>mix-blend-mode</code> specified<br> + From JavaScript, set the <code>mix-blend-mode</code> property for the child <code><div></code> to a value other than normal</td> + <td>The colors of the <code><div></code> elements are mixed.</td> + </tr> + </tbody></table> + </section> + </section> + <section id="test-cases-for-svg-elements-with-mix-blend-mode"> + <h3 aria-level="2" role="heading" id="h3_test-cases-for-svg-elements-with-mix-blend-mode"><span class="secno">4.2 </span>Test cases for SVG elements with <code>mix-blend-mode</code></h3> + <section id="mix-blend-mode-with-simple-svg-graphical-elements"> + <h4 aria-level="3" role="heading" id="h4_mix-blend-mode-with-simple-svg-graphical-elements"><span class="secno">4.2.1 </span><code>mix-blend-mode</code> with simple SVG graphical elements</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode">spec</a> : <q><code>mix-blend-mode</code> applies to svg, g, use, image, path, rect, circle, ellipse, line, polyline, polygon, text, tspan, and marker.</q></p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Circle with SVG background</td> + <td>Set a background color for the SVG.<br> + Create 16 <code>circle</code> elements and fill them with a solid color. + <br>Apply each <code>mix-blend-mode</code> on them.</td> + <td>The color of the <code>circle</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Ellipse with SVG background</td> + <td>Set a background color for the SVG.<br> + Create an <code>ellipse</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>ellipse</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Image with SVG background</td> + <td>Set a background color for the SVG. + <br>Create an <code>image</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td> + <td>The <code>image</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Line with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>line</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>line</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Path with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>path</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>path</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Polygon with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>polygon</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>polygon</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Polyline with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>polyline</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>polyline</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Rect with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>rect</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Text with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>text</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td> + <td>The text is mixed with the color of the background.</td> + </tr> + <tr> + <td>Text having tspan with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>text</code> element and a <code>tspan</code> inside it. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>tspan</code>.</td> + <td>The text is mixed with the color of the background.</td> + </tr> + <tr> + <td>Gradient with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a <code>gradient</code>. + <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td> + <td>The gradient is mixed with the color of the background.</td> + </tr> + <tr> + <td>Pattern with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a <code>pattern</code>. + <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td> + <td>The pattern is mixed with the color of the background.</td> + </tr> + <tr> + <td>Set blending on an element from JavaScript</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from JavaScript.</td> + <td>The color of the <code>rect</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Marker with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>line</code> element containing a marker. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The marker color is mixed with the color of the background.</td> + </tr> + <tr> + <td>Metadata with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>metadata</code> element containing an embedded pdf. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The metadata content is not mixed with the color of the background.</td> + </tr> + <tr> + <td>ForeignObject with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>foreignObject</code> element containing a simple xhtml file. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The foreignObject content is not mixed with the color of the background.</td> + </tr> + </tbody></table> + </section> + <section id="mix-blend-mode-with-svg-groups"> + <h4 aria-level="3" role="heading" id="h4_mix-blend-mode-with-svg-groups"><span class="secno">4.2.2 </span><code>mix-blend-mode</code> with SVG groups</h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Group of overlapping elements with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group.</td> + <td>The <code>group</code> is mixed as a whole with the color of the background.</td> + </tr> + </tbody></table> + </section> + <section id="mix-blend-mode-with-isolated-groups"> + <h4 aria-level="3" role="heading" id="h4_mix-blend-mode-with-isolated-groups"><span class="secno">4.2.3 </span><code>mix-blend-mode</code> with isolated groups</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode">spec</a>: + <br><q>By default, every element must create a non-isolated group.<br> + However, certain operations in SVG will create isolated groups.<br> + If one of the following features is used, the group must become isolated: + </q></p><ul> + <li>opacity</li> + <li>filters</li> + <li>3D transforms (2D transforms must NOT cause isolation)</li> + <li>blending</li> + <li>masking</li> + </ul> + + <p></p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending two elements in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td> + <td>Only the intersection of the <code>rect</code> elements should mix.</td> + </tr> + <tr> + <td>Blending in a group with opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with filter</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>filter</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with 2D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>transform</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with 3D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a 3d transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with a mask</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>mask</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with mix-blend-mode</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </tbody></table> + </section> + <section id="other-test-cases-for-svg"> + <h4 aria-level="3" role="heading" id="h4_other-test-cases-for-svg"><span class="secno">4.2.4 </span>Other test cases for SVG</h4> + <table> + <tbody><tr> + <td>Blend with element having opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke-opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke</code>, <code>stroke-opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke-dasharray</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke-dasharray</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having transform</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>transform</code> (any combination of <code>translate</code>, <code>rotate</code>, <code>scale</code>, <code>skew</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with SVG having viewbox and preserveAspectRatio set</td> + <td>Set a background color for the SVG, as well as <code>viewbox</code> and <code>preserveAspectRatio</code>.<br> + Create a <code>rect</code> element filled with a different solid color and apply a <code>mix-blend-mode</code> other than <code>normal</code> on it.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having color-profile set</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>color-profile</code> (<code>sRGB</code>, for example) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having overflow</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> larger than the SVG.<br> + Apply <code>overflow</code> (<code>visible</code>, <code>hidden</code>, <code>scroll</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having clip-path</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>clip-path</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having a mask</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element.<br> + Apply a <code>mask</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having a filter</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element.<br> + Apply a <code>filter</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an animated element</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply an <code>animateTransform</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Set blending from an SVG script element</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element and fill it with a solid color.<br> + Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from an svg <code>script</code> element.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + </tbody></table> + </section> + </section> + <section id="test-cases-for-background-blend-mode"> + <h3 aria-level="2" role="heading" id="h3_test-cases-for-background-blend-mode"><span class="secno">4.3 </span>Test cases for <code>background-blend-mode</code></h3> + <section id="blending-between-the-background-layers-and-the-background-color-for-an-element-with-background-blend-mode"> + <h4 aria-level="3" role="heading" id="h4_blending-between-the-background-layers-and-the-background-color-for-an-element-with-background-blend-mode"><span class="secno">4.3.1 </span>Blending between the background layers and the background color for an element with <code>background-blend-mode</code> </h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Each background layer must blend with the element's background layer that are below it and the element's background color.</q></p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Images with different formats</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + Tests should be created for <code><image></code> with different formats such as PNG, JPEG or SVG + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Gradient and background color</td> + <td> + Element with + <ul> + <li><code>background-image</code> set to an <code><gradient></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Image and gradient</td> + <td> + Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> on top of a <code><gradient></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code><image></code> is mixed with the content of the <code><gradient></code> + </td> + </tr> + <tr> + <td>Gradient and image</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code><gradient></code> on top of an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code><image></code> is mixed with the content of the <code><gradient></code></td> + </tr> + <tr> + <td>Two gradients</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code><gradient></code> on top of another <code><gradient></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul></td> + <td>The content of the two gradients is mixed</td> + </tr> + <tr> + <td>Two images</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> on top of another <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul></td> + <td>The content of the two images is mixed</td> + </tr> + <tr> + <td>Image and background color with transparency</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> with transparency(e.g. PNG images)</li> + <li><code>background-color</code> set to a transparent color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Cross-fade image and gradient</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <q>cross-fade()</q> image on top of a <code><gradient></code> </li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the cross-faded image is mixed with the content of the <code><gradient></code></td> + </tr> + <tr> + <td>SVG image and background color</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a data URI for an SVG image </li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + <tr> + <td>Animated gif image and background color</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an animated gif image</li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + <tr> + <td>Set <code>background-blend-mode</code> from JavaScript</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code>gradient</code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li>no <code>background-blend-mode</code> explicitly specified</li> + From JavaScript, set the <code>background-blend-mode</code> property to a value other than normal. + </ul> + </td> + <td>The content of the gradient is mixed with the color of the background</td> + </tr> + <tr> + <td><code>background-blend-mode</code> on element with 3D transform</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + <li><code>transform</code> set to a 3D function like rotateX, rotateY or translateZ</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + </tbody></table> + </section> + <section id="background-layers-do-not-blend-with-content-outside-the-background-or-behind-the-element"> + <h4 aria-level="3" role="heading" id="h4_background-layers-do-not-blend-with-content-outside-the-background-or-behind-the-element"><span class="secno">4.3.2 </span>Background layers do not blend with content outside the background (or behind the element)</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Background layer must not blend with the content that is behind the element instead they must act as if they are rendered into an isolated group.</q> + </p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>One background layer</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The <code>background-image</code> is not mixed with anything outside the element</td> + </tr> + <tr> + <td>Two elements</td> + <td>2 elements required: a parent element with a child. <br> + Each one with the following properties: + <ul> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td><td>No blending between the background colors of the two elements</td> + </tr> + <tr> + <td>Parent and child with <code>background-blend-mode</code></td> + <td>2 elements required: a parent element with a child <br> + Parent properties: <br> + <ul> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + Child properties: <br> + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td><td>The content of the image from the child element does not mixes with the background color from the parent element</td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-list-values-apply-to-the-corresponding-background-layer"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-list-values-apply-to-the-corresponding-background-layer"><span class="secno">4.3.3 </span> <code>background-blend-mode</code> list values apply to the corresponding background layer</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>The ‘background-blend-mode’ list must be applied in the same order as ‘background-image’[CSS3BG]. This means that the first element in the list will apply to the layer that is on top.</q> + </p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Different blend modes applied between layers</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image-list></code> containing three images: (e.g. I1, I2 and I3 ) </li> + <li><code>background-blend-mode</code> set to different <code>blendmode</code> for every image: (e.g. multiply, difference, screen) </li> + </ul></td> + <td>The content of the three images is correctly mixed <br> + (multiply for I1, difference for I2 and screen for I3) + </td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-list-values-are-repeated-if-the-list-is-shorter-than-the-background-layer-list"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-list-values-are-repeated-if-the-list-is-shorter-than-the-background-layer-list"><span class="secno">4.3.4 </span><code>background-blend-mode</code> list values are repeated if the list is shorter than the background layer list</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If a property doesn't have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough.</q> + </p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blend mode list repeat</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image-list></code> containing three images</li> + <li><code>background-blend-mode</code> set to two different <code>blendmode</code> values</li> + </ul></td> + <td>The unspecified blend modes should be obtained by repeating the blend mode list from the beginning</td> + </tr> + </tbody></table> + </section> + <section id="the-default-background-blend-mode-value-for-the-background-shorthand-is-normal"> + <h4 aria-level="3" role="heading" id="h4_the-default-background-blend-mode-value-for-the-background-shorthand-is-normal"><span class="secno">4.3.5 </span>The default <code>background-blend-mode</code> value for the <code>background</code> shorthand is 'normal' </h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If the ‘background’ [CSS3BG] shorthand is used, the ‘background-blend-mode’ property for that element must be reset to its initial value.</q> + </p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Default blend mode for 'background' shorthand</td> + <td>Element with + <ul> + <li><code>background</code> property set to an image and a color</li> + <li>No value explicitly set for <code>background-blend-mode</code> </li> + </ul></td> + <td> The computed value of <code>background-blend-mode</code> is 'normal' + </td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-for-an-element-with-background-position"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-for-an-element-with-background-position"><span class="secno">4.3.6 </span><code>background-blend-mode</code> for an element with <code>background-position</code></h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-position</code> percentage</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-position</code> specified in percentage, such as 50% 50%</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> is correctly positioned + </td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-for-an-element-with-background-size"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-for-an-element-with-background-size"><span class="secno">4.3.7 </span><code>background-blend-mode</code> for an element with <code>background-size</code></h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Background size defined in pixels</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> specified in pixels</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size defined in percentage (second phase)</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> specified in percentage</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size cover</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> set to <code>cover</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size contain</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> set to <code>contain</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-for-an-element-with-background-repeat"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-for-an-element-with-background-repeat"><span class="secno">4.3.8 </span><code>background-blend-mode</code> for an element with <code>background-repeat</code></h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-repeat</code> set to no-repeat</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>no-repeat</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> is not repeated + </td> + </tr> + <tr> + <td><code>background-repeat</code> set to space</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>space</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + </td> + </tr> + <tr> + <td><code>background-repeat</code> set to round</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>round</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + </td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-for-an-element-with-background-clip"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-for-an-element-with-background-clip"><span class="secno">4.3.9 </span><code>background-blend-mode</code> for an element with <code>background-clip</code></h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-clip</code> set to <code>padding-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-clip</code> set to <code>padding-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + No background is drawn below the border (background extends to the outside edge of the padding) + </td> + </tr> + <tr> + <td><code>background-clip</code> set to <code>content-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-clip</code> set to <code>content-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background is painted within (clipped to) the content box + </td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-for-an-element-with-background-origin"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-for-an-element-with-background-origin"><span class="secno">4.3.10 </span><code>background-blend-mode</code> for an element with <code>background-origin</code></h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-origin</code> set to <code>border-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-origin</code> set to <code>border-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background extends to the outside edge of the border (but underneath the border in z-ordering) + </td> + </tr> + <tr> + <td><code>background-origin</code> set to <code>content-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-origin</code> set to <code>content-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background is painted within (clipped to) the content box + </td> + </tr> + </tbody></table> + </section> + <section id="background-blend-mode-for-an-element-with-background-attachement"> + <h4 aria-level="3" role="heading" id="h4_background-blend-mode-for-an-element-with-background-attachement"><span class="secno">4.3.11 </span><code>background-blend-mode</code> for an element with <code>background-attachement</code></h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-attachment</code> set to <code>fixed</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-attachment</code> set to <code>fixed</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background image will not scroll with its containing element, instead remaining stationary within the viewport + </td> + </tr> + <tr> + <td>2 background images with <code>background-attachment</code> set to <code>fixed, scroll</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to 2 <code><image></code>(s)</li> + <li><code>background-attachment</code> set to <code>fixed, scroll</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The background images will be mixed when they overlap while scrolling + </td> + </tr> + </tbody></table> + </section> + </section> + <section id="test-cases-for-isolation"> + <h3 aria-level="2" role="heading" id="h3_test-cases-for-isolation"><span class="secno">4.4 </span>Test cases for <code>isolation</code></h3> + <section id="an-element-with-isolation-isolate-creates-a-stacking-context"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-isolation-isolate-creates-a-stacking-context"><span class="secno">4.4.1 </span>An element with <code>isolation:isolate</code> creates a stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>For CSS, setting ‘isolation’ to ‘isolate’ will turn the element into a stacking context [CSS21].</q></p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation isolate</td> + <td>Have an element with <code>isolation</code> set to <code>isolate</code></td> + <td>The element creates a stacking context.</td> + </tr> + </tbody></table> + </section> + <section id="an-element-with-isolation-isolate-creates-an-isolated-group-for-blended-children"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-isolation-isolate-creates-an-isolated-group-for-blended-children"><span class="secno">4.4.2 </span>An element with <code>isolation:isolate</code> creates an isolated group for blended children</h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation of blended child which overflows</td> + <td>3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + This element has <code>isolation:isolate</code> set.<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br> + The blending element [B] has content that lies outside the parent element. <br> + </td> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + The area of the child element outside of the intermediate parent element does not mix with the color of the parent element [P], or of the <code>body</code>. + </td> + </tr> + <tr> + <td>Isolation on intermediate element with transparent pixels</td> + <td>3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); the element <code>background-color</code> is other than <code>transparent</code><br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + The intermediate element has text content, default value for <code>background-color</code> and <code>isolation:isolate</code> set<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal + </code></td><td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + There is no blending between the color of the parent element [P] and the color of the blended element [B]. + </td> + </tr> + <tr> + <td>Isolate inside a stacking context created by a 3d transform</td> + <td> + 3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a <code>3D transform</code> applied<br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + The intermediate element has <code>isolation:isolate</code> set<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code><br> + </td> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + There is no blending between the color of the parent element [P] and the color of the blended element [B]. + </td> + </tr> + </tbody></table> + </section> + <section id="an-element-with-isolation-auto-set-does-not-change-the-elements-existing-stacking-context-behavior"> + <h4 aria-level="3" role="heading" id="h4_an-element-with-isolation-auto-set-does-not-change-the-elements-existing-stacking-context-behavior"><span class="secno">4.4.3 </span>An element with <code>isolation:auto</code> set does not change the elements existing stacking context behavior</h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation auto</td> + <td>Have an element with <code>isolation</code> explicitly set to <code>auto</code>, and no other style that would create a stacking context</td> + <td>The element does not create a stacking context - the computed value of its <code>z-index</code> is value <code>auto</code></td> + </tr> + <tr> + <td>Stacking context not affected by isolation</td> + <td>2 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); This element has <code>isolation</code> explicitly set to <code>auto</code> <br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br> + The blending element [B] has content that lies outside the parent element. <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default + </td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code>.<br> + In other words, setting the <code>isolation</code> to <code>auto</code> does not affect the creation of a stacking context by other properties. + </td> + </tr> + </tbody></table> + </section> + </section> + <section id="test-cases-for-isolation-in-svg"> + <h3 aria-level="2" role="heading" id="h3_test-cases-for-isolation-in-svg"><span class="secno">4.5 </span>Test cases for <code>isolation</code> in SVG</h3> + <section id="in-svg-an-element-with-isolation-isolate-creates-an-isolated-group-for-blended-children"> + <h4 aria-level="3" role="heading" id="h4_in-svg-an-element-with-isolation-isolate-creates-an-isolated-group-for-blended-children"><span class="secno">4.5.1 </span>In SVG, an element with <code>isolation:isolate</code> creates an isolated group for blended children</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation">spec</a>: <q>In SVG, this defines whether an element is isolated or not.</q></p> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending two elements in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br> + Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td> + <td>Only the intersection of the <code>rect</code> elements should mix.</td> + </tr> + <tr> + <td>Blending in an isolated group with 2D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:isolate</code> and 2D transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Set isolation on an element from JavaScript</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color and a <code>mix-blend-mode</code> other than <code>normal</code>. + <br>Apply <code>isolation:isolate</code> on it from JavaScript.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </tbody></table> + </section> + <section id="in-svg-an-element-with-isolation-auto-set-does-not-change-the-rendering-behaviour"> + <h4 aria-level="3" role="heading" id="h4_in-svg-an-element-with-isolation-auto-set-does-not-change-the-rendering-behaviour"><span class="secno">4.5.2 </span>In SVG, an element with <code>isolation:auto</code> set does not change the rendering behaviour</h4> + <table> + <tbody><tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending a group with <code>isolation:auto</code></td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The element will mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 and <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </tbody></table> + </section> + </section> + + +</section><div id="respec-ui" class="removeOnSave" style="position: fixed; top: 20px; right: 20px; width: 202px; text-align: right;"><button style="background-color: rgb(255, 255, 255); font-weight: bold; border: 1px solid rgb(204, 204, 204); border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; background-position: initial initial; background-repeat: initial initial;">ReSpec</button><div style="background-color: rgb(255, 255, 255); border: 1px solid rgb(0, 0, 0); width: 200px; display: none; text-align: left; margin-top: 5px; margin-right: 5px; background-position: initial initial; background-repeat: initial initial;"><button style="background-color: rgb(255, 255, 255); border-style: none none solid; border-bottom-width: 1px; border-bottom-color: rgb(204, 204, 204); width: 100%; text-align: left; font-size: inherit; background-position: initial initial; background-repeat: initial initial;">Save Snapshot</button><button style="background-color: rgb(255, 255, 255); border-style: none none solid; border-bottom-width: 1px; border-bottom-color: rgb(204, 204, 204); width: 100%; text-align: left; font-size: inherit; background-position: initial initial; background-repeat: initial initial;">About ReSpec</button></div></div><section id="references" class="appendix" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><!--OddPage--><h2 aria-level="1" role="heading" id="h2_references"><span class="secno">A. </span>References</h2><section id="normative-references" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h3 aria-level="2" role="heading" id="h3_normative-references"><span class="secno">A.1 </span>Normative references</h3><dl class="bibliography" about=""><dt id="bib-compositing-1">[compositing-1]</dt><dd rel="dcterms:requires">Nikos Andronikos; Rik Cabanier. <a href="http://www.w3.org/TR/compositing-1/"><cite>Compositing and Blending Level 1</cite></a>. 10 October 2013. W3C Last Call Working Draft. URL: <a href="http://www.w3.org/TR/compositing-1/">http://www.w3.org/TR/compositing-1/</a> +</dd><dt id="bib-css3-transforms">[css3-transforms]</dt><dd rel="dcterms:requires">Simon Fraser; Dean Jackson; Edward O'Connor; Dirk Schulze; Aryeh Gregor. <a href="http://www.w3.org/TR/css3-transforms/"><cite>CSS Transforms</cite></a>. 11 September 2012. W3C Working Draft. URL: <a href="http://www.w3.org/TR/css3-transforms/">http://www.w3.org/TR/css3-transforms/</a> +</dd></dl></section><section id="informative-references" typeof="bibo:Chapter" resource="#ref" rel="bibo:Chapter"><h3 aria-level="2" role="heading" id="h3_informative-references"><span class="secno">A.2 </span>Informative references</h3><dl class="bibliography" about=""><dt id="bib-webdriver">[webdriver]</dt><dd rel="dcterms:references">Simon Stewart; David Burns. <a href="http://www.w3.org/TR/webdriver/"><cite>WebDriver</cite></a>. 12 March 2013. W3C Working Draft. URL: <a href="http://www.w3.org/TR/webdriver/">http://www.w3.org/TR/webdriver/</a> +</dd></dl></section></section></body></html> diff --git a/testing/web-platform/tests/css/compositing/test-plan/test-plan.src.html b/testing/web-platform/tests/css/compositing/test-plan/test-plan.src.html new file mode 100644 index 0000000000..c29f268837 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/test-plan/test-plan.src.html @@ -0,0 +1,1616 @@ + +<!DOCTYPE html> +<html> + <head> + <title>Compositing and Blending Test Plan</title> + <meta charset='utf-8'> + <script src='http://www.w3.org/Tools/respec/respec-w3c-common' + async class='remove'></script> + <script class='remove'> + var respecConfig = { + specStatus: "unofficial", + shortName: "compositing-1-test-plan", + editors: [ + { + name: "Mirela Budaes", + company: "Adobe Systems, Inc.", + companyURL: "http://www.adobe.com/" + }, + { + name: "Horia Olaru", + company: "Adobe Systems, Inc.", + companyURL: "http://www.adobe.com/" + }, + { + name: "Mihai Tica", + company: "Adobe Systems, Inc.", + companyURL: "http://www.adobe.com/" + }, + + ] + }; + </script> + <style> + table + { + border-collapse:collapse; + } + table, td, th + { + border:1px solid black; + padding: 13px; + } + table + { + width: 100%; + } + img + { + width: 400px; + } + </style> + </head> + <body> + <section id='abstract'> + <p> + This document is intended to be used as a guideline for the testing + activities related to the Compositing and Blending spec [[!compositing-1]]. Its main + goal is to provide an overview of the general testing areas and an informative + description of possible test cases. + </p> + <p> + This document is not meant to replace the spec in determining the + normative and non-normative assertions to be tested, but rather + complement it. + </p> + </section> + <section> + <h2>Goals</h2> + <section> + <h3>Providing guidance on testing</h3> + <p> + In order to increase the quality of the test contributions, this + document offers a set of test cases description for conducting testing (see + <a href="#test-cases-description" class="sectionRef"></a>). + </p> + </section> + <section> + <h3>Creating automation-friendly tests</h3> + <p> + In terms of actual tests produced for the CSS Compositing and Blending, the main goal + is to ensure that most tests are automatable (i.e. they're either + reftests or use <code>testharness.js</code>). Even where manual tests + are absolutely necessary they should be written so that they can be + easily automated – as there are on-going efforts to make + WebDriver [[webdriver]] automated tests a first class citizen in W3C + testing. This means that even if a manual test requires user + interaction, the validation or PASS/FAIL conditions should still be + clear enough as to allow automatic validation if said interaction is + later automated. + </p> + </section> + </section> + <section> + <h2>Approach</h2> + <p> + Since CSS blending has only three new CSS properties, + the approach is to deep dive into every aspect of the spec as much as possible. + + Tests will be created for the testing areas listed in <a href="#testig-areas" class="sectionRef"></a> + and having as guidance the test cases description from <a href="#test-cases-description" class="sectionRef"></a>. + </p> + </section> + <section> + <h2>Testing areas</h2> + <section> + <h3>Explicit testing areas</h3> + <p> + These testing areas cover things explicitly defined in the normative sections of the Blending and Compositing spec. Please note that while detailed, this list is not necessarily + exhaustive and some normative behaviors may not be contained in it. + When in doubt, consult the Blending and Compositing spec or ask a question on the + <a href="http://lists.w3.org/Archives/Public/www-style/">mailing + list</a>. + </p> + <p>Below is the list of explicit testing areas:</p> + <ol> + <li>Proper parsing of the CSS properties and rendering according to the spec + <ul><code>mix-blend-mode</code></ul> + <ul><code>isolation</code></ul> + <ul><code>background-blend-mode</code></ul> + </li> + <li>SVG blending</li> + <li>Canvas 2D blending</li> + </ol> + </section> + <section> + <h3>Implicit testing areas</h3> + <p> + These are testing areas either normatively defined in other specs + that explicitly refer to the Blending and Compositing spec (e.g. [[!css3-transforms]]) + or simply not explicitly defined, but implied by various aspects of + the spec (e.g. processing model, CSS 2.1 compliance, etc.). + Please note that while detailed, this list is not necessarily + exhaustive and some normative behaviors may not be contained in it. + When in doubt, consult the Blending and Compositing spec or ask a question on the + <a href="http://lists.w3.org/Archives/Public/www-style/">mailing + list</a>. + </p> + <p>Below is the list of implicit testing areas:</p> + <ol> + <li>Blending different types of elements + <ul> + <li><code><video></code></li> + <li><code><canvas></code></li> + <li><code><table></code></li> + </ul> + </li> + <li>Blending elements with specific style rules applied + <ul> + <li><code>transforms</code></li> + <li><code>transitions</code> </li> + <li><code>animations</code> </li> + </ul> + </li> + </ol> + </section> + </section> + <section> + <h2>Test cases description</h2> + <section> + <h3>Test cases for <code>mix-blend-mode</code></h3> + <p> + The following diagram describes a list of notations to be used later on in the document as well as the general document structure the test cases will follow. The test cases should not be limited to this structure. This should be a wireframe and people are encouraged to come up with complex test cases as well. + </p> + <p> + <img id="test_outline" src="test_template.png" alt="Mix-blend-mode sample elements"> + </p> + <p>The intended structure of the document is the following:</p> + <pre> +<body> + <div id="[P]"> + <div id="[IN-S]"></div> + <div id="[IN-P]"> + <div id="[B]"> + <div id="[CB]"></div> + </div> + </div> + </div> +</body> + </pre> + <p> Unless otherwise stated, test cases assume the following properties for the elements: <br> + <ul> + <li> default value for the <code>background-color</code> of the <code>body</code></li> + <li> <code>background-color</code> set to a fully opaque color for all the other elements </li> + </ul> + </p> + <p>The CSS associated to the elements used in the tests shouldn't use properties that creates a stacking context, except the ones specified in the test case descriptions.</p> + <p>Every test case has a description of the elements used. The notation from the image is used in the test case description too (e.g. for parent element the notation is [P]). Each test case uses only a subset of the elements while the other elements should just be removed. + </p></p> + <section> + <h4>An element with <code>mix-blend-mode</code> other than normal creates a stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a>: <q>Applying a blendmode other than ‘normal’ to the element must establish a new stacking context [CSS21].</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Simple <code><div></td> + <td>1 element required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td> + <td>The element [B] creates a stacking context</td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> blends with the content within the current stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q> </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending simple elements </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the parent element [P] mixes with the color of the child element [B].</td> + </tr> + <tr> + <td>Blending <code><video></code></td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><video></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) visually overlaping the <code><video></code> element <br> + [IN-S] has some text inside + </td> + <td>The content of the <code>video</code> element [B] mixes with the colors of the sibling element and the text from [IN-S].</td> + </tr> + <tr> + <td>Blending with a sibling</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling of the element [B] <br> + The [IN-S] element visually overlaps the [B] element + </td> + <td>The colors of the parent element [P] and the sibling element [IN-S] mixes with the color of the blended element [B].</td> + </tr> + <tr> + <td>Blending with two levels of ascendants</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-P] - Intermediate child element between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B].</td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> doesn't blend with anything outside the current stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q> An element that has blending applied, must blend with all the underlying content of the stacking context [CSS21] that that element belongs to.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending child overflows the parent</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + The blending element [B] has content that lies outside the parent element. <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default</td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code></td> + </tr> + <tr> + <td>Parent with transparent pixels</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + The element has some text inside and default value for <code>background-color</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + The <code>background-color</code> of the <code>body</code> has a value other than default</td> + <td>The color of the text from the parent element [P] mixes with the color of the child element [B]. <br> + No blending between the color of the <code>body</code> and the color of the blending element [B]. + </td> + </tr> + <tr> + <td>Parent with <code>border-radius</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>border-radius</code> specified (e.g.50%). <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [B] has content that lies outside the parent element, over a rounded corner. <br> + The <code>background-color</code> of the <code>body</code> has a value other than default. </td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element which draws over the rounded corner doesn't mix with the color of the <code>body</code></td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> other than normal must cause a group to be isolated</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation" >spec</a>: <q>operations that cause the creation of stacking context [CSS21] must cause a group to be isolated.</q> </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Child of the blended element has opacity</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [CB] - child of the element [B] with <code>opacity</code> less than one. </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]</td> + </tr> + <tr> + <td>Overflowed child of the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [CB] - child of the element [B] with content that lies outside the parent element [B]. + </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. There is only one color for the entire element [CB] </td> + </tr> + <tr> + <td>Blended element with transparent pixels</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transparent <code>background-color</code> <br> + [CB] - child of the element [B] + </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. </td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> must work properly with css transforms</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Parent with 3D transform</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed + </td> + </tr> + <tr> + <td>Blended element with 3D transform</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code> <br> + [CB] - child of the element [B] </td> + <td> The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed </td> + </tr> + <tr> + <td>Both parent and blended element with 3D transform</td> + <td> 2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>3D transform</code> + </td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The elements (and the content) of the elements [P] and [B] are properly transformed</td> + </tr> + <tr> + <td>Blended element with transform and preserve-3d</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>transform-style:preserve-3d</code> <br> + [CB] - child of the element [B]. It has 3D transform property</td> + <td> The child element [CB] will NOT preserve its 3D position. <br> + <code>mix-blend-mode</code> override the behavior of <code>transform-style:preserve-3d</code>: + creates a flattened representation of the descendant elements <br> + The color of the group created by the child elements([B] and [CB]) will blend with the color of the parent element [P] </td> + </tr> + <tr> + <td>Blended element with transform and perspective</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and transform with <code>perspective</code> set to positive length </td> + <td>The colors of the parent and the child are mixed ([P] and [B]) <br> + The element (and the content) of the element [B] is properly transformed + </td> + </tr> + <tr> + <td>Sibling with 3D transform between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling(of the element [B]) with <code>3D transform</code> between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br> + The element (and the content) of the element [IN-S] is properly transformed + </td> + </tr> + <tr> + <td>Parent with 3D transform and transition</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with <code>3D transform</code> and transition <br> + [B] - element with <code>mix-blend-mode</code> other than normal + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The element (and the content) of the element [P] is properly transformed + </td> + </tr> + <tr> + <td>Sibling with 3D transform(and transition) between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) with <code>3D transform</code> and transition between the parent [P] and the child [B] + </td> + <td>The colors of the parent element [P] and the transformed sibling element [IN-S] mixes with the color of the blended element [B].<br> + The element (and the content) of the element [IN-S] is properly transformed + </td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>mix-blend-mode</code> must work properly with elements with <code>overflow</code> property</h4> + <table> + <tr> + <td>Parent element with <code>overflow:scroll</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:scroll</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal tat overflows the parents [P] dimensions so that it creates scrolling for the parent + <td>The color of the parent element [P] mixes with the color of the child element [B]. <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Blended element with <code>overflow:scroll</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:scroll</code> and a child element that creates overflow for [B]</td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Parent element with <code>overflow:scroll</code> and blended with <code>position:fixed</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:scroll</code> <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>position:fixed</code> and should overflow the parents [P] dimensions so that it creates scrolling for the parent</td> + <td>The color of the parent element [P] mixes with the color of the child element [B] <br> + The blending happens when scrolling the content of the parent element [P] too. <br> + The scrolling mechanism is not affected. + </td> + </tr> + <tr> + <td>Parent with <code>overflow:hidden</code> and <code>border-radius</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [P] has <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%) <br> + [B] - element with <code>mix-blend-mode</code> other than normal with content that lies outside the parent element, over a rounded corner <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default.</td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element which draws over the rounded corner is properly cut </td> + </tr> + <tr> + <td>Blended element with <code>overflow:hidden</code> and <code>border-radius</code></td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Child of the lement [B]">[CB]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal, <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%). <br> + [CB] - child of the element [B], with content that lies outside the parent element, over a rounded corner. <br> </td> + <td>The group created by the two child elements([B] and [CB]) is blended with the parent element [P]. <br> + No blending between [B] and [CB]. <br> + [CB] is properly clipped so no overflow is visible.</td> + </tr> + <tr> + <td>Intermediate child with <code>overflow:hidden</code> and <code>border-radius</code> between the parent and the blended element</td> + <td>3 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="child of the element [P]">[IN-P]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal that overflows the parents [IN-P] dimensions + [IN-P] - child(of the element [P]) with <code>overflow:hidden</code> and <code>border-radius</code> specified (e.g.50%) + </td> + <td>The colors of the parent element [P] and the child element [IN-P] mixes with the color of the blended element [B]. <br> + [B] is is properly clipped so no overflow is visible + </td> + </tr> + </table> + </section> + <section> + <h4>Other test cases</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blended element with <code>border-image</code> </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>border-image</code> specified as a png file + </td> + <td>The color of the parent element [P] mixes with the color of the child element. <br> + The color of the <code>border-image</code> mixes with the color of the parent element [P]. + </td> + </tr> + <tr> + <td>Blending with <code><canvas></code> </td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><canvas></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - Sibling of the <code><canvas></code> element with some text <br> + The [IN-S] element overlaps the <code><canvas></code> element + </td> + <td>The content of the <code><canvas></code> element mixes with the color of the sibling element and the text [IN-S].</td> + </tr> + <tr> + <td>Blended <code><canvas></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - Child <code><canvas></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><canvas></code> element [B] mixes with the color of the parent element [P] .</td> + </tr> + <tr> + <td>Blended <code><video></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><video></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><video></code> element mixes with the color of the parent element [P] .</td> + </tr> + <tr> + <td>Blending with <code><iframe></code> </td> + <td>2 elements required: <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> and <a href="#test_outline" title="Sibling of the element [B]">[IN-S]</a> <br> + [B] - <code><iframe></code> element with <code>mix-blend-mode</code> other than normal <br> + [IN-S] - sibling(of the element [B]) with some text <br> + The [IN-S] element visually overlaps the <code><iframe></code> element + </td> + <td>The color of the <code><iframe></code> element mixes with the color of the sibling element and the text [IN-S].</td> + </tr> + <tr> + <td>Blended <code><iframe></code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><iframe></code> element with <code>mix-blend-mode</code> other than normal + </td> + <td>The color of the <code><iframe></code> element [B] mixes with the color of the parent element [P]. </td> + </tr> + <tr> + <td>Blended element with <code>mask</code> property</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>mask</code> property specified to an SVG image (e.g. circle)</td> + <td>The colors of the parent and the masked child are mixed ([P] and [B])</td> + </tr> + <tr> + <td>Blended element with <code>clip-path</code> property </td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>clip-path</code> property specified to a basic shape (e.g. ellipse)</td> + <td>The colors of the parent and the clipped child are mixed ([P] and [B])</td> + </tr> + <tr> + <td>Blended element with <code>filter</code> property</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>filter</code> property value other than none </td> + <td>The filter is applied and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Blended element with <code>transition</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>transition-property</code> for <code>opacity</code> </td> + <td>The transition is applied and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Blended element with <code>animation</code></td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - element with <code>mix-blend-mode</code> other than normal and <code>animation</code> specified</td> + <td>The animation is applied to the child element and the result is mixed with the parent element</td> + </tr> + <tr> + <td>Image element</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - <code><img></code> element (.jpeg or .gif image) with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the <code><img></code> is mixed with the color of the <code><div></code>.</td> + </tr> + <tr> + <td>SVG element</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - SVG element with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the SVG is mixed with the color of the <code><div></code>.</td> + </tr> + <tr> + <td>Paragraph element</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - paragraph element with <code>mix-blend-mode</code> other than normal</td> + <td>The color of the text from the paragraph element is mixed with the color of the <code><div></code></td> + </tr> + <tr> + <td>Paragraph element and background-image</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + and <code>background-image</code> <br> + [B] - Child <code>p</code> element with some text and <code>mix-blend-mode</code> other than normal</td> + <td>The color of the text from the <code>p</code> element is mixed with the background image of the <code><div></code>.</td> + </tr> + <tr> + <td>Set blending from JavaScript</td> + <td>2 elements required: <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [B] - Child <code><div></code> element with no <code>mix-blend-mode</code> specified<br> + From JavaScript, set the <code>mix-blend-mode</code> property for the child <code><div></code> to a value other than normal</td> + <td>The colors of the <code><div></code> elements are mixed.</td> + </tr> + </table> + </section> + </section> + <section> + <h3>Test cases for SVG elements with <code>mix-blend-mode</code></h4> + <section> + <h4><code>mix-blend-mode</code> with simple SVG graphical elements</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a> : <q><code>mix-blend-mode</code> applies to svg, g, use, image, path, rect, circle, ellipse, line, polyline, polygon, text, tspan, and marker.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Circle with SVG background</td> + <td>Set a background color for the SVG.<br> + Create 16 <code>circle</code> elements and fill them with a solid color. + <br>Apply each <code>mix-blend-mode</code> on them.</td> + <td>The color of the <code>circle</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Ellipse with SVG background</td> + <td>Set a background color for the SVG.<br> + Create an <code>ellipse</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>ellipse</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Image with SVG background</td> + <td>Set a background color for the SVG. + <br>Create an <code>image</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td> + <td>The <code>image</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Line with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>line</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>line</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Path with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>path</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>path</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Polygon with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>polygon</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>polygon</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Polyline with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>polyline</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>polyline</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Rect with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> on it other than <code>normal</code>.</td> + <td>The color of the <code>rect</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Text with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>text</code> element and apply a <code>mix-blend-mode</code> other than <code>normal</code>.</td> + <td>The text is mixed with the color of the background.</td> + </tr> + <tr> + <td>Text having tspan with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>text</code> element and a <code>tspan</code> inside it. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>tspan</code>.</td> + <td>The text is mixed with the color of the background.</td> + </tr> + <tr> + <td>Gradient with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a <code>gradient</code>. + <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td> + <td>The gradient is mixed with the color of the background.</td> + </tr> + <tr> + <td>Pattern with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a <code>pattern</code>. + <br>Apply a <code>mix-blend-mode</code> on it other than normal.</td> + <td>The pattern is mixed with the color of the background.</td> + </tr> + <tr> + <td>Set blending on an element from JavaScript</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color. + <br>Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from JavaScript.</td> + <td>The color of the <code>rect</code> is mixed with the color of the background.</td> + </tr> + <tr> + <td>Marker with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>line</code> element containing a marker. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The marker color is mixed with the color of the background.</td> + </tr> + <tr> + <td>Metadata with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>metadata</code> element containing an embedded pdf. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The metadata content is not mixed with the color of the background.</td> + </tr> + <tr> + <td>ForeignObject with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>foreignObject</code> element containing a simple xhtml file. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the marker.</td> + <td>The foreignObject content is not mixed with the color of the background.</td> + </tr> + </table> + </section> + <section> + <h4><code>mix-blend-mode</code> with SVG groups</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Group of overlapping elements with SVG background</td> + <td>Set a background color for the SVG. + <br>Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color. + <br>Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group.</td> + <td>The <code>group</code> is mixed as a whole with the color of the background.</td> + </tr> + </table> + </section> + <section> + <h4><code>mix-blend-mode</code> with isolated groups</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#mix-blend-mode" >spec</a>: + <br><q>By default, every element must create a non-isolated group.<br> + However, certain operations in SVG will create isolated groups.<br> + If one of the following features is used, the group must become isolated: + <ul> + <li>opacity</li> + <li>filters</li> + <li>3D transforms (2D transforms must NOT cause isolation)</li> + <li>blending</li> + <li>masking</li> + </ul> + </q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending two elements in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td> + <td>Only the intersection of the <code>rect</code> elements should mix.</td> + </tr> + <tr> + <td>Blending in a group with opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with filter</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>filter</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with 2D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>transform</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with 3D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a 3d transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with a mask</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>mask</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with mix-blend-mode</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>mix-blend-mode</code> other than <code>normal</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </table> + </section> + <section> + <h4>Other test cases for SVG</h4> + <table> + <tr> + <td>Blend with element having opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke-opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke</code>, <code>stroke-opacity</code> less than 1 and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having stroke-dasharray</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply a <code>stroke-dasharray</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with element having transform</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>transform</code> (any combination of <code>translate</code>, <code>rotate</code>, <code>scale</code>, <code>skew</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with SVG having viewbox and preserveAspectRatio set</td> + <td>Set a background color for the SVG, as well as <code>viewbox</code> and <code>preserveAspectRatio</code>.<br> + Create a <code>rect</code> element filled with a different solid color and apply a <code>mix-blend-mode</code> other than <code>normal</code> on it.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having color-profile set</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>color-profile</code> (<code>sRGB</code>, for example) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having overflow</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> larger than the SVG.<br> + Apply <code>overflow</code> (<code>visible</code>, <code>hidden</code>, <code>scroll</code>) and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having clip-path</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element. Apply a <code>clip-path</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having a mask</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element.<br> + Apply a <code>mask</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an element having a filter</td> + <td>Set a background color for the SVG.<br> + Create an <code>image</code> element.<br> + Apply a <code>filter</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>image</code>.</td> + <td>The <code>image</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Blend with an animated element</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element filled with a different solid color.<br> + Apply an <code>animateTransform</code> and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + <tr> + <td>Set blending from an SVG script element</td> + <td>Set a background color for the SVG.<br> + Create a <code>rect</code> element and fill it with a solid color.<br> + Apply a <code>mix-blend-mode</code> (other than <code>normal</code>) on it from an svg <code>script</code> element.</td> + <td>The <code>rect</code> will mix with the content behind it.</td> + </tr> + </table> + </section> + </section> + <section> + <h3>Test cases for <code>background-blend-mode</code></h3> + <section> + <h4>Blending between the background layers and the background color for an element with <code>background-blend-mode</code> </h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Each background layer must blend with the element's background layer that are below it and the element's background color.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Images with different formats</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + Tests should be created for <code><image></code> with different formats such as PNG, JPEG or SVG + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Gradient and background color</td> + <td> + Element with + <ul> + <li><code>background-image</code> set to an <code><gradient></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Image and gradient</td> + <td> + Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> on top of a <code><gradient></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code><image></code> is mixed with the content of the <code><gradient></code> + </td> + </tr> + <tr> + <td>Gradient and image</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code><gradient></code> on top of an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code><image></code> is mixed with the content of the <code><gradient></code></td> + </tr> + <tr> + <td>Two gradients</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code><gradient></code> on top of another <code><gradient></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul></td> + <td>The content of the two gradients is mixed</td> + </tr> + <tr> + <td>Two images</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> on top of another <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul></td> + <td>The content of the two images is mixed</td> + </tr> + <tr> + <td>Image and background color with transparency</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code> with transparency(e.g. PNG images)</li> + <li><code>background-color</code> set to a transparent color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code></td> + </tr> + <tr> + <td>Cross-fade image and gradient</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <q>cross-fade()</q> image on top of a <code><gradient></code> </li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the cross-faded image is mixed with the content of the <code><gradient></code></td> + </tr> + <tr> + <td>SVG image and background color</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a data URI for an SVG image </li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + <tr> + <td>Animated gif image and background color</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an animated gif image</li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + <tr> + <td>Set <code>background-blend-mode</code> from JavaScript</td> + <td>Element with + <ul> + <li><code>background-image</code> set to a <code>gradient</code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li>no <code>background-blend-mode</code> explicitly specified</li> + From JavaScript, set the <code>background-blend-mode</code> property to a value other than normal. + </ul> + </td> + <td>The content of the gradient is mixed with the color of the background</td> + </tr> + <tr> + <td><code>background-blend-mode</code> on element with 3D transform</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + <li><code>transform</code> set to a 3D function like rotateX, rotateY or translateZ</li> + </ul> + </td> + <td>The content of the image is mixed with the color of the background</td> + </tr> + </table> + </section> + <section> + <h4>Background layers do not blend with content outside the background (or behind the element)</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>Background layer must not blend with the content that is behind the element instead they must act as if they are rendered into an isolated group.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>One background layer</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The <code>background-image</code> is not mixed with anything outside the element</td> + </tr> + <tr> + <td>Two elements</td> + <td>2 elements required: a parent element with a child. <br> + Each one with the following properties: + <ul> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + <td>No blending between the background colors of the two elements</td> + </tr> + <tr> + <td>Parent and child with <code>background-blend-mode</code></td> + <td>2 elements required: a parent element with a child <br> + Parent properties: <br> + <ul> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + Child properties: <br> + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + <td>The content of the image from the child element does not mixes with the background color from the parent element</td> + </tr> + </table> + </section> + <section> + <h4> <code>background-blend-mode</code> list values apply to the corresponding background layer</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>The ‘background-blend-mode’ list must be applied in the same order as ‘background-image’[CSS3BG]. This means that the first element in the list will apply to the layer that is on top.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Different blend modes applied between layers</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image-list></code> containing three images: (e.g. I1, I2 and I3 ) </li> + <li><code>background-blend-mode</code> set to different <code>blendmode</code> for every image: (e.g. multiply, difference, screen) </li> + </ul></td> + <td>The content of the three images is correctly mixed <br> + (multiply for I1, difference for I2 and screen for I3) + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> list values are repeated if the list is shorter than the background layer list</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If a property doesn't have enough comma-separated values to match the number of layers, the UA must calculate its used value by repeating the list of values until there are enough.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blend mode list repeat</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image-list></code> containing three images</li> + <li><code>background-blend-mode</code> set to two different <code>blendmode</code> values</li> + </ul></td> + <td>The unspecified blend modes should be obtained by repeating the blend mode list from the beginning</td> + </tr> + </table> + </section> + <section> + <h4>The default <code>background-blend-mode</code> value for the <code>background</code> shorthand is 'normal' </h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#background-blend-mode">spec</a>: <q>If the ‘background’ [CSS3BG] shorthand is used, the ‘background-blend-mode’ property for that element must be reset to its initial value.</q> + </p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Default blend mode for 'background' shorthand</td> + <td>Element with + <ul> + <li><code>background</code> property set to an image and a color</li> + <li>No value explicitly set for <code>background-blend-mode</code> </li> + </ul></td> + <td> The computed value of <code>background-blend-mode</code> is 'normal' + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-position</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-position</code> percentage</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-position</code> specified in percentage, such as 50% 50%</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> is correctly positioned + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-size</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Background size defined in pixels</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> specified in pixels</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size defined in percentage (second phase)</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> specified in percentage</li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size cover</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> set to <code>cover</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + <tr> + <td>Background size contain</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-size</code> set to <code>contain</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> has the correct size + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-repeat</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-repeat</code> set to no-repeat</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>no-repeat</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The <code>background-image</code> is not repeated + </td> + </tr> + <tr> + <td><code>background-repeat</code> set to space</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>space</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + </td> + </tr> + <tr> + <td><code>background-repeat</code> set to round</td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-repeat</code> set to <code>round</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-clip</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-clip</code> set to <code>padding-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-clip</code> set to <code>padding-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + No background is drawn below the border (background extends to the outside edge of the padding) + </td> + </tr> + <tr> + <td><code>background-clip</code> set to <code>content-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-clip</code> set to <code>content-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background is painted within (clipped to) the content box + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-origin</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-origin</code> set to <code>border-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-origin</code> set to <code>border-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background extends to the outside edge of the border (but underneath the border in z-ordering) + </td> + </tr> + <tr> + <td><code>background-origin</code> set to <code>content-box</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-origin</code> set to <code>content-box</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background is painted within (clipped to) the content box + </td> + </tr> + </table> + </section> + <section> + <h4><code>background-blend-mode</code> for an element with <code>background-attachement</code></h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td><code>background-attachment</code> set to <code>fixed</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to an <code><image></code></li> + <li><code>background-color</code> set to a fully opaque color</li> + <li><code>background-attachment</code> set to <code>fixed</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The content of the <code>background-image</code> is mixed with the color of the <code>background-color</code> <br> + The background image will not scroll with its containing element, instead remaining stationary within the viewport + </td> + </tr> + <tr> + <td>2 background images with <code>background-attachment</code> set to <code>fixed, scroll</code></td> + <td>Element with + <ul> + <li><code>background-image</code> set to 2 <code><image></code>(s)</li> + <li><code>background-attachment</code> set to <code>fixed, scroll</code></li> + <li><code>background-blend-mode</code> other than normal</li> + </ul> + </td> + <td>The background images will be mixed when they overlap while scrolling + </td> + </tr> + </table> + </section> + </section> + <section> + <h3>Test cases for <code>isolation</code></h3> + <section> + <h4>An element with <code>isolation:isolate</code> creates a stacking context</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#csscompositingrules_CSS">spec</a>: <q>For CSS, setting ‘isolation’ to ‘isolate’ will turn the element into a stacking context [CSS21].</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation isolate</td> + <td>Have an element with <code>isolation</code> set to <code>isolate</code></td> + <td>The element creates a stacking context.</td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>isolation:isolate</code> creates an isolated group for blended children</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation of blended child which overflows</td> + <td>3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>) <br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + This element has <code>isolation:isolate</code> set.<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br> + The blending element [B] has content that lies outside the parent element. <br> + </td> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + The area of the child element outside of the intermediate parent element does not mix with the color of the parent element [P], or of the <code>body</code>. + </td> + </tr> + <tr> + <td>Isolation on intermediate element with transparent pixels</td> + <td>3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); the element <code>background-color</code> is other than <code>transparent</code><br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + The intermediate element has text content, default value for <code>background-color</code> and <code>isolation:isolate</code> set<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</d <br> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + There is no blending between the color of the parent element [P] and the color of the blended element [B]. + </td> + </tr> + <tr> + <td>Isolate inside a stacking context created by a 3d transform</td> + <td> + 3 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a>, + <a href="#test_outline" title="child of the element [P]">[IN-P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a <code>3D transform</code> applied<br> + [IN-P] - Intermediate child element between the parent [P] and the child [B]<br> + The intermediate element has <code>isolation:isolate</code> set<br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code><br> + </td> + <td> + The color of the child element [B] mixes with the color of the intermediate element [IN-P], where they overlap.<br> + There is no blending between the color of the parent element [P] and the color of the blended element [B]. + </td> + </tr> + </table> + </section> + <section> + <h4>An element with <code>isolation:auto</code> set does not change the elements existing stacking context behavior</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Isolation auto</td> + <td>Have an element with <code>isolation</code> explicitly set to <code>auto</code>, and no other style that would create a stacking context</td> + <td>The element does not create a stacking context - the computed value of its <code>z-index</code> is value <code>auto</code></td> + </tr> + <tr> + <td>Stacking context not affected by isolation</td> + <td>2 elements required: + <a href="#test_outline" title="parent element with a property that creates stacking context">[P]</a> and + <a href="#test_outline" title="Element with mix-blend-mode property other than normal">[B]</a> <br> + [P] - parent element with a property that creates a stacking context (e.g. <code>position:fixed</code>); This element has <code>isolation</code> explicitly set to <code>auto</code> <br> + [B] - element with <code>mix-blend-mode</code> other than <code>normal</code> <br> + The blending element [B] has content that lies outside the parent element. <br> + Set the <code>background-color</code> of the <code>body</code> to a value other than default + </td> + <td>The color of the parent element mixes with the color of the child element. <br> + The area of the child element outside of the parent element doesn't mix with the color of the <code>body</code>.<br> + In other words, setting the <code>isolation</code> to <code>auto</code> does not affect the creation of a stacking context by other properties. + </td> + </tr> + </table> + </section> + </section> + <section> + <h4>Test cases for <code>isolation</code> in SVG</h4> + <section> + <h4>In SVG, an element with <code>isolation:isolate</code> creates an isolated group for blended children</h4> + <p>Refers to the following assertion in the <a href="https://drafts.fxtf.org/compositing-1/#isolation">spec</a>: <q>In SVG, this defines whether an element is isolated or not.</q></p> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Blending two elements in an isolated group</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing two overlapping <code>rect</code> elements, each filled with a different solid color.<br> + Apply <code>isolation:isolate</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the second rect.</td> + <td>Only the intersection of the <code>rect</code> elements should mix.</td> + </tr> + <tr> + <td>Blending in an isolated group with 2D transform</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:isolate</code> and 2D transform on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + <tr> + <td>Set isolation on an element from JavaScript</td> + <td>Set a background color for the SVG. + <br>Create a <code>rect</code> element and fill it with a solid color and a <code>mix-blend-mode</code> other than <code>normal</code>. + <br>Apply <code>isolation:isolate</code> on it from JavaScript.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </table> + </section> + <section> + <h4>In SVG, an element with <code>isolation:auto</code> set does not change the rendering behaviour</h4> + <table> + <tr> + <th>Test name</th> + <th>Elements and styles</th> + <th>Expected result</th> + </tr> + <tr> + <td>Blending a group with <code>isolation:auto</code></td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The element will mix with the content behind it.</td> + </tr> + <tr> + <td>Blending in a group with opacity</td> + <td>Set a background color for the SVG.<br> + Create a <code>group</code> element containing a <code>rect</code> element filled with a different solid color.<br> + Apply <code>opacity</code> less than 1 and <code>isolation:auto</code> on the group and a <code>mix-blend-mode</code> other than <code>normal</code> on the <code>rect</code>.</td> + <td>The <code>rect</code> will not mix with the content behind it.</td> + </tr> + </table> + </section> + </section> + </body> +</html> diff --git a/testing/web-platform/tests/css/compositing/test-plan/test_template.png b/testing/web-platform/tests/css/compositing/test-plan/test_template.png Binary files differnew file mode 100644 index 0000000000..dbd7752efe --- /dev/null +++ b/testing/web-platform/tests/css/compositing/test-plan/test_template.png diff --git a/testing/web-platform/tests/css/compositing/text-with-svg-background-ref.html b/testing/web-platform/tests/css/compositing/text-with-svg-background-ref.html new file mode 100644 index 0000000000..dfbde22f66 --- /dev/null +++ b/testing/web-platform/tests/css/compositing/text-with-svg-background-ref.html @@ -0,0 +1,59 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS mix-blend-mode API Test</title> + <link rel="author" title="dmyang" href="mailto:yangdemo@gmail.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"><!-- 11-09-2013 @TestTWF Shenzhen --> + <meta name="flags" content="svg"> + <style type="text/css"> + .svg { + background-color: #888; + width: 500px; + display: block; + height: 60px; + margin: 10px auto; + } + .svg text { + font-size: 25px; + line-height: 50px; + mix-blend-mode: normal; + } + </style> + <style id="insert"></style> +</head> +<body> + <svg class="svg"> + <text class="multiply" x="10" y="20">mix-blend-mode: multiply;</text> + </svg> + <svg class="svg"> + <text class="screen" x="10" y="20">mix-blend-mode: screen;</text> + </svg> + <svg class="svg"> + <text class="overlay" x="10" y="20">mix-blend-mode: overlay;</text> + </svg> + <svg class="svg"> + <text class="darken" x="10" y="20">mix-blend-mode: darken;</text> + </svg> + <svg class="svg"> + <text class="lighten" x="10" y="20">mix-blend-mode: lighten;</text> + </svg> + <svg class="svg"> + <text class="color-dodge" x="10" y="20">mix-blend-mode: color-dodge;</text> + </svg> + <svg class="svg"> + <text class="color-burn" x="10" y="20">mix-blend-mode: color-burn;</text> + </svg> + <svg class="svg"> + <text class="hard-light" x="10" y="20">mix-blend-mode: hard-light;</text> + </svg> + <svg class="svg"> + <text class="soft-light" x="10" y="20">mix-blend-mode: soft-light;</text> + </svg> + <svg class="svg"> + <text class="difference" x="10" y="20">mix-blend-mode: difference;</text> + </svg> + <svg class="svg"> + <text class="exclusion" x="10" y="20">mix-blend-mode: exclusion;</text> + </svg> +</body> +</html> diff --git a/testing/web-platform/tests/css/compositing/text-with-svg-background.html b/testing/web-platform/tests/css/compositing/text-with-svg-background.html new file mode 100644 index 0000000000..2297cf9d5e --- /dev/null +++ b/testing/web-platform/tests/css/compositing/text-with-svg-background.html @@ -0,0 +1,56 @@ +<!DOCTYPE html> +<html> +<head> + <title>CSS mix-blend-mode API Test</title> + <link rel="author" title="dmyang" href="mailto:yangdemo@gmail.com"> + <link rel="reviewer" title="Rik Cabanier" href="mailto:cabanier@adobe.com"><!-- 11-09-2013 @TestTWF Shenzhen --> + <link rel="help" href="http://www.w3.org/TR/compositing-1/#mix-blend-mode"> + <meta name="flags" content="svg"> + <style type="text/css"> + .svg { + background-color: #888; + width: 500px; + display: block; + height: 60px; + margin: 10px auto; + } + .svg text { + font-size: 25px; + line-height: 20px; + } + </style> + <style id="insert" type="text/css"></style> +</head> +<body> +<script> +var SVG_NS = 'http://www.w3.org/2000/svg'; +var modes = [ + 'multiply', 'screen', 'overlay', 'darken', 'lighten', 'color-dodge', + 'color-burn', 'hard-light', 'soft-light', 'difference', 'exclusion' + ]; +var mode; +var i = 0; +var flagment = document.createDocumentFragment(); +var style = ''; + +while(mode = modes[i++]) { + var svg = document.createElementNS(SVG_NS, 'svg'); + var text = document.createElementNS(SVG_NS, 'text'); + + svg.setAttribute('class', 'svg'); + text.setAttribute('x', 10); + text.setAttribute('y', 20); + text.setAttribute('class', mode); + text.textContent = 'mix-blend-mode: ' + mode + ';'; + + svg.appendChild(text); + flagment.appendChild(svg); + + style += '.' + mode + ' {mix-blend-mode: ' + mode + ';}'; +} + +document.getElementById('insert').innerHTML = style; +document.body.appendChild(flagment); +</script> +</body> +</html> |