Truly independent web browser
Tests/LibWeb: Test more animations inside an SVG on the compositor
Andreas Kling7111db813b2c
diff --git a/Tests/LibWeb/Ref/expected/compositor-svg-internal-transform-ref.html b/Tests/LibWeb/Ref/expected/compositor-svg-internal-transform-ref.htmlindex 419b377a33d..cc081d9a9e7 100644--- a/Tests/LibWeb/Ref/expected/compositor-svg-internal-transform-ref.html+++ b/Tests/LibWeb/Ref/expected/compositor-svg-internal-transform-ref.html@@ -11,3 +11,11 @@<rect x="10" y="18" width="4" height="4"></rect><rect x="18" y="13" width="4" height="2"></rect></svg>+<svg viewBox="0 0 24 24">+ <rect x="5" y="4" width="4" height="4"></rect>+ <rect x="16" y="2" width="8" height="8"></rect>+ <rect x="5" y="14" width="4" height="4"></rect>+ <rect x="18" y="13" width="4" height="1"></rect>+ <rect opacity="0.5" x="10" y="12" width="2" height="2"></rect>+ <g opacity="0.5"><rect x="13" y="12" width="2" height="2"></rect><rect x="14" y="13" width="2" height="2"></rect></g>+</svg>diff --git a/Tests/LibWeb/Ref/input/compositor-svg-internal-transform.html b/Tests/LibWeb/Ref/input/compositor-svg-internal-transform.htmlindex 3ff6bc90e71..9d0378730ca 100644--- a/Tests/LibWeb/Ref/input/compositor-svg-internal-transform.html+++ b/Tests/LibWeb/Ref/input/compositor-svg-internal-transform.html@@ -10,6 +10,7 @@@keyframes shift-by-its-size { from, to { transform: translate(100%, 50%); } }@keyframes turn { from, to { transform: rotate(90deg); } }@keyframes grow { from, to { transform: scale(2); } }+ @keyframes half { from, to { opacity: 0.5; } }</style><svg viewBox="0 0 24 24"><rect class="box" style="animation: squash 1s linear infinite" x="2" y="2" width="4" height="4"></rect>@@ -19,6 +20,16 @@<rect style="animation: grow 1s linear infinite" x="5" y="9" width="2" height="2"></rect><g transform="translate(2 2)"><rect class="box" style="animation: squash 1s linear infinite" x="16" y="10" width="4" height="4"></rect></g></svg>+<svg viewBox="0 0 24 24">+ <defs><rect id="square" width="4" height="4"></rect></defs>+ <use style="animation: shift 1s linear infinite" href="#square" x="2" y="2"></use>+ <use style="animation: grow 1s linear infinite" href="#square" x="8" y="1"></use>+ <svg style="animation: shift 1s linear infinite" x="2" y="12" width="6" height="6"><rect width="4" height="4"></rect></svg>+ <clipPath id="clip"><rect x="18" y="12" width="6" height="2"></rect></clipPath>+ <g clip-path="url(#clip)"><rect class="box" style="animation: squash 1s linear infinite" x="18" y="12" width="4" height="4"></rect></g>+ <rect style="animation: half 1s linear infinite" x="10" y="12" width="2" height="2"></rect>+ <g style="animation: half 1s linear infinite"><rect x="13" y="12" width="2" height="2"></rect><rect x="14" y="13" width="2" height="2"></rect></g>+</svg><script>// These animations stay on one value, so whichever side samples them draws what a box at that value draws. The// reference spells out where each box ends up without a transform, under the same scale from the viewBox.diff --git a/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txt b/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txtindex cea7813d76a..8ce25ed4498 100644--- a/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txt+++ b/Tests/LibWeb/Text/expected/css/compositor-svg-internal-transform.txt@@ -4,14 +4,25 @@ runs on the compositor:a rect in a transformed group: truea group: truea rect in a translucent group: true+ a rect in a group with a filter function: false+ a rect in a group with a clip path in user space: false+ a rect in a group with a mask in user space: false+ a use element: false+ a use element with a position: false+ a nested svg: false+ a fading rect: false+ a fading group: false+ a fading use element: false+ a fading rect in a group with a filter element: falseruns on the compositor, though it must not:- a rect in a group with a filter: false- a rect in a group with a clip path: false- a rect in a group with a mask: false+ a rect in a group with a filter element: false+ a rect in a group with a clip path in its bounding box: false+ a rect in a group with a clip path shape: false+ a rect in a group with a mask in its bounding box: false+ a rect in a group with a mask image: falsea rect in a group transformed about its fill box: falsea rect in a mask: false- a use element: false- a nested svg: false+ a fading rect in a mask: falsethe main thread leaves the animated style alone: truethe main thread asks for no frames: truethe main thread runs no rendering updates: truediff --git a/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.html b/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.htmlindex b7425bfdae4..c361aa2eee6 100644--- a/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.html+++ b/Tests/LibWeb/Text/input/css/compositor-svg-internal-transform.html@@ -2,7 +2,9 @@<script src="../include.js"></script><style>@keyframes pulse { from { transform: scaleY(0.5); } to { transform: scaleY(1); } }+ @keyframes fade { from { opacity: 0.5; } to { opacity: 1; } }.bar { animation: pulse 1s infinite; }+ .fading { animation: fade 1s infinite; }#cases { width: 100px; height: 100px; }</style><svg id="cases" viewBox="0 0 24 24"></svg>@@ -16,24 +18,37 @@}const rect = `<rect class="bar" width="5" height="5"/>`;+ const fadingRect = `<rect class="fading" width="5" height="5"/>`;+ const urlFilter = `<filter id="f"><feOffset dx="1"/></filter>`;const onTheCompositor = {"a rect": rect,"a rect in a group": `<g>${rect}</g>`,"a rect in a transformed group": `<g transform="translate(1 1)">${rect}</g>`,"a group": `<g class="bar"><rect width="5" height="5"/></g>`,"a rect in a translucent group": `<g opacity="0.5">${rect}</g>`,+ "a rect in a group with a filter function": `<g style="filter: blur(1px)">${rect}</g>`,+ "a rect in a group with a clip path in user space": `<clipPath id="c"><rect width="9" height="9"/></clipPath><g clip-path="url(#c)">${rect}</g>`,+ "a rect in a group with a mask in user space": `<mask id="m" maskUnits="userSpaceOnUse" x="0" y="0" width="9" height="9"><rect width="9" height="9" fill="white"/></mask><g mask="url(#m)">${rect}</g>`,+ "a use element": `<defs><rect id="u" width="5" height="5"/></defs><use class="bar" href="#u"/>`,+ "a use element with a position": `<defs><rect id="u" width="5" height="5"/></defs><use class="bar" href="#u" x="1" y="2"/>`,+ "a nested svg": `<svg class="bar" width="5" height="5"><rect width="5" height="5"/></svg>`,+ "a fading rect": fadingRect,+ "a fading group": `<g class="fading"><rect width="5" height="5"/></g>`,+ "a fading use element": `<defs><rect id="u" width="5" height="5"/></defs><use class="fading" href="#u" x="1"/>`,+ "a fading rect in a group with a filter element": `${urlFilter}<g filter="url(#f)">${fadingRect}</g>`,};- // The bounding box of a container includes the transforms of the boxes inside it, so what reads that box needs- // the current transform. A <use> element's own translation is part of the matrix the animation would replace.- // Resources paint on the main thread each time they are used, and a nested viewport has a transform of its own.+ // The compositor knows no bounding boxes. That of a group includes the transforms of the boxes inside it, so what+ // reads that box needs the main thread to keep those transforms current. Opacity leaves bounding boxes alone. The+ // content of a resource is painted by the main thread each time it is used, so has no nodes for the compositor.const onTheMainThread = {- "a rect in a group with a filter": `<filter id="f"><feOffset dx="1"/></filter><g filter="url(#f)">${rect}</g>`,- "a rect in a group with a clip path": `<clipPath id="c"><rect width="9" height="9"/></clipPath><g clip-path="url(#c)">${rect}</g>`,- "a rect in a group with a mask": `<mask id="m"><rect width="9" height="9" fill="white"/></mask><g mask="url(#m)">${rect}</g>`,+ "a rect in a group with a filter element": `${urlFilter}<g filter="url(#f)">${rect}</g>`,+ "a rect in a group with a clip path in its bounding box": `<clipPath id="c" clipPathUnits="objectBoundingBox"><rect width="1" height="1"/></clipPath><g clip-path="url(#c)">${rect}</g>`,+ "a rect in a group with a clip path shape": `<g style="clip-path: circle(50%)">${rect}</g>`,+ "a rect in a group with a mask in its bounding box": `<mask id="m"><rect width="9" height="9" fill="white"/></mask><g mask="url(#m)">${rect}</g>`,+ "a rect in a group with a mask image": `<g style="mask-image: linear-gradient(black, white)">${rect}</g>`,"a rect in a group transformed about its fill box": `<g style="transform: rotate(5deg); transform-box: fill-box">${rect}</g>`,"a rect in a mask": `<mask id="n">${rect}</mask><rect mask="url(#n)" width="9" height="9"/>`,- "a use element": `<defs><rect id="u" width="5" height="5"/></defs><use class="bar" href="#u" x="1"/>`,- "a nested svg": `<svg class="bar" width="5" height="5"><rect width="5" height="5"/></svg>`,+ "a fading rect in a mask": `<mask id="n">${fadingRect}</mask><rect mask="url(#n)" width="9" height="9"/>`,};asyncTest(async done => {