mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
In Element::set_scroll_offset(), when setting a pseudo-element's scroll offset, the code was also incorrectly setting the generating element's own m_scroll_offset. Added an else branch so only the pseudo-element's offset is set. Also adds a ref test for scrollable pseudo-elements to prevent regression. The test scrolls a ::before pseudo-element via wheel event and verifies the content scrolls correctly.
33 lines
541 B
HTML
33 lines
541 B
HTML
<!DOCTYPE html>
|
|
<style>
|
|
/* Wrapper clips the scrollbar area */
|
|
.wrapper {
|
|
width: 85px;
|
|
height: 60px;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.scrollable {
|
|
display: block;
|
|
white-space: pre-wrap;
|
|
width: 100px;
|
|
height: 60px;
|
|
overflow: scroll;
|
|
background: lightblue;
|
|
}
|
|
</style>
|
|
<div class="wrapper">
|
|
<div class="scrollable">Line 1
|
|
Line 2
|
|
Line 3
|
|
Line 4
|
|
Line 5
|
|
Line 6
|
|
Line 7
|
|
Line 8</div>
|
|
</div>
|
|
<script>
|
|
// Scroll to the same position as the test (40px)
|
|
document.querySelector('.scrollable').scrollTop = 40;
|
|
</script>
|