LibWeb: Deduplicate clipping code

This makes it so that PaintableWithLines no longer has its own
bespoke clipping logic, using the same code as regular scroll/
overflow clipping.
This commit is contained in:
Psychpsyo 2025-05-03 11:22:14 +02:00 committed by Alexander Kalenik
commit 85883ee5ce
Notes: github-actions[bot] 2025-05-13 12:32:43 +00:00
7 changed files with 52 additions and 44 deletions

View file

@ -7,7 +7,6 @@
#container {
width: 300px;
height: 300px;
border: 5px solid black;
border-radius: 50%;
overflow: hidden;
}

View file

@ -5,15 +5,27 @@
scrollbar-width: none;
}
#outer {
/*
This needs to be here so that the text is double-clipped.
This happens in the reference and causes a slight difference
in aliasing around the edges.
*/
width: 300px;
height: 300px;
border-radius: 50%;
overflow: hidden;
}
#container {
width: 300px;
height: 300px;
border: 5px solid black;
border-radius: 50%;
overflow: scroll;
font-size: 40px;
}
</style>
<div id="outer">
<div id="container">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut ultrices neque eu nisi facilisis
viverra. Integer lacinia, lacus vel condimentum suscipit, lacus felis porta nulla, eget lacinia
@ -23,6 +35,7 @@
non elit in vehicula. Etiam malesuada neque eu porta rhoncus. Curabitur vel nunc finibus ligula
posuere venenatis.
</div>
</div>
<script>
const scrollContainer = document.getElementById("container");
scrollContainer.scrollTop = 300;