LibWeb: Fix CSS clip-path ignoring scroll position

This commit is contained in:
Psychpsyo 2025-01-14 00:04:01 +01:00 committed by Andrew Kaster
parent 98691810b1
commit 8cd2fe3d08
Notes: github-actions[bot] 2025-01-14 03:04:23 +00:00
3 changed files with 41 additions and 0 deletions

View file

@ -128,6 +128,9 @@ struct PushStackingContext {
{
source_paintable_rect.translate_by(offset);
transform.origin.translate_by(offset.to_type<float>());
if (clip_path.has_value()) {
clip_path.value().transform(Gfx::AffineTransform().translate(offset.to_type<float>()));
}
}
};

View file

@ -0,0 +1,18 @@
<!DOCTYPE html>
<style>
body {
height: 200vh;
position: relative;
}
div {
position: absolute;
top: 100px;
background-color: green;
width: 100px;
height: 100px;
}
</style>
<div></div>
<script>
window.scrollTo(0, 100);
</script>

View file

@ -0,0 +1,20 @@
<!DOCTYPE html>
<link rel="match" href="../expected/clip-path-scrolling.html" />
<style>
body {
height: 200vh;
position: relative;
}
div {
position: absolute;
top: 100px;
background-color: green;
width: 100px;
height: 100px;
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}
</style>
<div></div>
<script>
window.scrollTo(0, 100);
</script>