mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 18:02:20 +00:00
LibWeb: Rename is_scrollable()
to could_be_scrolled_by_wheel_event()
Previous name for misleading because it checks if box could be scrolled by user input event which is diffent from checking if box is scrollable. For example box with `overflow: hidden` is scrollable but it can't be scrolled by user input event.
This commit is contained in:
parent
dd37d1c536
commit
74dde4dc0f
Notes:
github-actions[bot]
2025-01-30 23:39:27 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 74dde4dc0f
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3410
Reviewed-by: https://github.com/gmta ✅
4 changed files with 10 additions and 10 deletions
|
@ -335,7 +335,7 @@ void PaintableBox::after_paint(PaintContext& context, [[maybe_unused]] PaintPhas
|
|||
}
|
||||
}
|
||||
|
||||
bool PaintableBox::is_scrollable(ScrollDirection direction) const
|
||||
bool PaintableBox::could_be_scrolled_by_wheel_event(ScrollDirection direction) const
|
||||
{
|
||||
auto overflow = direction == ScrollDirection::Horizontal ? computed_values().overflow_x() : computed_values().overflow_y();
|
||||
auto scrollable_overflow_rect = this->scrollable_overflow_rect();
|
||||
|
@ -348,9 +348,9 @@ bool PaintableBox::is_scrollable(ScrollDirection direction) const
|
|||
return overflow == CSS::Overflow::Scroll;
|
||||
}
|
||||
|
||||
bool PaintableBox::is_scrollable() const
|
||||
bool PaintableBox::could_be_scrolled_by_wheel_event() const
|
||||
{
|
||||
return is_scrollable(ScrollDirection::Horizontal) || is_scrollable(ScrollDirection::Vertical);
|
||||
return could_be_scrolled_by_wheel_event(ScrollDirection::Horizontal) || could_be_scrolled_by_wheel_event(ScrollDirection::Vertical);
|
||||
}
|
||||
|
||||
static constexpr CSSPixels scrollbar_thumb_thickness = 8;
|
||||
|
@ -375,7 +375,7 @@ Optional<CSSPixelRect> PaintableBox::scroll_thumb_rect(ScrollDirection direction
|
|||
|
||||
Optional<PaintableBox::ScrollbarData> PaintableBox::compute_scrollbar_data(ScrollDirection direction) const
|
||||
{
|
||||
if (!is_scrollable(direction)) {
|
||||
if (!could_be_scrolled_by_wheel_event(direction)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -907,7 +907,7 @@ 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 (!is_scrollable()) {
|
||||
if (!could_be_scrolled_by_wheel_event()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1360,7 +1360,7 @@ PaintableBox const* PaintableBox::nearest_scrollable_ancestor() const
|
|||
{
|
||||
auto const* paintable = this->containing_block();
|
||||
while (paintable) {
|
||||
if (paintable->is_scrollable())
|
||||
if (paintable->could_be_scrolled_by_wheel_event())
|
||||
return paintable;
|
||||
if (paintable->is_fixed_position())
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue