LibWeb: Use PaintableBox::is_scrollable() while dispatching wheel event
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

With this change we use the same function to determine whether to render
scroll thumb and whether box wants to accept scroll UI events.
This commit is contained in:
Aliaksandr Kalenik 2024-10-07 17:50:35 +02:00 committed by Alexander Kalenik
parent a46c2a0887
commit 97066f09f4
Notes: github-actions[bot] 2024-10-07 16:36:19 +00:00
3 changed files with 2 additions and 13 deletions

View file

@ -60,12 +60,6 @@ bool Box::is_scroll_container() const
|| overflow_value_makes_box_a_scroll_container(computed_values().overflow_y());
}
bool Box::is_user_scrollable() const
{
// FIXME: Support horizontal scroll as well (overflow-x)
return computed_values().overflow_y() == CSS::Overflow::Scroll || computed_values().overflow_y() == CSS::Overflow::Auto;
}
bool Box::is_body() const
{
return dom_node() && dom_node() == document().body();

View file

@ -52,8 +52,6 @@ public:
bool is_scroll_container() const;
bool is_user_scrollable() const;
void add_contained_abspos_child(JS::NonnullGCPtr<Node> child) { m_contained_abspos_children.append(child); }
void clear_contained_abspos_children() { m_contained_abspos_children.clear(); }
Vector<JS::NonnullGCPtr<Node>> const& contained_abspos_children() const { return m_contained_abspos_children; }

View file

@ -775,12 +775,9 @@ Paintable::DispatchEventOfSameName PaintableBox::handle_mousemove(Badge<EventHan
bool PaintableBox::handle_mousewheel(Badge<EventHandler>, CSSPixelPoint, unsigned, unsigned, int wheel_delta_x, int wheel_delta_y)
{
if (!layout_box().is_user_scrollable())
return false;
// TODO: Vertical and horizontal scroll overflow should be handled seperately.
if (!has_scrollable_overflow())
if (!is_scrollable()) {
return false;
}
scroll_by(wheel_delta_x, wheel_delta_y);
return true;