LibWeb: Ignore mousewheel events in ViewportPaintable

That allow EventHandler process wheel event on corresponding navigable.
For top-level navigable that means IPC call to let chrome know about
scrollbar position update.

Fixes https://github.com/SerenityOS/serenity/issues/23599
Fixes https://github.com/SerenityOS/serenity/issues/23493
Fixes https://github.com/SerenityOS/serenity/issues/23966
This commit is contained in:
Aliaksandr Kalenik 2024-04-18 09:57:48 +02:00 committed by Andreas Kling
parent d53058421a
commit bad86ca6b4
Notes: sideshowbarker 2024-07-17 18:46:57 +09:00
4 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1 @@
new scrollY: 100

View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<style>
body {
overflow: scroll;
}
.box {
height: 300px;
width: 200px;
}
.red {
background-color: red;
}
.green {
background-color: green;
}
.cyan {
background-color: cyan;
}
.pink {
background-color: pink;
}
.blue {
background-color: blue;
}
</style>
<div class="container">
<div class="box red"></div>
<div class="box green"></div>
<div class="box blue"></div>
<div class="box pink"></div>
<div class="box cyan"></div>
<div class="box red"></div>
<div class="box green"></div>
<div class="box blue"></div>
<div class="box pink"></div>
<div class="box cyan"></div>
</div>
<script src="include.js"></script>
<script>
asyncTest(done => {
const container = document.querySelector(".container");
window.onscroll = () => {
println(`new scrollY: ${window.scrollY}`);
done();
};
internals.wheel(50, 50, 0, 100);
});
</script>

View File

@ -515,6 +515,11 @@ void ViewportPaintable::recompute_selection_states()
}
}
bool ViewportPaintable::handle_mousewheel(Badge<EventHandler>, CSSPixelPoint, unsigned, unsigned, int, int)
{
return false;
}
void ViewportPaintable::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);

View File

@ -34,6 +34,8 @@ public:
JS::GCPtr<Selection::Selection> selection() const;
void recompute_selection_states();
bool handle_mousewheel(Badge<EventHandler>, CSSPixelPoint, unsigned, unsigned, int wheel_delta_x, int wheel_delta_y) override;
private:
void build_stacking_context_tree();