ladybird/Tests/LibWeb/Ref/background-clip-text-inside-scrollable.html
Aliaksandr Kalenik a8f4ea5226 LibWeb: Fix "background-clip: text" for elements nested in scrollable
Instead of carrying the display list for a mask in each command that
might potentially be affected by "background-clip: text", this change
introduces a new AddMask command that is applied once for all
background layers within one box.

The new AddMask command includes a rectangle for the mask destination
that is translated by the corresponding scroll offset.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/857
2024-08-06 21:14:47 +02:00

31 lines
715 B
HTML

<!DOCTYPE html>
<link rel="match" href="reference/background-clip-text-inside-scrollable-ref.html" />
<style>
* {
scrollbar-width: none;
}
#text {
background: linear-gradient(#6d98cc, #8a64e5);
background-clip: text;
color: transparent;
font-size: 50px;
}
#scrollable {
width: 300px;
height: 300px;
border: 1px solid black;
overflow: scroll;
}
</style>
<div id="scrollable">
<div style="height: 200px"></div>
Clip<span id="text">Text</span>
<div style="height: 600px"></div>
</div>
<script>
const scrollContainer = document.getElementById("scrollable");
scrollContainer.scrollTop = 200;
</script>