Skip to content

Truly independent web browser

LibWeb+Compositor: Move scrollbar hover into the compositor

Aliaksandr Kalenik372f58173389
diff --git a/Libraries/LibCompositing/Rust/src/display_list/commands.rs b/Libraries/LibCompositing/Rust/src/display_list/commands.rs
index 2b8a24cbede..279b4ade9b5 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/commands.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/commands.rs
@@ -1705,7 +1705,6 @@ pub struct CompositorScrollbar {
pub track_color: Color,
pub vertical: bool,
pub is_painted_by_compositor: bool,
- pub display_list_paints_enlarged_scrollbar: bool,
}
ffi_bytes_fields!(CompositorScrollbar {
document_id,
@@ -1722,8 +1721,7 @@ ffi_bytes_fields!(CompositorScrollbar {
thumb_color,
track_color,
vertical,
- is_painted_by_compositor,
- display_list_paints_enlarged_scrollbar
+ is_painted_by_compositor
});
impl DisplayListCommand for CompositorScrollbar {
@@ -1737,6 +1735,8 @@ pub struct PaintScrollBar {
pub gutter_rect: IntRect,
pub thumb_rect: IntRect,
pub track_rect: IntRect,
+ // The compositor presents the scrollbar growing into this rect as it is hovered.
+ pub expanded_gutter_rect: IntRect,
pub scroll_size: f64,
pub thumb_color: Color,
pub track_color: Color,
@@ -1747,6 +1747,7 @@ ffi_bytes_fields!(PaintScrollBar {
gutter_rect,
thumb_rect,
track_rect,
+ expanded_gutter_rect,
scroll_size,
thumb_color,
track_color,
@@ -1756,7 +1757,11 @@ ffi_bytes_fields!(PaintScrollBar {
impl DisplayListCommand for PaintScrollBar {
const COMMAND_TYPE: DisplayListCommandType = DisplayListCommandType::PaintScrollBar;
fn bounding_rect(&self) -> Option<IntRect> {
- Some(self.track_rect.united(self.thumb_rect))
+ Some(
+ self.track_rect
+ .united(self.thumb_rect)
+ .united(self.expanded_gutter_rect),
+ )
}
}
diff --git a/Libraries/LibCompositing/Rust/src/display_list/damage.rs b/Libraries/LibCompositing/Rust/src/display_list/damage.rs
index 09eb759138a..f95b1089a66 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/damage.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/damage.rs
@@ -2203,6 +2203,7 @@ mod tests {
gutter_rect: IntRect::default(),
thumb_rect: IntRect::new(10, 12, 20, 8),
track_rect: IntRect::new(10, 10, 80, 12),
+ expanded_gutter_rect: IntRect::default(),
scroll_size: 0.75,
thumb_color: RED,
track_color: Color::TRANSPARENT,
@@ -2430,7 +2431,6 @@ mod tests {
track_color: Color::TRANSPARENT,
vertical: true,
is_painted_by_compositor,
- display_list_paints_enlarged_scrollbar: false,
},
None,
ContextRef::default(),
diff --git a/Libraries/LibCompositing/Rust/src/display_list/validate.rs b/Libraries/LibCompositing/Rust/src/display_list/validate.rs
index d182c25fd22..5df424e508b 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/validate.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/validate.rs
@@ -525,7 +525,6 @@ fn validate_command_fields(
T::CompositorScrollbar => {
p.bool_at(offset_of!(CompositorScrollbar, vertical))?;
p.bool_at(offset_of!(CompositorScrollbar, is_painted_by_compositor))?;
- p.bool_at(offset_of!(CompositorScrollbar, display_list_paints_enlarged_scrollbar))?;
}
T::PaintScrollBar => p.bool_at(offset_of!(PaintScrollBar, vertical))?,
T::CompositorSnapContainer => {
diff --git a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp
index faa90630ee7..6c4723c3b64 100644
--- a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp
+++ b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.cpp
@@ -162,7 +162,6 @@ AsyncScrollingState async_scrolling_state_from_display_list(Compositing::Display
.track_color = command.track_color,
.vertical = command.vertical,
.is_painted_by_compositor = command.is_painted_by_compositor,
- .display_list_paints_enlarged_scrollbar = command.display_list_paints_enlarged_scrollbar,
});
break;
}
diff --git a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h
index 91b213b0845..05c2c9772f9 100644
--- a/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h
+++ b/Libraries/LibCompositing/Scrolling/AsyncScrollingState.h
@@ -148,10 +148,9 @@ struct AsyncScrollbar {
Color thumb_color;
Color track_color;
bool vertical { false };
- // The compositor paints the viewport's scrollbars itself and owns their hover expansion. The display list paints
- // every other scrollbar, in whichever of the two geometries the main thread currently gives it.
+ // The compositor paints the viewport's scrollbars itself. The display list paints every other scrollbar thin, which
+ // the compositor presents growing as it is hovered, as it does its own.
bool is_painted_by_compositor { false };
- bool display_list_paints_enlarged_scrollbar { false };
};
// A scroll node that is a snap container, with the geometry snap positions are selected from.
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index 014384b4aa3..0af11050749 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -778,7 +778,6 @@ set(SOURCES
Painting/CompositorAnimationEffectState.cpp
Painting/PaintingRustBridge.cpp
Painting/ResizeHandle.cpp
- Painting/Scrollbar.cpp
Painting/Scrolling.cpp
Painting/ScrollSnap.cpp
Painting/SvgPaintResources.cpp
diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp
index 8a3cd31567f..dfc6de327e7 100644
--- a/Libraries/LibWeb/DOM/Document.cpp
+++ b/Libraries/LibWeb/DOM/Document.cpp
@@ -11485,7 +11485,7 @@ Optional<Painting::HitTestResult> Document::hit_test(Layout::BegunRead const& re
// the transforms that apply to the descendants of the viewport, return the associated element and terminate
// these steps.
auto result = query->list().hit_test(read, position, *query);
- if (result.has_value() && (result->chrome_widget || result->dom_node()))
+ if (result.has_value() && (result->chrome_widget || result->is_scrollbar || result->dom_node()))
return result;
// 3. If the document has a root element, return the root element and terminate these steps.
diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h
index f7417e6c06e..45a72240673 100644
--- a/Libraries/LibWeb/Forward.h
+++ b/Libraries/LibWeb/Forward.h
@@ -61,7 +61,6 @@ class ChromeWidgetRegistry;
enum class PaintCommandCacheMode : u8;
struct GradientPaintStyle;
struct PatternPaintStyle;
-class Scrollbar;
}
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.cpp b/Libraries/LibWeb/HTML/LocalNavigable.cpp
index 52748cf3aa2..bee714b90d3 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.cpp
+++ b/Libraries/LibWeb/HTML/LocalNavigable.cpp
@@ -94,7 +94,6 @@
#include <LibWeb/Painting/PaintableTypes.h>
#include <LibWeb/Painting/PaintingRustBridge.h>
#include <LibWeb/Painting/ScrollSnap.h>
-#include <LibWeb/Painting/Scrollbar.h>
#include <LibWeb/Platform/Timer.h>
#include <LibWeb/Selection/Selection.h>
#include <LibWeb/UIEvents/CompositionEvent.h>
@@ -5059,7 +5058,7 @@ bool LocalNavigable::set_scroll_offset_for(Web::AsyncScrollNodeStableID stable_n
return Painting::set_scroll_offset(*layout_node, scroll_offset) == Painting::ScrollHandled::Yes;
}
-RefPtr<Painting::Scrollbar> LocalNavigable::scrollbar_dragged_by_compositor(Layout::BegunRead const& read, Web::ScrollbarDraggedByCompositor const& scrollbar)
+DOM::Element* LocalNavigable::element_whose_scrollbar_is_dragged_by_compositor(Layout::BegunRead const& read, Web::ScrollbarDraggedByCompositor const& scrollbar)
{
auto document = active_document();
if (!document)
@@ -5067,8 +5066,7 @@ RefPtr<Painting::Scrollbar> LocalNavigable::scrollbar_dragged_by_compositor(Layo
auto* scrolling_box = layout_node_for_async_scroll_node(read, *document, scrollbar.scroller_stable_node_id);
if (!scrolling_box || !Painting::has_committed_box(*scrolling_box))
return nullptr;
- auto direction = scrollbar.vertical ? Painting::ScrollDirection::Vertical : Painting::ScrollDirection::Horizontal;
- return document->chrome_widget_registry().get_or_create_scrollbar(document->layout_node_arena(), Painting::committed_row_slot(*scrolling_box), direction);
+ return element_for_async_scroll_node_stable_id(*document, scrollbar.scroller_stable_node_id);
}
// NB: A scroll the compositor reports can arrive while layout is out of date, so this reads the committed layout.
diff --git a/Libraries/LibWeb/HTML/LocalNavigable.h b/Libraries/LibWeb/HTML/LocalNavigable.h
index 8cf68e6e293..d965c47161c 100644
--- a/Libraries/LibWeb/HTML/LocalNavigable.h
+++ b/Libraries/LibWeb/HTML/LocalNavigable.h
@@ -421,7 +421,9 @@ public:
};
void note_user_scroll_gesture_of(Web::AsyncScrollNodeStableID, Optional<CSSPixelPoint> scroll_offset_at_gesture_start, UserScrollMovedBox, SnapPositionSelection = SnapPositionSelection::AtGestureEnd);
void note_user_scroll_input_intent(Compositing::SnapSelectionStrategy::Type);
- RefPtr<Painting::Scrollbar> scrollbar_dragged_by_compositor(Layout::BegunRead const& read, Web::ScrollbarDraggedByCompositor const&);
+ // The element whose scrollbar the compositor drags, or the element generating the pseudo-element whose scrollbar
+ // it drags, as long as the box the compositor scrolls is still there.
+ DOM::Element* element_whose_scrollbar_is_dragged_by_compositor(Layout::BegunRead const& read, Web::ScrollbarDraggedByCompositor const&);
// Returns false if the scroller is not in this navigable's active document.
bool set_overlay_scrollbar_hidden(Web::AsyncScrollNodeStableID, bool vertical, bool hidden);
void note_user_scroll_gesture_phase(Web::ScrollGesturePhase);
diff --git a/Libraries/LibWeb/Page/EventHandler.cpp b/Libraries/LibWeb/Page/EventHandler.cpp
index e402666ea82..f3fb29f2853 100644
--- a/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Libraries/LibWeb/Page/EventHandler.cpp
@@ -72,7 +72,6 @@
#include <LibWeb/Painting/DocumentPaintState.h>
#include <LibWeb/Painting/HitTestDisplayList.h>
#include <LibWeb/Painting/ScrollSnap.h>
-#include <LibWeb/Painting/Scrollbar.h>
#include <LibWeb/Selection/Selection.h>
#include <LibWeb/UIEvents/EventNames.h>
#include <LibWeb/UIEvents/InputEvent.h>
@@ -396,13 +395,18 @@ EventResult EventHandler::handle_mousedown(CSSPixelPoint visual_viewport_positio
&& m_navigable->has_compositor_context()
&& m_navigable->compositor_context().id() == scrollbar_dragged_by_compositor->context_id;
if (scrollbar_is_in_this_document) {
- auto scrollbar = m_navigable->scrollbar_dragged_by_compositor(read, *scrollbar_dragged_by_compositor);
- if (!scrollbar)
+ auto* scroller = m_navigable->element_whose_scrollbar_is_dragged_by_compositor(read, *scrollbar_dragged_by_compositor);
+ if (!scroller)
return EventResult::Dropped;
- scrollbar->begin_drag_driven_by_compositor();
record_input_routing(InputRoutingDecision::ScrollbarDragDrivenByCompositor, scrollbar_dragged_by_compositor->scroller_stable_node_id);
- chrome_widget = scrollbar;
+ // The scrollbar the compositor presents grows wider than the one hit tested here, so the press goes to the
+ // scroller whatever is under the pointer.
+ if (auto* scroller_layout_node = scroller->layout_node(read)) {
+ node = scroller;
+ target_layout_node = scroller_layout_node;
+ }
}
+ auto pressed_on_chrome = chrome_widget || target->is_scrollbar || scrollbar_is_in_this_document;
if (button == UIEvents::MouseButton::Primary) {
clear_mousedown_tracking();
@@ -470,7 +474,7 @@ EventResult EventHandler::handle_mousedown(CSSPixelPoint visual_viewport_positio
if (!has_committed_root_box())
return EventResult::Accepted;
- if (!chrome_widget)
+ if (!pressed_on_chrome)
run_mousedown_default_actions(read, *document, visual_viewport_position, button, modifiers, click_count);
return EventResult::Handled;
@@ -840,7 +844,7 @@ EventResult EventHandler::handle_mouseup(CSSPixelPoint visual_viewport_position,
// https://www.w3.org/TR/pointerevents3/#event-dispatch
// Dispatch event to target following the [UIEVENTS] spec.
if (fire_click_events(*click_target, coordinates, screen_position, button, buttons, modifiers, click_count)
- && !chrome_widget) {
+ && !chrome_widget && !target->is_scrollbar) {
// NB: Event dispatches above may have run JS that invalidated layout.
document->update_layout(DOM::UpdateLayoutReason::EventHandlerRunActivationBehavior);
@@ -1401,7 +1405,6 @@ EventResult EventHandler::handle_mouseleave()
if (!has_committed_root_box())
return EventResult::Dropped;
- update_hovered_chrome_widget(nullptr);
update_cursor(read, nullptr, nullptr, nullptr);
m_last_known_mouse_visual_viewport_position.clear();
update_nested_navigable_under_pointer(nullptr);
@@ -1464,7 +1467,7 @@ EventResult EventHandler::handle_mousecancel()
// 4. Implicitly release the pointer capture if the pointer is currently captured.
// NB: Firing the pointercancel event released the capture, and the press is released as this returns.
- // FIXME: Also end a drag that a chrome widget, such as a scrollbar, has captured.
+ // FIXME: Also end a drag that a chrome widget, such as a resize handle, has captured.
return EventResult::Handled;
}
@@ -1589,7 +1592,6 @@ void EventHandler::update_hover_after_scroll(CSSPixelPoint visual_viewport_posit
}
ArmedScopeGuard clear_hover = [&] {
- update_hovered_chrome_widget(nullptr);
update_cursor(read, nullptr, nullptr, nullptr);
track_the_effective_position_of_the_legacy_mouse_pointer(nullptr);
};
@@ -1631,7 +1633,6 @@ void EventHandler::update_hover_after_scroll(CSSPixelPoint visual_viewport_posit
if (!parent_element_for_event_dispatch(*target_layout_node, node, layout_node))
return;
- update_hovered_chrome_widget(chrome_widget);
update_cursor(read, target_layout_node, *node, chrome_widget, hit_text_fragment);
m_cursor_resolved_before_hover = true;
@@ -3422,6 +3423,7 @@ Optional<EventHandler::Target> EventHandler::target_for_mouse_position(CSSPixelP
.hit_node = result->hit_node,
.arena = result->arena,
.chrome_widget = result->chrome_widget,
+ .is_scrollbar = result->is_scrollbar,
.node = result->node,
.index_in_node = result->index_in_node,
.is_text_fragment = result->is_text_fragment,
@@ -5360,7 +5362,7 @@ EventHandler::DispatchedPointerEvent EventHandler::dispatch_a_pointer_event_for_
auto hit_test_coordinates = coordinates;
if (pointer_capture_target) {
node = pointer_capture_target;
- // NB: A chrome widget under the pointer, such as a scrollbar, is a hit test result as well.
+ // NB: A chrome widget under the pointer, such as a resize handle, is a hit test result as well.
chrome_widget = nullptr;
if (auto* pointer_capture_target_layout_node = node->layout_node(read))
coordinates = compute_mouse_event_coordinates(coordinates.visual_viewport_position, coordinates.viewport_position, *pointer_capture_target_layout_node);
@@ -5415,8 +5417,6 @@ EventHandler::DispatchedPointerEvent EventHandler::dispatch_a_pointer_event_for_
set_node_and_ancestors_being_activated(m_mousedown_target.ptr(), false);
}
- update_hovered_chrome_widget(chrome_widget);
-
// The events above may have changed layout, and chrome widgets are very likely to touch committed boxes.
if (chrome_widget || m_captured_chrome_widget)
document.update_layout(DOM::UpdateLayoutReason::EventHandlerDispatchChromeWidgetEvent);
@@ -5636,17 +5636,6 @@ bool EventHandler::dispatch_chrome_widget_pointer_event(RefPtr<Painting::ChromeW
return allow_default_behavior;
}
-void EventHandler::update_hovered_chrome_widget(RefPtr<Painting::ChromeWidget> widget)
-{
- if (m_hovered_chrome_widget == widget)
- return;
- if (m_hovered_chrome_widget)
- m_hovered_chrome_widget->mouse_leave();
- m_hovered_chrome_widget = move(widget);
- if (m_hovered_chrome_widget)
- m_hovered_chrome_widget->mouse_enter();
-}
-
static Gfx::Cursor resolve_cursor(Layout::NodeWithStyle const& layout_node, Layout::NodeWithStyle const* cursor_values_owner, ReadonlySpan<CSS::ComputedValuesFFI::ComputedCursor> cursor_data, Gfx::StandardCursor auto_cursor)
{
ReadonlySpan<RefPtr<CSS::CursorStyleValue const>> cursor_style_values;
@@ -5740,7 +5729,6 @@ void EventHandler::clear_per_test_input_state(Badge<Internals::Internals>)
m_middle_button_scroll_handler = nullptr;
m_mouse_pointer.prevent_mouse_event = false;
m_additional_pointers.clear();
- m_hovered_chrome_widget = nullptr;
m_captured_chrome_widget = nullptr;
m_effective_legacy_mouse_pointer_position = nullptr;
m_effective_legacy_mouse_pointer_type = PointerType::Mouse;
diff --git a/Libraries/LibWeb/Page/EventHandler.h b/Libraries/LibWeb/Page/EventHandler.h
index 9aa9e45db82..ccf566848b7 100644
--- a/Libraries/LibWeb/Page/EventHandler.h
+++ b/Libraries/LibWeb/Page/EventHandler.h
@@ -231,6 +231,7 @@ private:
Compositing::RustFFI::NodeSlotId hit_node;
NonnullRefPtr<Layout::NodeArena> arena;
RefPtr<Painting::ChromeWidget> chrome_widget;
+ bool is_scrollbar { false };
DOM::NodeIdentity node;
Optional<int> index_in_node;
bool is_text_fragment { false };
@@ -305,7 +306,6 @@ private:
void report_hovered_node_to_client(GC::Ptr<DOM::Node>);
bool dispatch_chrome_widget_pointer_event(RefPtr<Painting::ChromeWidget>, Utf16FlyString const& type, unsigned button, CSSPixelPoint visual_viewport_position);
- void update_hovered_chrome_widget(RefPtr<Painting::ChromeWidget>);
void update_nested_navigable_under_pointer(GC::Ptr<HTML::LocalNavigable>);
void update_cursor(Layout::BegunRead const& read, Layout::Node const*, GC::Ptr<DOM::Node> host_element, RefPtr<Painting::ChromeWidget>, bool hit_text_fragment = false);
@@ -320,7 +320,6 @@ private:
InputEventsTarget* m_mouse_selection_target { nullptr };
GC::Ptr<DOM::Range> m_selection_origin;
- RefPtr<Painting::ChromeWidget> m_hovered_chrome_widget;
RefPtr<Painting::ChromeWidget> m_captured_chrome_widget;
GC::Weak<DOM::Node> m_effective_legacy_mouse_pointer_position;
diff --git a/Libraries/LibWeb/Painting/ChromeWidget.cpp b/Libraries/LibWeb/Painting/ChromeWidget.cpp
index 068d49f89ac..d1b495a3b8d 100644
--- a/Libraries/LibWeb/Painting/ChromeWidget.cpp
+++ b/Libraries/LibWeb/Painting/ChromeWidget.cpp
@@ -9,7 +9,6 @@
#include <LibWeb/Painting/BoxViews.h>
#include <LibWeb/Painting/ChromeWidget.h>
#include <LibWeb/Painting/ResizeHandle.h>
-#include <LibWeb/Painting/Scrollbar.h>
namespace Web::Painting {
@@ -20,63 +19,30 @@ ChromeWidgetRegistry::~ChromeWidgetRegistry()
clear();
}
-RefPtr<Scrollbar> ChromeWidgetRegistry::scrollbar(Compositing::RustFFI::NodeSlotId slot, ScrollDirection direction) const
-{
- auto entry = m_entries.find(slot.index);
- if (entry == m_entries.end())
- return nullptr;
- return direction == ScrollDirection::Horizontal ? entry->value.horizontal_scrollbar : entry->value.vertical_scrollbar;
-}
-
-NonnullRefPtr<Scrollbar> ChromeWidgetRegistry::get_or_create_scrollbar(Layout::NodeArena& arena, Compositing::RustFFI::NodeSlotId slot, ScrollDirection direction)
-{
- auto& entry = m_entries.ensure(slot.index);
- auto& scrollbar = direction == ScrollDirection::Horizontal ? entry.horizontal_scrollbar : entry.vertical_scrollbar;
- if (!scrollbar)
- scrollbar = Scrollbar::create(arena, slot, direction);
- return *scrollbar;
-}
-
RefPtr<ResizeHandle> ChromeWidgetRegistry::resize_handle(Compositing::RustFFI::NodeSlotId slot) const
{
- auto entry = m_entries.find(slot.index);
- if (entry == m_entries.end())
+ auto resize_handle = m_resize_handles.find(slot.index);
+ if (resize_handle == m_resize_handles.end())
return nullptr;
- return entry->value.resize_handle;
+ return resize_handle->value;
}
NonnullRefPtr<ResizeHandle> ChromeWidgetRegistry::get_or_create_resize_handle(Layout::NodeArena& arena, Compositing::RustFFI::NodeSlotId slot)
{
- auto& entry = m_entries.ensure(slot.index);
- if (!entry.resize_handle)
- entry.resize_handle = ResizeHandle::create(arena, slot);
- return *entry.resize_handle;
+ return m_resize_handles.ensure(slot.index, [&] { return ResizeHandle::create(arena, slot); });
}
void ChromeWidgetRegistry::drop_widgets_for_slot(Compositing::RustFFI::NodeSlotId slot)
{
- auto entry = m_entries.take(slot.index);
- if (!entry.has_value())
- return;
- if (entry->horizontal_scrollbar)
- entry->horizontal_scrollbar->detach({});
- if (entry->vertical_scrollbar)
- entry->vertical_scrollbar->detach({});
- if (entry->resize_handle)
- entry->resize_handle->detach({});
+ if (auto resize_handle = m_resize_handles.take(slot.index); resize_handle.has_value())
+ resize_handle.value()->detach({});
}
void ChromeWidgetRegistry::clear()
{
- for (auto& entry : m_entries) {
- if (entry.value.horizontal_scrollbar)
- entry.value.horizontal_scrollbar->detach({});
- if (entry.value.vertical_scrollbar)
- entry.value.vertical_scrollbar->detach({});
- if (entry.value.resize_handle)
- entry.value.resize_handle->detach({});
- }
- m_entries.clear();
+ for (auto& entry : m_resize_handles)
+ entry.value->detach({});
+ m_resize_handles.clear();
}
ChromeWidget::ChromeWidget(Layout::NodeArena& arena, Compositing::RustFFI::NodeSlotId slot)
diff --git a/Libraries/LibWeb/Painting/ChromeWidget.h b/Libraries/LibWeb/Painting/ChromeWidget.h
index 35a63acc5be..43f6bf41760 100644
--- a/Libraries/LibWeb/Painting/ChromeWidget.h
+++ b/Libraries/LibWeb/Painting/ChromeWidget.h
@@ -44,29 +44,22 @@ struct PhysicalResizeAxes {
PhysicalResizeAxes physical_resize_axes(Layout::Node const&);
-class Scrollbar;
class ResizeHandle;
+// The compositor takes the pointer input of scrollbars, so the resize handle is the only chrome widget the main thread
+// keeps.
class ChromeWidgetRegistry : public RefCounted<ChromeWidgetRegistry> {
public:
ChromeWidgetRegistry();
~ChromeWidgetRegistry();
- RefPtr<Scrollbar> scrollbar(Compositing::RustFFI::NodeSlotId, ScrollDirection) const;
- NonnullRefPtr<Scrollbar> get_or_create_scrollbar(Layout::NodeArena&, Compositing::RustFFI::NodeSlotId, ScrollDirection);
RefPtr<ResizeHandle> resize_handle(Compositing::RustFFI::NodeSlotId) const;
NonnullRefPtr<ResizeHandle> get_or_create_resize_handle(Layout::NodeArena&, Compositing::RustFFI::NodeSlotId);
void drop_widgets_for_slot(Compositing::RustFFI::NodeSlotId);
void clear();
private:
- struct Entry {
- RefPtr<Scrollbar> horizontal_scrollbar;
- RefPtr<Scrollbar> vertical_scrollbar;
- RefPtr<ResizeHandle> resize_handle;
- };
-
- HashMap<u32, Entry> m_entries;
+ HashMap<u32, NonnullRefPtr<ResizeHandle>> m_resize_handles;
};
class ChromeWidget
@@ -76,8 +69,6 @@ public:
virtual ~ChromeWidget() = default;
virtual MouseAction handle_pointer_event(Utf16FlyString const& type, unsigned button, CSSPixelPoint visual_viewport_position) = 0;
- virtual void mouse_enter() = 0;
- virtual void mouse_leave() = 0;
virtual Optional<CSS::CursorPredefined> cursor() const { return {}; }
diff --git a/Libraries/LibWeb/Painting/HitTestDisplayList.cpp b/Libraries/LibWeb/Painting/HitTestDisplayList.cpp
index f2f23a6f5f7..0f72314eda5 100644
--- a/Libraries/LibWeb/Painting/HitTestDisplayList.cpp
+++ b/Libraries/LibWeb/Painting/HitTestDisplayList.cpp
@@ -15,7 +15,6 @@
#include <LibWeb/Painting/HitTestDisplayList.h>
#include <LibWeb/Painting/PaintingRustBridge.h>
#include <LibWeb/Painting/ResizeHandle.h>
-#include <LibWeb/Painting/Scrollbar.h>
namespace Web::Painting {
@@ -32,16 +31,12 @@ NonnullRefPtr<HitTestDisplayList> HitTestDisplayList::create_from_rust_recording
auto& context = *static_cast<VisitContext*>(sink);
switch (static_cast<ChromeWidgetKind>(chrome_widget_kind)) {
case ChromeWidgetKind::None:
+ case ChromeWidgetKind::HorizontalScrollbar:
+ case ChromeWidgetKind::VerticalScrollbar:
break;
case ChromeWidgetKind::ResizeHandle:
(void)context.chrome_widget_registry.get_or_create_resize_handle(context.arena, paintable);
break;
- case ChromeWidgetKind::HorizontalScrollbar:
- (void)context.chrome_widget_registry.get_or_create_scrollbar(context.arena, paintable, ScrollDirection::Horizontal);
- break;
- case ChromeWidgetKind::VerticalScrollbar:
- (void)context.chrome_widget_registry.get_or_create_scrollbar(context.arena, paintable, ScrollDirection::Vertical);
- break;
}
});
return list;
@@ -173,17 +168,9 @@ Layout::Node const* HitTestDisplayList::layout_node_for_item(Layout::BegunRead c
RefPtr<ChromeWidget> HitTestDisplayList::chrome_widget_for_item(Item item) const
{
- switch (item.chrome_widget_kind()) {
- case ChromeWidgetKind::None:
- return nullptr;
- case ChromeWidgetKind::ResizeHandle:
+ if (item.chrome_widget_kind() == ChromeWidgetKind::ResizeHandle)
return m_chrome_widget_registry->resize_handle(item.paintable());
- case ChromeWidgetKind::HorizontalScrollbar:
- return m_chrome_widget_registry->scrollbar(item.paintable(), ScrollDirection::Horizontal);
- case ChromeWidgetKind::VerticalScrollbar:
- return m_chrome_widget_registry->scrollbar(item.paintable(), ScrollDirection::Vertical);
- }
- VERIFY_NOT_REACHED();
+ return nullptr;
}
// https://html.spec.whatwg.org/multipage/image-maps.html#image-map-processing-model
@@ -244,6 +231,7 @@ HitTestResult HitTestDisplayList::hit_test_result_for_item(Layout::BegunRead con
.hit_node = hit_node,
.arena = *m_arena,
.chrome_widget = chrome_widget_for_item(item),
+ .is_scrollbar = first_is_one_of(item.chrome_widget_kind(), ChromeWidgetKind::HorizontalScrollbar, ChromeWidgetKind::VerticalScrollbar),
.is_text_fragment = resolved.is_text_fragment,
};
if (resolved.has_index_in_node)
diff --git a/Libraries/LibWeb/Painting/HitTestResult.h b/Libraries/LibWeb/Painting/HitTestResult.h
index c1cbc976df2..38abafa1172 100644
--- a/Libraries/LibWeb/Painting/HitTestResult.h
+++ b/Libraries/LibWeb/Painting/HitTestResult.h
@@ -26,6 +26,8 @@ struct HitTestResult {
Compositing::RustFFI::NodeSlotId hit_node;
NonnullRefPtr<Layout::NodeArena> arena;
RefPtr<ChromeWidget> chrome_widget {};
+ // A scrollbar takes the pointer in the compositor, and the scroller is hit here.
+ bool is_scrollbar { false };
size_t index_in_node { 0 };
bool is_text_fragment { false };
diff --git a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
index 609cf92c07a..65d34d2b247 100644
--- a/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
+++ b/Libraries/LibWeb/Painting/PaintingRustBridge.cpp
@@ -54,7 +54,6 @@
#include <LibWeb/Painting/PaintingRustBridge.h>
#include <LibWeb/Painting/ResizeHandle.h>
#include <LibWeb/Painting/ScrollSnap.h>
-#include <LibWeb/Painting/Scrollbar.h>
#include <LibWeb/Painting/Scrolling.h>
#include <LibWeb/Platform/FontPlugin.h>
#include <LibWeb/SVG/SVGClipPathElement.h>
diff --git a/Libraries/LibWeb/Painting/ResizeHandle.h b/Libraries/LibWeb/Painting/ResizeHandle.h
index 0d62d8653fb..87ba904c063 100644
--- a/Libraries/LibWeb/Painting/ResizeHandle.h
+++ b/Libraries/LibWeb/Painting/ResizeHandle.h
@@ -16,8 +16,6 @@ public:
static NonnullRefPtr<ResizeHandle> create(Layout::NodeArena&, Compositing::RustFFI::NodeSlotId);
virtual MouseAction handle_pointer_event(Utf16FlyString const& type, unsigned button, CSSPixelPoint visual_viewport_position) override;
- virtual void mouse_enter() override { }
- virtual void mouse_leave() override { }
virtual Optional<CSS::CursorPredefined> cursor() const override;
diff --git a/Libraries/LibWeb/Painting/Scrollbar.cpp b/Libraries/LibWeb/Painting/Scrollbar.cpp
deleted file mode 100644
index 21473417070..00000000000
--- a/Libraries/LibWeb/Painting/Scrollbar.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibWeb/DOM/Document.h>
-#include <LibWeb/HTML/LocalNavigable.h>
-#include <LibWeb/Layout/Node.h>
-#include <LibWeb/Page/Page.h>
-#include <LibWeb/Painting/BoxViews.h>
-#include <LibWeb/Painting/Scrollbar.h>
-#include <LibWeb/UIEvents/EventNames.h>
-#include <LibWeb/UIEvents/PointerEvent.h>
-#include <LibWebCommon/UIEvents/MouseButton.h>
-
-namespace Web::Painting {
-
-NonnullRefPtr<Scrollbar> Scrollbar::create(Layout::NodeArena& arena, Compositing::RustFFI::NodeSlotId slot, ScrollDirection direction)
-{
- return adopt_ref(*new Scrollbar(arena, slot, direction));
-}
-
-Scrollbar::Scrollbar(Layout::NodeArena& arena, Compositing::RustFFI::NodeSlotId slot, ScrollDirection direction)
- : ChromeWidget(arena, slot)
- , m_direction(direction)
-{
-}
-
-void Scrollbar::begin_drag_driven_by_compositor()
-{
- m_drag_is_driven_by_compositor = true;
- push_enlarged_state();
- if (auto* node = layout_node())
- Painting::set_needs_repaint(*node, InvalidateDisplayList::PaintCommands);
-}
-
-MouseAction Scrollbar::handle_pointer_event(Utf16FlyString const& type, unsigned button, CSSPixelPoint)
-{
- if (!m_drag_is_driven_by_compositor)
- return MouseAction::None;
- if (type != UIEvents::EventNames::pointerup || button != UIEvents::MouseButton::Primary)
- return MouseAction::CaptureInput;
- release_drag();
- if (auto* node = layout_node())
- Painting::set_needs_repaint(*node, InvalidateDisplayList::PaintCommands);
- return MouseAction::None;
-}
-
-void Scrollbar::release_drag()
-{
- m_drag_is_driven_by_compositor = false;
- push_enlarged_state();
-}
-
-void Scrollbar::push_enlarged_state()
-{
- auto* node = layout_node();
- if (!node)
- return;
- Layout::RustFFI::render_state_set_scrollbar_enlarged(
- node->document_host(), committed_row_slot(*node), static_cast<Layout::RustFFI::ScrollDirection>(m_direction), is_enlarged());
-}
-
-void Scrollbar::mouse_enter()
-{
- if (m_hovered)
- return;
- m_hovered = true;
- push_enlarged_state();
- if (auto* node = layout_node())
- Painting::set_needs_repaint(*node, InvalidateDisplayList::PaintCommands);
-}
-
-void Scrollbar::mouse_leave()
-{
- if (!m_hovered)
- return;
- m_hovered = false;
- push_enlarged_state();
- if (auto* node = layout_node())
- Painting::set_needs_repaint(*node, InvalidateDisplayList::PaintCommands);
-}
-
-void Scrollbar::did_detach()
-{
- m_hovered = false;
- release_drag();
-}
-
-}
diff --git a/Libraries/LibWeb/Painting/Scrollbar.h b/Libraries/LibWeb/Painting/Scrollbar.h
deleted file mode 100644
index a68a72a8b0e..00000000000
--- a/Libraries/LibWeb/Painting/Scrollbar.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2026-present, the Ladybird developers.
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/Painting/ChromeWidget.h>
-
-namespace Web::Painting {
-
-class Scrollbar final : public ChromeWidget {
-public:
- static NonnullRefPtr<Scrollbar> create(Layout::NodeArena&, Compositing::RustFFI::NodeSlotId, ScrollDirection);
-
- bool is_enlarged() const { return m_hovered || m_drag_is_driven_by_compositor; }
-
- // The compositor scrolls for a drag it drives, and this scrollbar only keeps looking dragged until the release.
- void begin_drag_driven_by_compositor();
-
- virtual MouseAction handle_pointer_event(Utf16FlyString const& type, unsigned button, CSSPixelPoint visual_viewport_position) override;
- virtual void mouse_enter() override;
- virtual void mouse_leave() override;
-
-private:
- Scrollbar(Layout::NodeArena&, Compositing::RustFFI::NodeSlotId, ScrollDirection);
-
- void release_drag();
- void push_enlarged_state();
- virtual void did_detach() override;
-
- ScrollDirection m_direction;
- bool m_hovered { false };
- bool m_drag_is_driven_by_compositor { false };
-};
-
-}
diff --git a/Libraries/LibWeb/Rust/src/painting/chrome_geometry.rs b/Libraries/LibWeb/Rust/src/painting/chrome_geometry.rs
index ea6e882c68f..2be53ff65bd 100644
--- a/Libraries/LibWeb/Rust/src/painting/chrome_geometry.rs
+++ b/Libraries/LibWeb/Rust/src/painting/chrome_geometry.rs
@@ -233,14 +233,6 @@ pub(crate) fn maximum_scroll_offset(arena: &impl PaintRead, slot: NodeSlotId) ->
scroll_offset_bounds(arena, slot).map_or(CssPixelPoint::default(), |(_, maximum)| maximum)
}
-pub(crate) fn scrollbar_is_enlarged(arena: &impl PaintRead, slot: NodeSlotId, direction: ScrollDirection) -> bool {
- let flag = match direction {
- ScrollDirection::Horizontal => PaintableFlag::HorizontalScrollbarEnlarged,
- ScrollDirection::Vertical => PaintableFlag::VerticalScrollbarEnlarged,
- };
- arena.paintable_data(slot).has_flag(flag)
-}
-
pub(crate) fn scrollbar_is_hidden(arena: &impl PaintRead, slot: NodeSlotId, direction: ScrollDirection) -> bool {
let flag = match direction {
ScrollDirection::Horizontal => PaintableFlag::HorizontalScrollbarHidden,
diff --git a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs
index e3c88fe55f6..bdfb5ab7076 100644
--- a/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs
+++ b/Libraries/LibWeb/Rust/src/painting/display_list/dump.rs
@@ -646,8 +646,8 @@ fn dump_command(output: &mut String, command_type: DisplayListCommandType, paylo
write_field(output, "track_color", command.track_color);
write!(
output,
- " vertical={} is_painted_by_compositor={} display_list_paints_enlarged_scrollbar={}",
- command.vertical, command.is_painted_by_compositor, command.display_list_paints_enlarged_scrollbar
+ " vertical={} is_painted_by_compositor={}",
+ command.vertical, command.is_painted_by_compositor
)
.unwrap();
}
diff --git a/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rs b/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rs
index 3602124b949..cb348f72602 100644
--- a/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rs
+++ b/Libraries/LibWeb/Rust/src/painting/display_list/recorder.rs
@@ -1268,6 +1268,7 @@ impl DisplayListRecorder {
gutter_rect: IntRect,
thumb_rect: IntRect,
track_rect: IntRect,
+ expanded_gutter_rect: IntRect,
scroll_size: f64,
thumb_color: Color,
track_color: Color,
@@ -1282,6 +1283,7 @@ impl DisplayListRecorder {
gutter_rect,
thumb_rect,
track_rect,
+ expanded_gutter_rect,
scroll_size,
thumb_color,
track_color,
diff --git a/Libraries/LibWeb/Rust/src/painting/hit_test/query.rs b/Libraries/LibWeb/Rust/src/painting/hit_test/query.rs
index e4ec1b3ba99..8cb7dc09997 100644
--- a/Libraries/LibWeb/Rust/src/painting/hit_test/query.rs
+++ b/Libraries/LibWeb/Rust/src/painting/hit_test/query.rs
@@ -5,7 +5,7 @@
*/
use super::*;
-use crate::painting::chrome_geometry::{ChromeGeometry, scrollbar_is_enlarged, scrollbar_is_hidden};
+use crate::painting::chrome_geometry::{ChromeGeometry, scrollbar_is_hidden};
use crate::painting::ffi::ScrollDirection;
use crate::painting::host::FfiHitTestQueryCallbacks;
use crate::painting::paint_read::PaintRead;
@@ -146,10 +146,11 @@ impl HitTestList {
} else {
ScrollDirection::Vertical
};
- // An overlay scrollbar that has faded out takes no pointer input, as in Chromium.
+ // An overlay scrollbar that has faded out takes no pointer input, as in Chromium. The
+ // compositor grows a hovered scrollbar, which is hit tested here as it is before it grows.
!scrollbar_is_hidden(rows, node, direction)
&& chrome_geometry
- .absolute_scrollbar_rect(node, direction, scrollbar_is_enlarged(rows, node, direction))
+ .absolute_scrollbar_rect(node, direction, false)
.is_some_and(|rect| rect.contains_point(local_point))
}
_ => false,
diff --git a/Libraries/LibWeb/Rust/src/painting/paint_changes.rs b/Libraries/LibWeb/Rust/src/painting/paint_changes.rs
index d2bf4ead6ef..67522c1cb7a 100644
--- a/Libraries/LibWeb/Rust/src/painting/paint_changes.rs
+++ b/Libraries/LibWeb/Rust/src/painting/paint_changes.rs
@@ -64,12 +64,6 @@ pub(crate) enum PaintChange {
element: StyleNodeID,
style_records: HighlightStyleRecords,
},
- /// Whether the scrollbar of the row in `direction` is drawn enlarged, as it is while the user hovers or drags it.
- SetScrollbarEnlarged {
- node: NodeSlotId,
- direction: ScrollDirection,
- enlarged: bool,
- },
/// Whether the overlay scrollbar of the row in `direction` has faded out, so that it takes no pointer input.
SetScrollbarHidden {
node: NodeSlotId,
@@ -166,25 +160,6 @@ impl PaintChange {
Self::SyncHighlightPseudoStyles { element, style_records } => {
super::selection::sync_highlight_pseudo_styles(arena, element, style_records);
}
- Self::SetScrollbarEnlarged {
- node,
- direction,
- enlarged,
- } => {
- let mut rows = arena.paintable_rows_mut();
- if !rows.paintable_row_is_populated(node) {
- return;
- }
- let flag = match direction {
- ScrollDirection::Horizontal => PaintableFlag::HorizontalScrollbarEnlarged,
- ScrollDirection::Vertical => PaintableFlag::VerticalScrollbarEnlarged,
- };
- if rows.paintable_data(node).has_flag(flag) == enlarged {
- return;
- }
- rows.paintable_data_mut(node).set_flag(flag, enlarged);
- rows.push_paint_damage(node, PaintDamage::DRAW_OVERLAY | PaintDamage::HIT_OVERLAY);
- }
Self::SetScrollbarHidden {
node,
direction,
@@ -334,21 +309,6 @@ pub extern "C" fn render_state_sync_highlight_pseudo_styles(
queue(host, change);
}
-#[unsafe(no_mangle)]
-pub extern "C" fn render_state_set_scrollbar_enlarged(
- host: &DocumentHost,
- node: NodeSlotId,
- direction: ScrollDirection,
- enlarged: bool,
-) {
- let change = PaintChange::SetScrollbarEnlarged {
- node,
- direction,
- enlarged,
- };
- queue(host, change);
-}
-
#[unsafe(no_mangle)]
pub extern "C" fn render_state_set_scrollbar_hidden(
host: &DocumentHost,
diff --git a/Libraries/LibWeb/Rust/src/painting/paintable_data.rs b/Libraries/LibWeb/Rust/src/painting/paintable_data.rs
index 6c58e1f3083..a778f97009f 100644
--- a/Libraries/LibWeb/Rust/src/painting/paintable_data.rs
+++ b/Libraries/LibWeb/Rust/src/painting/paintable_data.rs
@@ -13,16 +13,14 @@ use crate::painting::display_list::commands::{ContextRef, SpatialNodeIndex};
#[repr(u32)]
pub enum PaintableFlag {
HasNonInvertibleCssTransform = 1 << 0,
- HorizontalScrollbarEnlarged = 1 << 1,
- VerticalScrollbarEnlarged = 1 << 2,
- HorizontalScrollbarHidden = 1 << 3,
- VerticalScrollbarHidden = 1 << 4,
- InLaterContainingBlockFragment = 1 << 5,
- HasLaterBoxFragments = 1 << 6,
+ HorizontalScrollbarHidden = 1 << 1,
+ VerticalScrollbarHidden = 1 << 2,
+ InLaterContainingBlockFragment = 1 << 3,
+ HasLaterBoxFragments = 1 << 4,
}
/// The flag bits that hold the writing mode of the frame a box was laid out in.
-const FRAME_WRITING_MODE_SHIFT: u32 = 7;
+const FRAME_WRITING_MODE_SHIFT: u32 = 5;
const FRAME_WRITING_MODE_MASK: u32 = 0b111;
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
diff --git a/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs b/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
index 2137f1a1b3b..52f49ed949e 100644
--- a/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
+++ b/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
@@ -344,7 +344,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
direction: ScrollDirection,
(thumb_color, track_color): (Color, Color),
is_painted_by_compositor: bool,
- display_list_paints_enlarged_scrollbar: bool,
) -> Option<CompositorScrollbar> {
let chrome_geometry = ChromeGeometry::for_recording(self.source, self.inputs);
let scrollbar = chrome_geometry.compute_scrollbar_data(paintable, direction, false)?;
@@ -379,7 +378,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
track_color,
vertical,
is_painted_by_compositor,
- display_list_paints_enlarged_scrollbar,
})
}
@@ -402,7 +400,7 @@ impl<O: Observer> PaintRecorder<'_, O> {
.blend(self.inputs.uncaptured.background_color),
);
for direction in [ScrollDirection::Vertical, ScrollDirection::Horizontal] {
- if let Some(scrollbar) = self.compositor_scrollbar_for(paintable, direction, colors, true, false) {
+ if let Some(scrollbar) = self.compositor_scrollbar_for(paintable, direction, colors, true) {
self.recorder.compositor_scrollbar(scrollbar);
}
}
@@ -416,7 +414,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
paintable: NodeSlotId,
direction: ScrollDirection,
colors: (Color, Color),
- display_list_paints_enlarged_scrollbar: bool,
) {
if self.source.node_kind_if_live(paintable) == Some(NodeKind::Viewport)
|| self.kind_of_compositor_scroll_node_recorded_for(paintable).is_none()
@@ -433,13 +430,7 @@ impl<O: Observer> PaintRecorder<'_, O> {
if !could_be_scrolled_along_direction {
return;
}
- if let Some(scrollbar) = self.compositor_scrollbar_for(
- paintable,
- direction,
- colors,
- false,
- display_list_paints_enlarged_scrollbar,
- ) {
+ if let Some(scrollbar) = self.compositor_scrollbar_for(paintable, direction, colors, false) {
self.recorder.compositor_scrollbar(scrollbar);
}
}
diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs
index 37f4f3f405e..431965f2b78 100644
--- a/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs
+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs
@@ -9,9 +9,7 @@ use crate::painting::record::trace::Observer;
use crate::css::css_pixels::CssPixels;
use crate::layout::node_data::{NodeKind, NodeSlotId};
-use crate::painting::chrome_geometry::{
- ChromeGeometry, is_chrome_mirrored, scrollbar_colors_for_paint, scrollbar_is_enlarged,
-};
+use crate::painting::chrome_geometry::{ChromeGeometry, is_chrome_mirrored, scrollbar_colors_for_paint};
use crate::painting::display_list::commands::VISUAL_VIEWPORT_NODE_INDEX;
use crate::painting::display_list::recorder::{FillPathParams, PaintStyleOrColor};
use crate::painting::ffi::ScrollDirection;
@@ -47,22 +45,26 @@ pub(crate) fn paint_overlay<O: Observer>(recorder: &mut PaintRecorder<'_, O>, pa
.blend(recorder.inputs.uncaptured.background_color),
);
let scroll_node_index = own_scroll_node_index;
+ // The scrollbar is recorded thin, and the compositor presents it growing as it is hovered.
for direction in [ScrollDirection::Vertical, ScrollDirection::Horizontal] {
- let enlarged = scrollbar_is_enlarged(recorder.source, paintable, direction);
- let Some(scrollbar) = chrome_geometry.compute_scrollbar_data(paintable, direction, enlarged) else {
+ let Some(scrollbar) = chrome_geometry.compute_scrollbar_data(paintable, direction, false) else {
continue;
};
+ let expanded_gutter_rect = chrome_geometry
+ .compute_scrollbar_data(paintable, direction, true)
+ .map(|expanded| expanded.gutter_rect)
+ .unwrap_or_default();
recorder.record_compositor_scrollbar_painted_by_display_list(
paintable,
direction,
(thumb_color, track_color),
- enlarged,
);
recorder.recorder.paint_scrollbar(
scroll_node_index,
converter.rounded_device_rect(scrollbar.gutter_rect),
converter.rounded_device_rect(scrollbar.thumb_rect),
converter.rounded_device_rect(scrollbar.track_rect),
+ converter.rounded_device_rect(expanded_gutter_rect),
scrollbar.thumb_travel_to_scroll_ratio.to_double(),
thumb_color,
track_color,
diff --git a/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.cpp b/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.cpp
index 0740180b6ac..57bfecb790a 100644
--- a/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.cpp
+++ b/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.cpp
@@ -51,7 +51,6 @@ ErrorOr<void> encode(Encoder& encoder, Web::ScrollbarDraggedByCompositor const&
{
TRY(encoder.encode(scrollbar.context_id));
TRY(encoder.encode(scrollbar.scroller_stable_node_id));
- TRY(encoder.encode(scrollbar.vertical));
return {};
}
@@ -61,7 +60,6 @@ ErrorOr<Web::ScrollbarDraggedByCompositor> decode(Decoder& decoder)
return Web::ScrollbarDraggedByCompositor {
.context_id = TRY(decoder.decode<Web::CompositorContextId>()),
.scroller_stable_node_id = TRY(decoder.decode<Web::AsyncScrollNodeStableID>()),
- .vertical = TRY(decoder.decode<bool>()),
};
}
diff --git a/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.h b/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.h
index d7a339b50cd..04580e5aef5 100644
--- a/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.h
+++ b/Libraries/LibWebCommon/Page/AsyncScrollNodeStableID.h
@@ -48,7 +48,6 @@ struct ScrollbarDraggedByCompositor {
// the process that owns that context can tell which node the scroller's id names.
CompositorContextId context_id;
AsyncScrollNodeStableID scroller_stable_node_id;
- bool vertical { false };
bool operator==(ScrollbarDraggedByCompositor const&) const = default;
};
diff --git a/Libraries/LibWebCommon/Page/InputRoutingDecision.h b/Libraries/LibWebCommon/Page/InputRoutingDecision.h
index cabe95a3c1b..493130e0c93 100644
--- a/Libraries/LibWebCommon/Page/InputRoutingDecision.h
+++ b/Libraries/LibWebCommon/Page/InputRoutingDecision.h
@@ -38,6 +38,7 @@ namespace Web {
X(NotOverAScrollbar, "not-over-a-scrollbar") \
X(NotPrimaryButton, "not-primary-button") \
X(HoveringScrollbarPaintedByCompositor, "hovering-scrollbar-painted-by-compositor") \
+ X(HoveringScrollbarPaintedByDisplayList, "hovering-scrollbar-painted-by-display-list") \
X(BeganScrollbarDrag, "began-scrollbar-drag") \
X(ContinuedScrollbarDrag, "continued-scrollbar-drag") \
X(EndedScrollbarDrag, "ended-scrollbar-drag") \
diff --git a/Services/Compositor/ContextState.cpp b/Services/Compositor/ContextState.cpp
index 6ea2bbd60f1..c9c1b9dc5f4 100644
--- a/Services/Compositor/ContextState.cpp
+++ b/Services/Compositor/ContextState.cpp
@@ -431,8 +431,8 @@ ContextState::ContextUpdateResult ContextState::handle_mouse_event_from_containi
return handle_mouse_event_at(event, position);
}
-// The compositor paints how its own scrollbars expand, outside of what damage tracking sees.
-Optional<PendingFrame> ContextState::frame_repainting_scrollbars_painted_by_compositor() const
+// The compositor presents how scrollbars expand, outside of what damage tracking sees.
+Optional<PendingFrame> ContextState::frame_repainting_scrollbars() const
{
if (m_async_scrolling_viewport_rect.is_empty())
return {};
@@ -443,7 +443,14 @@ Optional<PendingFrame> ContextState::clear_scrollbar_hover()
{
if (!m_scrollbar_controller.set_hovered_scrollbar({}))
return {};
- return frame_repainting_scrollbars_painted_by_compositor();
+ return frame_repainting_scrollbars();
+}
+
+Optional<size_t> ContextState::scrollbar_under_pointer(Gfx::FloatPoint position)
+{
+ if (auto scrollbar_index = m_scrollbar_controller.hit_test_scrollbar_painted_by_compositor(m_async_scroll_tree, m_scroll_state_snapshot, position); scrollbar_index.has_value())
+ return scrollbar_index;
+ return m_scrollbar_controller.hit_test_scrollbar_painted_by_display_list(m_async_scroll_tree, m_scene.visual_context_tree_for_compositing(), m_scroll_state_snapshot, position);
}
// The compositor paints its own scrollbars over everything, so a nested context only takes the pointer where none of
@@ -511,8 +518,7 @@ ContextState::ContextUpdateResult ContextState::handle_mouse_event_at(Web::Mouse
result.routing_decision = Web::InputRoutingDecision::BeganScrollbarDrag;
result.routed_scroller = scroller_of_scrollbar(drag->scrollbar_index);
result.scrollbar_dragged_by_compositor = m_scrollbar_controller.captured_scrollbar_painted_by_display_list(m_context_id);
- if (!result.scrollbar_dragged_by_compositor.has_value())
- result.frame_to_present = frame_repainting_scrollbars_painted_by_compositor();
+ result.frame_to_present = frame_repainting_scrollbars();
// A press beside the thumb pages toward the pointer or jumps there, as the platform says, and a modifier swaps
// the two.
@@ -582,18 +588,19 @@ ContextState::ContextUpdateResult ContextState::handle_mouse_event_at(Web::Mouse
if (auto hit = nested_context_taking_mouse_event_at(event.type, position); hit.has_value())
return hand_to_nested_context(*hit);
- // The main thread hovers the scrollbars the display list paints.
- auto hovered_scrollbar_index = m_scrollbar_controller.hit_test_scrollbar_painted_by_compositor(m_async_scroll_tree, m_scroll_state_snapshot, position);
+ auto hovered_scrollbar_index = scrollbar_under_pointer(position);
Optional<PendingFrame> frame_to_present;
if (m_scrollbar_controller.set_hovered_scrollbar(hovered_scrollbar_index))
- frame_to_present = frame_repainting_scrollbars_painted_by_compositor();
+ frame_to_present = frame_repainting_scrollbars();
if (!hovered_scrollbar_index.has_value())
return { .frame_to_present = frame_to_present, .routing_decision = Web::InputRoutingDecision::NotOverAScrollbar };
+ // The page sees the pointer move over a scrollbar the display list paints, as it is part of the page's content.
+ auto is_painted_by_compositor = m_scrollbar_controller.scrollbars()[*hovered_scrollbar_index].is_painted_by_compositor;
return {
- .accepted = true,
+ .accepted = is_painted_by_compositor,
.frame_to_present = frame_to_present,
.should_request_rendering_update = false,
- .routing_decision = Web::InputRoutingDecision::HoveringScrollbarPaintedByCompositor,
+ .routing_decision = is_painted_by_compositor ? Web::InputRoutingDecision::HoveringScrollbarPaintedByCompositor : Web::InputRoutingDecision::HoveringScrollbarPaintedByDisplayList,
.routed_scroller = scroller_of_scrollbar(*hovered_scrollbar_index),
};
}
@@ -619,16 +626,14 @@ ContextState::ContextUpdateResult ContextState::handle_mouse_event_at(Web::Mouse
// The main thread learns of the release from the next update it takes, so one is asked for even when the
// release scrolls nothing.
result.should_request_rendering_update = true;
- if (!scrollbar_dragged_by_compositor.has_value())
- result.frame_to_present = frame_repainting_scrollbars_painted_by_compositor();
+ result.frame_to_present = frame_repainting_scrollbars();
if (!was_paging) {
if (auto frame_to_present = apply_scrollbar_drag(*drag); frame_to_present.has_value())
result.frame_to_present = *frame_to_present;
}
- auto hovered_scrollbar_index = m_scrollbar_controller.hit_test_scrollbar_painted_by_compositor(m_async_scroll_tree, m_scroll_state_snapshot, position);
- if (m_scrollbar_controller.set_hovered_scrollbar(hovered_scrollbar_index)) {
- if (auto frame_to_present = frame_repainting_scrollbars_painted_by_compositor(); frame_to_present.has_value())
+ if (m_scrollbar_controller.set_hovered_scrollbar(scrollbar_under_pointer(position))) {
+ if (auto frame_to_present = frame_repainting_scrollbars(); frame_to_present.has_value())
result.frame_to_present = frame_to_present;
}
@@ -638,7 +643,7 @@ ContextState::ContextUpdateResult ContextState::handle_mouse_event_at(Web::Mouse
auto had_capture = m_scrollbar_controller.has_captured_scrollbar();
Optional<PendingFrame> frame_to_present;
if (m_scrollbar_controller.set_hovered_scrollbar({}))
- frame_to_present = frame_repainting_scrollbars_painted_by_compositor();
+ frame_to_present = frame_repainting_scrollbars();
return {
.accepted = had_capture,
.frame_to_present = frame_to_present,
@@ -652,7 +657,6 @@ ContextState::ContextUpdateResult ContextState::handle_mouse_event_at(Web::Mouse
// counts as having left. The page still sees the cancel, so it is not accepted.
auto was_dragging_scrollbar = m_scrollbar_controller.has_captured_scrollbar();
auto box_of_dragged_scrollbar = box_of_captured_scrollbar();
- auto scrollbar_dragged_by_compositor = m_scrollbar_controller.captured_scrollbar_painted_by_display_list(m_context_id);
(void)m_scrollbar_controller.release_captured_drag(m_scene.visual_context_tree_for_compositing(), m_scroll_state_snapshot, position);
stop_scrollbar_paging();
note_user_scroll_gesture_end_if_drag_ended(box_of_dragged_scrollbar);
@@ -661,8 +665,8 @@ ContextState::ContextUpdateResult ContextState::handle_mouse_event_at(Web::Mouse
ContextUpdateResult result;
// As for a release, the main thread learns that the drag ended from the next update it takes.
result.should_request_rendering_update = was_dragging_scrollbar;
- if ((was_dragging_scrollbar && !scrollbar_dragged_by_compositor.has_value()) || hovered_scrollbar_changed)
- result.frame_to_present = frame_repainting_scrollbars_painted_by_compositor();
+ if (was_dragging_scrollbar || hovered_scrollbar_changed)
+ result.frame_to_present = frame_repainting_scrollbars();
return result;
}
case Web::MouseEvent::Type::MouseWheel:
@@ -1997,15 +2001,13 @@ ContextPresenter::FrameContent ContextState::frame_content(Compositing::ScrollSt
}
// Each frame shows the scrollbars as of when it is painted. An elastic overscroll moves the presented scroll offsets
-// only, and shows the scrollbars of the stretched scroller as a scroll does. Returns the damage of the scrollbars that
-// the display list does not damage itself.
-Gfx::IntRect ContextState::update_scrollbar_visibility()
+// only, and shows the scrollbars of the stretched scroller as a scroll does.
+void ContextState::update_scrollbar_visibility()
{
auto stretched_scroll_state_snapshot = scroll_state_snapshot_stretched_by_elastic_overscrolls();
auto const& presented_scroll_state_snapshot = stretched_scroll_state_snapshot.has_value() ? *stretched_scroll_state_snapshot : m_scroll_state_snapshot;
- auto const* visual_context_tree = m_scene.visual_context_tree().has_value() ? &m_scene.visual_context_tree_for_compositing() : nullptr;
auto now = MonotonicTime::now();
- auto damage_rect = m_scrollbar_controller.update_visibility(visual_context_tree, presented_scroll_state_snapshot, now);
+ m_scrollbar_controller.update_visibility(presented_scroll_state_snapshot, now);
report_scrollbar_visibility_changes();
// A hovered scrollbar starts to grow here, which needs display ticks before anything else asks for a frame.
@@ -2017,7 +2019,7 @@ Gfx::IntRect ContextState::update_scrollbar_visibility()
if (!fade_out_time.has_value() || !m_request_animation_frames) {
if (m_scrollbar_fade_out_timer)
m_scrollbar_fade_out_timer->stop();
- return damage_rect;
+ return;
}
if (!m_scrollbar_fade_out_timer) {
m_scrollbar_fade_out_timer = Core::Timer::create_single_shot(AK::Duration::zero(), [this] {
@@ -2026,7 +2028,6 @@ Gfx::IntRect ContextState::update_scrollbar_visibility()
}
auto delay = max(AK::Duration::zero(), *fade_out_time - now);
m_scrollbar_fade_out_timer->restart(delay);
- return damage_rect;
}
// NB: This goes on the connection the compositor forwards input on, so the main thread knows which scrollbars have
@@ -2055,7 +2056,7 @@ Optional<PendingFrame> ContextState::advance_scrollbar_fades(MonotonicTime frame
Optional<PreparedFrame> ContextState::prepare_frame(DisplayListPlayerSkia& display_list_player, PendingFrame pending_frame, CompositedContextResolver const* composited_context_resolver)
{
- pending_frame.forced_damage_rect.unite(update_scrollbar_visibility());
+ update_scrollbar_visibility();
auto stretched_scroll_state_snapshot = scroll_state_snapshot_stretched_by_elastic_overscrolls();
auto const& presented_scroll_state_snapshot = stretched_scroll_state_snapshot.has_value() ? *stretched_scroll_state_snapshot : m_scroll_state_snapshot;
return m_presenter.prepare_frame(display_list_player, pending_frame, frame_content(presented_scroll_state_snapshot, composited_context_resolver));
diff --git a/Services/Compositor/ContextState.h b/Services/Compositor/ContextState.h
index 2adf81bcbc0..c07bbfedac9 100644
--- a/Services/Compositor/ContextState.h
+++ b/Services/Compositor/ContextState.h
@@ -383,7 +383,8 @@ private:
void end_scroll_step_gestures_whose_input_ran_out(MonotonicTime now);
ContextUpdateResult handle_mouse_event_at(Web::MouseEvent const&, Gfx::FloatPoint position);
Optional<Compositing::NestedContextHit> nested_context_taking_mouse_event_at(Web::MouseEvent::Type, Gfx::FloatPoint position);
- Optional<PendingFrame> frame_repainting_scrollbars_painted_by_compositor() const;
+ Optional<PendingFrame> frame_repainting_scrollbars() const;
+ Optional<size_t> scrollbar_under_pointer(Gfx::FloatPoint position);
Optional<PendingFrame> apply_scrollbar_drag(ScrollbarController::Drag const&);
Optional<PendingFrame> start_scrollbar_press_scroll(Compositing::AsyncScrollNode const&, Gfx::FloatPoint old_scroll_offset, Gfx::FloatPoint destination, bool is_absolute_scroll);
Optional<PendingFrame> page_captured_scrollbar();
@@ -393,7 +394,7 @@ private:
void rebuild_wheel_hit_test_targets();
ContextPresenter::FrameContent frame_content(Compositing::ScrollStateSnapshot const& presented_scroll_state_snapshot, CompositedContextResolver const*) const;
Gfx::IntRect damage_rect_of_blinking_carets();
- Gfx::IntRect update_scrollbar_visibility();
+ void update_scrollbar_visibility();
void report_scrollbar_visibility_changes();
CompositorStateWebContentClient& m_web_content_client;
diff --git a/Services/Compositor/ScrollbarController.cpp b/Services/Compositor/ScrollbarController.cpp
index ca74e40dd39..b0475bf3b5b 100644
--- a/Services/Compositor/ScrollbarController.cpp
+++ b/Services/Compositor/ScrollbarController.cpp
@@ -148,7 +148,6 @@ Optional<Web::ScrollbarDraggedByCompositor> ScrollbarController::captured_scroll
return Web::ScrollbarDraggedByCompositor {
.context_id = context_id,
.scroller_stable_node_id = *scrollbar.scroller_stable_node_id,
- .vertical = scrollbar.vertical,
};
}
@@ -168,9 +167,9 @@ Optional<size_t> ScrollbarController::hit_test_scrollbar_painted_by_compositor(C
return {};
}
-// A scrollbar the display list paints takes a press only where the main thread would give it one: inside the rect of
-// the scrollbar as it is painted now, and with nothing that takes pointer input painted over it there. A scrollbar that
-// has faded out takes none, as the main thread passes it by. Any other press is left to the main thread.
+// A scrollbar the display list paints takes the pointer inside the rect of the scrollbar as it is presented now, and only
+// with nothing that takes pointer input painted over it there. A scrollbar that has faded out takes none, as the main
+// thread passes it by.
Optional<size_t> ScrollbarController::hit_test_scrollbar_painted_by_display_list(Compositing::AsyncScrollTree const& async_scroll_tree, Compositing::AccumulatedVisualContextTree const& visual_context_tree, Compositing::ScrollStateSnapshot const& scroll_state_snapshot, Gfx::FloatPoint position) const
{
for (size_t i = m_scrollbars.size(); i-- > 0;) {
@@ -183,8 +182,8 @@ Optional<size_t> ScrollbarController::hit_test_scrollbar_painted_by_display_list
auto position_in_scrollbar_space = position_in_space_of_scrollbar(scrollbar, visual_context_tree, scroll_state_snapshot, position, Compositing::AccumulatedVisualContextTree::ClipBehavior::Respect);
if (!position_in_scrollbar_space.has_value())
continue;
- auto const& painted_scrollbar_rect = scrollbar.display_list_paints_enlarged_scrollbar || expansion(i) > 0 ? scrollbar.expanded_gutter_rect : scrollbar.track_rect;
- if (!painted_scrollbar_rect.to_type<float>().contains(*position_in_scrollbar_space))
+ auto const& presented_scrollbar_rect = expansion(i) > 0 ? scrollbar.expanded_gutter_rect : scrollbar.track_rect;
+ if (!presented_scrollbar_rect.to_type<float>().contains(*position_in_scrollbar_space))
continue;
if (async_scroll_tree.is_covered_by_hit_test_target_painted_after(scrollbar.paint_order_index, visual_context_tree, position))
@@ -234,9 +233,7 @@ Optional<ScrollbarController::Drag> ScrollbarController::begin_drag(Compositing:
}
m_captured_scrollbar_index = *scrollbar_index;
- // The main thread expands a scrollbar the display list paints, on the press it still receives.
- if (scrollbar.is_painted_by_compositor)
- m_hovered_scrollbar_index = *scrollbar_index;
+ m_hovered_scrollbar_index = *scrollbar_index;
m_thumb_grab_position = thumb_grab_position;
m_last_primary_position_of_captured_drag = primary_position;
return Drag { *scrollbar_index, primary_position, thumb_grab_position, !position_is_along_thumb };
@@ -324,9 +321,8 @@ int ScrollbarController::paging_direction(size_t scrollbar_index, float primary_
return 0;
}
-Gfx::IntRect ScrollbarController::update_visibility(Compositing::AccumulatedVisualContextTree const* visual_context_tree, Compositing::ScrollStateSnapshot const& scroll_state_snapshot, MonotonicTime now)
+void ScrollbarController::update_visibility(Compositing::ScrollStateSnapshot const& scroll_state_snapshot, MonotonicTime now)
{
- Gfx::IntRect damage_rect;
for (size_t i = 0; i < m_scrollbars.size(); ++i) {
auto& visibility = m_visibilities[i];
auto const& scrollbar = m_scrollbars[i];
@@ -334,15 +330,9 @@ Gfx::IntRect ScrollbarController::update_visibility(Compositing::AccumulatedVisu
auto scrolled = visibility.scroll_offset.has_value() && *visibility.scroll_offset != scroll_offset;
visibility.scroll_offset = scroll_offset;
- // The display list damages only the rect of the scrollbar as it gives it when it scrolls.
- if (scrolled && visual_context_tree && !scrollbar.is_painted_by_compositor && expansion(i) != (scrollbar.display_list_paints_enlarged_scrollbar ? 1 : 0)) {
- if (auto rect = rect_in_viewport(i, *visual_context_tree, scroll_state_snapshot); rect.has_value())
- damage_rect.unite(*rect);
- }
-
auto was_held_shown = visibility.is_held_shown;
// Hovering a hidden scrollbar does not show it. Only a scroll does.
- visibility.is_held_shown = is_held_shown(i) && (scrolled || visibility.fade.opacity() > 0);
+ visibility.is_held_shown = is_expanded(i) && (scrolled || visibility.fade.opacity() > 0);
if (visibility.is_held_shown) {
visibility.fade.jump_to(1);
visibility.fade_out_time.clear();
@@ -354,7 +344,6 @@ Gfx::IntRect ScrollbarController::update_visibility(Compositing::AccumulatedVisu
if (scrolled || was_held_shown)
visibility.fade_out_time = now + shown_duration_after_activity;
}
- return damage_rect;
}
Optional<MonotonicTime> ScrollbarController::next_fade_out_time() const
@@ -511,15 +500,6 @@ bool ScrollbarController::is_expanded(size_t scrollbar_index) const
return m_hovered_scrollbar_index == scrollbar_index || m_captured_scrollbar_index == scrollbar_index;
}
-// The main thread hovers and drags the scrollbars the display list paints, and paints them enlarged meanwhile.
-bool ScrollbarController::is_held_shown(size_t scrollbar_index) const
-{
- auto const& scrollbar = m_scrollbars[scrollbar_index];
- if (scrollbar.is_painted_by_compositor)
- return is_expanded(scrollbar_index);
- return scrollbar.display_list_paints_enlarged_scrollbar || m_captured_scrollbar_index == scrollbar_index;
-}
-
float ScrollbarController::opacity(size_t scrollbar_index) const
{
if (s_scrollbars_always_shown)
@@ -530,7 +510,7 @@ float ScrollbarController::opacity(size_t scrollbar_index) const
float ScrollbarController::expansion(size_t scrollbar_index) const
{
if (s_scrollbars_always_shown)
- return is_held_shown(scrollbar_index) ? 1 : 0;
+ return is_expanded(scrollbar_index) ? 1 : 0;
return m_visibilities[scrollbar_index].expansion.opacity();
}
diff --git a/Services/Compositor/ScrollbarController.h b/Services/Compositor/ScrollbarController.h
index c47a09edd9d..9d4fdd4919b 100644
--- a/Services/Compositor/ScrollbarController.h
+++ b/Services/Compositor/ScrollbarController.h
@@ -71,9 +71,8 @@ public:
// Shows each scrollbar whose scroller scrolled since the last call, keeps a shown scrollbar that is hovered or
// dragged shown, and starts the wait before a scrollbar that is no longer hovered or dragged fades out. A hovered or
- // dragged scrollbar that is shown grows to its expanded geometry, and keeps it until it has faded out. Returns the rect in the viewport of the scrollbars the
- // display list paints that scrolled while they are presented in another geometry than the display list gives them.
- Gfx::IntRect update_visibility(Compositing::AccumulatedVisualContextTree const*, Compositing::ScrollStateSnapshot const&, MonotonicTime now);
+ // dragged scrollbar that is shown grows to its expanded geometry, and keeps it until it has faded out.
+ void update_visibility(Compositing::ScrollStateSnapshot const&, MonotonicTime now);
// When the next scrollbar starts to fade out.
Optional<MonotonicTime> next_fade_out_time() const;
// The scrollbars that faded out or were shown again since the last call. The main thread hit tests the scrollbars
@@ -98,7 +97,8 @@ public:
Optional<Web::ScrollbarDraggedByCompositor> captured_scrollbar_painted_by_display_list(Web::CompositorContextId) const;
Optional<size_t> hit_test_scrollbar_painted_by_compositor(Compositing::AsyncScrollTree const&, Compositing::ScrollStateSnapshot const&, Gfx::FloatPoint position) const;
- // A scrollbar the display list paints takes the pointer only where the main thread would give it to it.
+ // A scrollbar the display list paints takes the pointer where it is presented, unless something that takes pointer
+ // input is painted over it there.
Optional<size_t> hit_test_scrollbar_painted_by_display_list(Compositing::AsyncScrollTree const&, Compositing::AccumulatedVisualContextTree const&, Compositing::ScrollStateSnapshot const&, Gfx::FloatPoint position) const;
// Whether the scrollbar is shown, rather than hidden until its scroller next scrolls.
bool is_shown(size_t scrollbar_index) const { return opacity(scrollbar_index) > 0; }
@@ -124,7 +124,6 @@ private:
};
bool is_expanded(size_t scrollbar_index) const;
- bool is_held_shown(size_t scrollbar_index) const;
float opacity(size_t scrollbar_index) const;
float expansion(size_t scrollbar_index) const;
PresentedScrollbar presented_scrollbar(size_t scrollbar_index, Compositing::ScrollStateSnapshot const&, Color thumb_color, Color track_color) const;
diff --git a/Tests/Compositor/TestScrollbarController.cpp b/Tests/Compositor/TestScrollbarController.cpp
index 7efdb0d6595..42528dd8b2b 100644
--- a/Tests/Compositor/TestScrollbarController.cpp
+++ b/Tests/Compositor/TestScrollbarController.cpp
@@ -15,11 +15,11 @@ static void show_scrollbars_by_scrolling_away_and_back(Compositor::ScrollbarCont
{
Compositing::ScrollStateSnapshot scroll_state_snapshot;
auto now = MonotonicTime::now();
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, now);
+ controller.update_visibility(scroll_state_snapshot, now);
scroll_state_snapshot.set_device_offset_for_index(scroll_node_index, { 1, 1 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, now);
+ controller.update_visibility(scroll_state_snapshot, now);
scroll_state_snapshot.set_device_offset_for_index(scroll_node_index, { 0, 0 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, now);
+ controller.update_visibility(scroll_state_snapshot, now);
}
static Compositor::ScrollbarController::Drag begin_scrollbar_drag(Gfx::Orientation orientation, Gfx::FloatPoint position, Optional<Gfx::IntRect> expanded_thumb_rect = {})
@@ -73,7 +73,6 @@ static Compositor::ScrollbarController::Drag begin_scrollbar_drag(Gfx::Orientati
.track_color = Gfx::Color::Transparent,
.vertical = vertical,
.is_painted_by_compositor = true,
- .display_list_paints_enlarged_scrollbar = false,
});
Compositing::VisualContextTreeTestBuilder visual_context_tree_builder;
@@ -119,7 +118,7 @@ TEST_CASE(starting_scrollbar_drag_uses_expanded_thumb_geometry)
EXPECT_EQ(horizontal_drag.thumb_grab_position, 7);
}
-static Compositing::AsyncScrollbar scrollbar_painted_by_display_list(bool display_list_paints_enlarged_scrollbar = false)
+static Compositing::AsyncScrollbar scrollbar_painted_by_display_list()
{
return {
.scroll_node_id = {
@@ -147,7 +146,6 @@ static Compositing::AsyncScrollbar scrollbar_painted_by_display_list(bool displa
.track_color = Gfx::Color::Transparent,
.vertical = true,
.is_painted_by_compositor = false,
- .display_list_paints_enlarged_scrollbar = display_list_paints_enlarged_scrollbar,
};
}
@@ -179,12 +177,12 @@ TEST_CASE(scrollbar_is_hidden_until_its_scroller_scrolls)
Compositing::ScrollStateSnapshot scroll_state_snapshot;
auto start = MonotonicTime::now();
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
EXPECT_EQ(opacity_of_scrollbar(controller), 0);
EXPECT(!controller.next_fade_out_time().has_value());
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
EXPECT_EQ(opacity_of_scrollbar(controller), 1);
EXPECT(controller.next_fade_out_time() == start + Compositor::ScrollbarController::shown_duration_after_activity);
}
@@ -196,9 +194,9 @@ TEST_CASE(scrollbar_fades_out_after_its_scroller_stops_scrolling)
Compositing::ScrollStateSnapshot scroll_state_snapshot;
auto visual_context_tree = visual_context_tree_with_scroller();
auto start = MonotonicTime::now();
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
auto shown_until = start + Compositor::ScrollbarController::shown_duration_after_activity;
EXPECT(!controller.fades_need_frame(shown_until - AK::Duration::from_milliseconds(1)));
@@ -225,9 +223,9 @@ TEST_CASE(scroll_while_fading_out_shows_scrollbar_again)
Compositing::ScrollStateSnapshot scroll_state_snapshot;
auto visual_context_tree = visual_context_tree_with_scroller();
auto start = MonotonicTime::now();
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
auto shown_until = start + Compositor::ScrollbarController::shown_duration_after_activity;
(void)controller.advance_fades(visual_context_tree, scroll_state_snapshot, shown_until);
@@ -236,7 +234,7 @@ TEST_CASE(scroll_while_fading_out_shows_scrollbar_again)
auto scrolled_again_at = shown_until + half_fade_duration;
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 20 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, scrolled_again_at);
+ controller.update_visibility(scroll_state_snapshot, scrolled_again_at);
EXPECT_EQ(opacity_of_scrollbar(controller), 1);
EXPECT(!controller.fades_need_frame(scrolled_again_at));
EXPECT(controller.next_fade_out_time() == scrolled_again_at + Compositor::ScrollbarController::shown_duration_after_activity);
@@ -248,16 +246,16 @@ TEST_CASE(hovering_hidden_scrollbar_does_not_show_it)
controller.set_scrollbars({ scrollbar_painted_by_display_list() });
Compositing::ScrollStateSnapshot scroll_state_snapshot;
auto start = MonotonicTime::now();
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
- controller.set_scrollbars({ scrollbar_painted_by_display_list(true) });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.set_hovered_scrollbar(0);
+ controller.update_visibility(scroll_state_snapshot, start);
EXPECT_EQ(opacity_of_scrollbar(controller), 0);
EXPECT(!controller.fades_need_frame(start));
// A scroll shows it, and the hover then keeps it shown and grows it.
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
EXPECT_EQ(opacity_of_scrollbar(controller), 1);
EXPECT(!controller.next_fade_out_time().has_value());
EXPECT(controller.fades_need_frame(start));
@@ -269,23 +267,23 @@ TEST_CASE(hovered_scrollbar_stays_shown_until_the_pointer_leaves_it)
controller.set_scrollbars({ scrollbar_painted_by_display_list() });
Compositing::ScrollStateSnapshot scroll_state_snapshot;
auto start = MonotonicTime::now();
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
- controller.set_scrollbars({ scrollbar_painted_by_display_list(true) });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.set_hovered_scrollbar(0);
+ controller.update_visibility(scroll_state_snapshot, start);
EXPECT_EQ(opacity_of_scrollbar(controller), 1);
EXPECT(!controller.next_fade_out_time().has_value());
auto much_later = start + AK::Duration::from_seconds(10);
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, much_later);
+ controller.update_visibility(scroll_state_snapshot, much_later);
(void)controller.advance_fades(visual_context_tree_with_scroller(), scroll_state_snapshot, much_later);
EXPECT_EQ(opacity_of_scrollbar(controller), 1);
EXPECT(!controller.fades_need_frame(much_later));
- controller.set_scrollbars({ scrollbar_painted_by_display_list(false) });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, much_later);
+ controller.set_hovered_scrollbar({});
+ controller.update_visibility(scroll_state_snapshot, much_later);
EXPECT_EQ(opacity_of_scrollbar(controller), 1);
EXPECT(controller.next_fade_out_time() == much_later + Compositor::ScrollbarController::shown_duration_after_activity);
}
@@ -297,18 +295,18 @@ TEST_CASE(hovered_scrollbar_grows_and_stays_expanded_until_it_has_faded_out)
Compositing::ScrollStateSnapshot scroll_state_snapshot;
auto visual_context_tree = visual_context_tree_with_scroller();
auto start = MonotonicTime::now();
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
// A scroll shows the thin scrollbar.
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
EXPECT_EQ(presented_scrollbar(controller).thumb_rect.width(), 2);
EXPECT_EQ(presented_scrollbar(controller).thumb_color.alpha(), 100);
EXPECT_EQ(presented_scrollbar(controller).track_color.alpha(), 0);
// Hovering it grows it over the duration of a fade.
- controller.set_scrollbars({ scrollbar_painted_by_display_list(true) });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.set_hovered_scrollbar(0);
+ controller.update_visibility(scroll_state_snapshot, start);
EXPECT(controller.fades_need_frame(start));
auto damage_rect = controller.advance_fades(visual_context_tree, scroll_state_snapshot, start + half_fade_duration);
EXPECT(damage_rect.contains(Gfx::IntRect { 92, 0, 8, 100 }));
@@ -323,8 +321,8 @@ TEST_CASE(hovered_scrollbar_grows_and_stays_expanded_until_it_has_faded_out)
EXPECT(!controller.fades_need_frame(grown_at));
// It stays expanded after the pointer leaves it, while it is shown and while it fades out.
- controller.set_scrollbars({ scrollbar_painted_by_display_list(false) });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, grown_at);
+ controller.set_hovered_scrollbar({});
+ controller.update_visibility(scroll_state_snapshot, grown_at);
auto shown_until = grown_at + Compositor::ScrollbarController::shown_duration_after_activity;
(void)controller.advance_fades(visual_context_tree, scroll_state_snapshot, shown_until);
(void)controller.advance_fades(visual_context_tree, scroll_state_snapshot, shown_until + half_fade_duration);
@@ -338,30 +336,6 @@ TEST_CASE(hovered_scrollbar_grows_and_stays_expanded_until_it_has_faded_out)
EXPECT(!controller.fades_need_frame(shown_until + Compositing::OverlayFade::duration));
}
-TEST_CASE(scrolling_expanded_scrollbar_the_display_list_paints_thin_damages_it)
-{
- Compositor::ScrollbarController controller;
- controller.set_scrollbars({ scrollbar_painted_by_display_list() });
- Compositing::ScrollStateSnapshot scroll_state_snapshot;
- auto visual_context_tree = visual_context_tree_with_scroller();
- auto start = MonotonicTime::now();
- (void)controller.update_visibility(&visual_context_tree, scroll_state_snapshot, start);
- scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 5 });
- (void)controller.update_visibility(&visual_context_tree, scroll_state_snapshot, start);
- controller.set_scrollbars({ scrollbar_painted_by_display_list(true) });
- (void)controller.update_visibility(&visual_context_tree, scroll_state_snapshot, start);
- (void)controller.advance_fades(visual_context_tree, scroll_state_snapshot, start + Compositing::OverlayFade::duration);
-
- // While the display list paints the scrollbar expanded, it damages it on a scroll itself.
- scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- EXPECT(controller.update_visibility(&visual_context_tree, scroll_state_snapshot, start).is_empty());
-
- controller.set_scrollbars({ scrollbar_painted_by_display_list(false) });
- scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 20 });
- auto damage_rect = controller.update_visibility(&visual_context_tree, scroll_state_snapshot, start);
- EXPECT(damage_rect.contains(Gfx::IntRect { 92, 0, 8, 100 }));
-}
-
TEST_CASE(press_beside_thumb_pages_toward_pointer_until_thumb_reaches_it)
{
Compositor::ScrollbarController controller;
@@ -384,7 +358,7 @@ TEST_CASE(scrollbar_that_has_faded_out_is_reported_hidden)
auto start = MonotonicTime::now();
// A scrollbar starts out hidden, which the main thread hears once.
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
auto changes = controller.take_visibility_changes();
EXPECT_EQ(changes.size(), 1u);
EXPECT(changes[0].vertical);
@@ -393,7 +367,7 @@ TEST_CASE(scrollbar_that_has_faded_out_is_reported_hidden)
// A scroll shows it.
scroll_state_snapshot.set_device_offset_for_index(Compositing::SpatialNodeIndex { 1 }, { 0, 10 });
- (void)controller.update_visibility(nullptr, scroll_state_snapshot, start);
+ controller.update_visibility(scroll_state_snapshot, start);
changes = controller.take_visibility_changes();
EXPECT_EQ(changes.size(), 1u);
EXPECT(!changes[0].hidden);
diff --git a/Tests/LibWeb/Text/expected/SiteIsolation/iframe/scrollbar-drag-in-an-isolated-iframe.txt b/Tests/LibWeb/Text/expected/SiteIsolation/iframe/scrollbar-drag-in-an-isolated-iframe.txt
index 0a5aa6c2fd5..74a54b6490d 100644
--- a/Tests/LibWeb/Text/expected/SiteIsolation/iframe/scrollbar-drag-in-an-isolated-iframe.txt
+++ b/Tests/LibWeb/Text/expected/SiteIsolation/iframe/scrollbar-drag-in-an-isolated-iframe.txt
@@ -1,5 +1,5 @@
#1 compositor: handed-to-nested-context
-#1 compositor: not-over-a-scrollbar
+#1 compositor: hovering-scrollbar-painted-by-display-list
#1 compositor: forwarded-to-page
#1 web-content: forwarded-to-remote-frame
#2 compositor: handed-to-nested-context
diff --git a/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-driven-by-compositor.txt b/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-driven-by-compositor.txt
index e0edcdc853f..15562cfc7db 100644
--- a/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-driven-by-compositor.txt
+++ b/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-driven-by-compositor.txt
@@ -1,4 +1,4 @@
-#1 compositor: not-over-a-scrollbar
+#1 compositor: hovering-scrollbar-painted-by-display-list scroller=#scroller
#1 compositor: forwarded-to-page
#1 web-content: finished-handled
#2 compositor: began-scrollbar-drag scroller=#scroller
diff --git a/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-in-iframe-driven-by-compositor.txt b/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-in-iframe-driven-by-compositor.txt
index 7ce25613367..444642d3882 100644
--- a/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-in-iframe-driven-by-compositor.txt
+++ b/Tests/LibWeb/Text/expected/UIEvents/scrollbar-drag-in-iframe-driven-by-compositor.txt
@@ -1,5 +1,5 @@
#1 compositor: handed-to-nested-context
-#1 compositor: not-over-a-scrollbar
+#1 compositor: hovering-scrollbar-painted-by-display-list scroller=#scroller
#1 compositor: forwarded-to-page
#1 web-content: finished-handled
#2 compositor: handed-to-nested-context
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt
index 0cd1aa72f37..3a87457e33d 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/blocking-wheel-event-regions.txt
@@ -42,8 +42,8 @@ CompositorScrollNode@s1/e0 scroll_node_index=s2 parent_scroll_node_index=s0 scro
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[0,0 100x100]
CompositorBlockingWheelEventRegion@s2/c0/e0 rect=[0,0 100x100]
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[0,100 1000x1000]
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[191,2 7x36] track_rect=[191,0 9x200] expanded_gutter_rect=[185,0 15x200] expanded_thumb_rect=[187,2 11x36] scroll_size=0.17819444444444443 expanded_scroll_size=0.17819444444444443 min_scroll_offset=0 max_scroll_offset=900 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[191,2 7x36] track_rect=[191,0 9x200] expanded_gutter_rect=[185,0 15x200] expanded_thumb_rect=[187,2 11x36] scroll_size=0.17819444444444443 expanded_scroll_size=0.17819444444444443 min_scroll_offset=0 max_scroll_offset=900 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s1/e0
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[2,191 36x7] track_rect=[0,191 185x9] expanded_gutter_rect=[0,185 185x15] expanded_thumb_rect=[2,187 36x11] scroll_size=0.181015625 expanded_scroll_size=0.181015625 min_scroll_offset=0 max_scroll_offset=800 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[2,191 36x7] track_rect=[0,191 185x9] expanded_gutter_rect=[0,185 185x15] expanded_thumb_rect=[2,187 36x11] scroll_size=0.181015625 expanded_scroll_size=0.181015625 min_scroll_offset=0 max_scroll_offset=800 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s1/e0
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt b/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt
index 7b64291aaf7..60dd73c9446 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/nested-scroller-keeps-sync-wheel.txt
@@ -20,6 +20,6 @@ CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s2 rect=[0,0 100x100
CompositorScrollNode@s1/e0 scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[0,400] is_viewport=false
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[0,0 100x500]
CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s1 rect=[0,100 800x2000]
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s1/e0
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt
index 7296662e710..de76296c56f 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-parent-nodes.txt
@@ -24,8 +24,8 @@ CompositorWheelHitTestTarget@s2/e0 target_scroll_node_index=s1 rect=[0,0 800x100
CompositorWheelHitTestTarget@s2/e0 target_scroll_node_index=s3 rect=[0,0 100x100]
CompositorScrollNode@s2/e0 scroll_node_index=s3 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[400,400] is_viewport=false
CompositorWheelHitTestTarget@s3/c0/e0 target_scroll_node_index=s3 rect=[0,0 500x500]
-CompositorScrollbar@s2/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s2/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s2/e0
-CompositorScrollbar@s2/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[2,91 24x7] track_rect=[0,91 85x9] expanded_gutter_rect=[0,85 85x15] expanded_thumb_rect=[2,87 24x11] scroll_size=0.1425 expanded_scroll_size=0.1425 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s2/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[2,91 24x7] track_rect=[0,91 85x9] expanded_gutter_rect=[0,85 85x15] expanded_thumb_rect=[2,87 24x11] scroll_size=0.1425 expanded_scroll_size=0.1425 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s2/e0
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt
index d013bdce3f8..0d6c496bfde 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/scroll-tree-shape.txt
@@ -25,8 +25,8 @@ CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s2 rect=[0,0 100x100
CompositorScrollNode@s1/e0 scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[400,400] is_viewport=false
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[0,0 500x500]
CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s1 rect=[0,100 800x2000]
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s1/e0
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[2,91 24x7] track_rect=[0,91 85x9] expanded_gutter_rect=[0,85 85x15] expanded_thumb_rect=[2,87 24x11] scroll_size=0.1425 expanded_scroll_size=0.1425 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[2,91 24x7] track_rect=[0,91 85x9] expanded_gutter_rect=[0,85 85x15] expanded_thumb_rect=[2,87 24x11] scroll_size=0.1425 expanded_scroll_size=0.1425 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s1/e0
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt b/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt
index 0fd44606c64..45cc4043cd4 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/viewport-wheel-with-nested-scroller.txt
@@ -22,6 +22,6 @@ CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s2 rect=[0,0 100x100
CompositorScrollNode@s1/e0 scroll_node_index=s2 parent_scroll_node_index=s1 scrollport_rect=[0,0 100x100] min_scroll_offset=[0,0] max_scroll_offset=[0,400] is_viewport=false
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[0,0 100x500]
CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s1 rect=[0,100 800x2000]
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[91,2 7x24] track_rect=[91,0 9x100] expanded_gutter_rect=[85,0 15x100] expanded_thumb_rect=[87,2 11x24] scroll_size=0.18 expanded_scroll_size=0.18 min_scroll_offset=0 max_scroll_offset=400 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s1/e0
diff --git a/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt b/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt
index c6a1421661b..0dde0c5e063 100644
--- a/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt
+++ b/Tests/LibWeb/Text/expected/async-scrolling/wheel-scroll-admission.txt
@@ -29,9 +29,9 @@ CompositorScrollNode@s1/e0 scroll_node_index=s2 parent_scroll_node_index=s0 scro
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[0,0 100x100]
CompositorBlockingWheelEventRegion@s2/c0/e0 rect=[0,0 100x100]
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[0,100 1000x1000]
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[191,2 7x36] track_rect=[191,0 9x200] expanded_gutter_rect=[185,0 15x200] expanded_thumb_rect=[187,2 11x36] scroll_size=0.17819444444444443 expanded_scroll_size=0.17819444444444443 min_scroll_offset=0 max_scroll_offset=900 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[191,2 7x36] track_rect=[191,0 9x200] expanded_gutter_rect=[185,0 15x200] expanded_thumb_rect=[187,2 11x36] scroll_size=0.17819444444444443 expanded_scroll_size=0.17819444444444443 min_scroll_offset=0 max_scroll_offset=900 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s1/e0
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[2,191 36x7] track_rect=[0,191 185x9] expanded_gutter_rect=[0,185 185x15] expanded_thumb_rect=[2,187 36x11] scroll_size=0.181015625 expanded_scroll_size=0.181015625 min_scroll_offset=0 max_scroll_offset=800 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[2,191 36x7] track_rect=[0,191 185x9] expanded_gutter_rect=[0,185 185x15] expanded_thumb_rect=[2,187 36x11] scroll_size=0.181015625 expanded_scroll_size=0.181015625 min_scroll_offset=0 max_scroll_offset=800 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s1/e0
CompositorWheelHitTestTarget@s1/e0 target_scroll_node_index=s0 rect=[250,0 100x100]
diff --git a/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt b/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt
index c237f32d63d..785795c3c12 100644
--- a/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt
+++ b/Tests/LibWeb/Text/expected/display_list/nested-overflow-containers.txt
@@ -24,8 +24,8 @@ FillRoundedRectRing@s2/c0/e0 rect=[10,10 302x102] widths=[1,1,1,1] color=rgb(255
CompositorWheelHitTestTarget@s3/c1/e0 target_scroll_node_index=s3 rect=[11,11 400x80]
FillRect@s3/c1/e0 rect=[11,11 400x80] color=rgb(240, 128, 128)
DrawGlyphRun@s3/c1/e0 rect=[11,11 178x16] translation=[11,23.796875] color=rgb(0, 0, 0)
-CompositorScrollbar@s2/c0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[13,102 222x7] track_rect=[11,102 300x9] expanded_gutter_rect=[11,96 300x15] expanded_thumb_rect=[13,98 222x11] scroll_size=0.74 expanded_scroll_size=0.74 min_scroll_offset=0 max_scroll_offset=100 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s2/c0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[13,102 222x7] track_rect=[11,102 300x9] expanded_gutter_rect=[11,96 300x15] expanded_thumb_rect=[13,98 222x11] scroll_size=0.74 expanded_scroll_size=0.74 min_scroll_offset=0 max_scroll_offset=100 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s2/c0/e0
-CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[12,151 130x7] track_rect=[10,151 200x9] expanded_gutter_rect=[10,145 200x15] expanded_thumb_rect=[12,147 130x11] scroll_size=0.6490502450980392 expanded_scroll_size=0.6490502450980392 min_scroll_offset=0 max_scroll_offset=102 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s1/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[12,151 130x7] track_rect=[10,151 200x9] expanded_gutter_rect=[10,145 200x15] expanded_thumb_rect=[12,147 130x11] scroll_size=0.6490502450980392 expanded_scroll_size=0.6490502450980392 min_scroll_offset=0 max_scroll_offset=102 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s1/e0
diff --git a/Tests/LibWeb/Text/expected/display_list/paint-damage-scrollbar-hover.txt b/Tests/LibWeb/Text/expected/display_list/paint-damage-scrollbar-hover.txt
deleted file mode 100644
index 3b226e4e1f1..00000000000
--- a/Tests/LibWeb/Text/expected/display_list/paint-damage-scrollbar-hover.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-PASS: paint with overlays (work)
-PASS: hover the vertical scrollbar (work)
-PASS: leave the scrollbar (work)
diff --git a/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt b/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
index 17f1304c6ae..e3f0376134a 100644
--- a/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
+++ b/Tests/LibWeb/Text/expected/display_list/scrollable-in-fixed.txt
@@ -20,8 +20,8 @@ FillRoundedRectRing@s0/e0 rect=[32,32 182x102] widths=[1,1,1,1] color=rgb(0, 0,
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[33,33 300x200]
FillRect@s2/c0/e0 rect=[33,33 300x200] color=rgb(240, 128, 128)
DrawGlyphRun@s2/c0/e0 rect=[33,33 179x16] translation=[33,45.796875] color=rgb(0, 0, 0)
-CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[204,35 7x48] track_rect=[204,33 9x100] expanded_gutter_rect=[198,33 15x100] expanded_thumb_rect=[200,35 11x48] scroll_size=0.48 expanded_scroll_size=0.48 min_scroll_offset=0 max_scroll_offset=100 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[204,35 7x48] track_rect=[204,33 9x100] expanded_gutter_rect=[198,33 15x100] expanded_thumb_rect=[200,35 11x48] scroll_size=0.48 expanded_scroll_size=0.48 min_scroll_offset=0 max_scroll_offset=100 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s0/e0
-CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[35,124 97x7] track_rect=[33,124 165x9] expanded_gutter_rect=[33,118 165x15] expanded_thumb_rect=[35,120 97x11] scroll_size=0.53671875 expanded_scroll_size=0.53671875 min_scroll_offset=0 max_scroll_offset=120 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[35,124 97x7] track_rect=[33,124 165x9] expanded_gutter_rect=[33,118 165x15] expanded_thumb_rect=[35,120 97x11] scroll_size=0.53671875 expanded_scroll_size=0.53671875 min_scroll_offset=0 max_scroll_offset=120 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s0/e0
diff --git a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
index 393173421fc..baefef1feb9 100644
--- a/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
+++ b/Tests/LibWeb/Text/expected/display_list/sibling-scrollables-in-fixed.txt
@@ -24,9 +24,9 @@ FillRoundedRectRing@s0/e0 rect=[22,22 93x152] widths=[1,1,1,1] color=rgb(0, 0, 2
CompositorWheelHitTestTarget@s2/c0/e0 target_scroll_node_index=s2 rect=[23,23 200x300]
FillRect@s2/c0/e0 rect=[23,23 200x300] color=rgb(240, 128, 128)
DrawGlyphRun@s2/c0/e0 rect=[23,23 71x16] translation=[23,35.796875] color=rgb(0, 0, 0)
-CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[105,25 7x73] track_rect=[105,23 9x150] expanded_gutter_rect=[99,23 15x150] expanded_thumb_rect=[101,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[105,25 7x73] track_rect=[105,23 9x150] expanded_gutter_rect=[99,23 15x150] expanded_thumb_rect=[101,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s0/e0
-CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[25,164 33x7] track_rect=[23,164 76x9] expanded_gutter_rect=[23,158 76x15] expanded_thumb_rect=[25,160 33x11] scroll_size=0.3617541337167505 expanded_scroll_size=0.3617541337167505 min_scroll_offset=0 max_scroll_offset=108.671875 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s2 gutter_rect=[0,0 0x0] thumb_rect=[25,164 33x7] track_rect=[23,164 76x9] expanded_gutter_rect=[23,158 76x15] expanded_thumb_rect=[25,160 33x11] scroll_size=0.3617541337167505 expanded_scroll_size=0.3617541337167505 min_scroll_offset=0 max_scroll_offset=108.671875 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s0/e0
CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s3 rect=[125.328125,22 93.34375x152]
CompositorScrollNode@s0/e0 scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[126,23 92x150] min_scroll_offset=[0,0] max_scroll_offset=[108.65625,150] is_viewport=false
@@ -34,9 +34,9 @@ FillRoundedRectRing@s0/e0 rect=[125,22 94x152] widths=[1,1,1,1] color=rgb(0, 0,
CompositorWheelHitTestTarget@s3/c1/e0 target_scroll_node_index=s3 rect=[126.328125,23 200x300]
FillRect@s3/c1/e0 rect=[126,23 200x300] color=rgb(144, 238, 144)
DrawGlyphRun@s3/c1/e0 rect=[126,23 66x16] translation=[126.328125,35.796875] color=rgb(0, 0, 0)
-CompositorScrollbar@s0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[209,25 7x73] track_rect=[209,23 9x150] expanded_gutter_rect=[203,23 15x150] expanded_thumb_rect=[205,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[209,25 7x73] track_rect=[209,23 9x150] expanded_gutter_rect=[203,23 15x150] expanded_thumb_rect=[205,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s0/e0
-CompositorScrollbar@s0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[128,164 33x7] track_rect=[126,164 77x9] expanded_gutter_rect=[126,158 77x15] expanded_thumb_rect=[128,160 33x11] scroll_size=0.36180615473109 expanded_scroll_size=0.36180615473109 min_scroll_offset=0 max_scroll_offset=108.65625 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[128,164 33x7] track_rect=[126,164 77x9] expanded_gutter_rect=[126,158 77x15] expanded_thumb_rect=[128,160 33x11] scroll_size=0.36180615473109 expanded_scroll_size=0.36180615473109 min_scroll_offset=0 max_scroll_offset=108.65625 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s0/e0
CompositorWheelHitTestTarget@s0/e0 target_scroll_node_index=s4 rect=[228.67188,22 93.328125x152]
CompositorScrollNode@s0/e0 scroll_node_index=s4 parent_scroll_node_index=s0 scrollport_rect=[230,23 91x150] min_scroll_offset=[0,0] max_scroll_offset=[108.671875,150] is_viewport=false
@@ -44,8 +44,8 @@ FillRoundedRectRing@s0/e0 rect=[229,22 93x152] widths=[1,1,1,1] color=rgb(0, 0,
CompositorWheelHitTestTarget@s4/c2/e0 target_scroll_node_index=s4 rect=[229.67188,23 200x300]
FillRect@s4/c2/e0 rect=[230,23 200x300] color=rgb(173, 216, 230)
DrawGlyphRun@s4/c2/e0 rect=[229,23 67x16] translation=[229.67188,35.796875] color=rgb(0, 0, 0)
-CompositorScrollbar@s0/e0 scroll_node_index=s4 gutter_rect=[0,0 0x0] thumb_rect=[312,25 7x73] track_rect=[312,23 9x150] expanded_gutter_rect=[306,23 15x150] expanded_thumb_rect=[308,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s4 gutter_rect=[0,0 0x0] thumb_rect=[312,25 7x73] track_rect=[312,23 9x150] expanded_gutter_rect=[306,23 15x150] expanded_thumb_rect=[308,25 11x73] scroll_size=0.4866666666666667 expanded_scroll_size=0.4866666666666667 min_scroll_offset=0 max_scroll_offset=150 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s0/e0
-CompositorScrollbar@s0/e0 scroll_node_index=s4 gutter_rect=[0,0 0x0] thumb_rect=[232,164 33x7] track_rect=[230,164 76x9] expanded_gutter_rect=[230,158 76x15] expanded_thumb_rect=[232,160 33x11] scroll_size=0.3617541337167505 expanded_scroll_size=0.3617541337167505 min_scroll_offset=0 max_scroll_offset=108.671875 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s0/e0 scroll_node_index=s4 gutter_rect=[0,0 0x0] thumb_rect=[232,164 33x7] track_rect=[230,164 76x9] expanded_gutter_rect=[230,158 76x15] expanded_thumb_rect=[232,160 33x11] scroll_size=0.3617541337167505 expanded_scroll_size=0.3617541337167505 min_scroll_offset=0 max_scroll_offset=108.671875 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=false is_painted_by_compositor=false
PaintScrollBar@s0/e0
diff --git a/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt b/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt
index f12b3248f94..ce64d0c178a 100644
--- a/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt
+++ b/Tests/LibWeb/Text/expected/display_list/svg-foreignobject-scroller-after-relayout.txt
@@ -23,6 +23,6 @@ CompositorWheelHitTestTarget@s2/c1/e0 target_scroll_node_index=s3 rect=[0,0 80x8
CompositorScrollNode@s2/c1/e0 scroll_node_index=s3 parent_scroll_node_index=s0 scrollport_rect=[0,0 80x80] min_scroll_offset=[0,0] max_scroll_offset=[0,220] is_viewport=false
CompositorWheelHitTestTarget@s3/c2/e0 target_scroll_node_index=s3 rect=[0,0 80x300]
FillRect@s3/c2/e0 rect=[0,0 80x300] color=rgb(0, 0, 0)
-CompositorScrollbar@s2/c1/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[71,2 7x24] track_rect=[71,0 9x80] expanded_gutter_rect=[65,0 15x80] expanded_thumb_rect=[67,2 11x24] scroll_size=0.23636363636363636 expanded_scroll_size=0.23636363636363636 min_scroll_offset=0 max_scroll_offset=220 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false display_list_paints_enlarged_scrollbar=false
+CompositorScrollbar@s2/c1/e0 scroll_node_index=s3 gutter_rect=[0,0 0x0] thumb_rect=[71,2 7x24] track_rect=[71,0 9x80] expanded_gutter_rect=[65,0 15x80] expanded_thumb_rect=[67,2 11x24] scroll_size=0.23636363636363636 expanded_scroll_size=0.23636363636363636 min_scroll_offset=0 max_scroll_offset=220 thumb_color=rgba(0, 0, 0, 0.5) track_color=rgba(0, 0, 0, 0.098) vertical=true is_painted_by_compositor=false
PaintScrollBar@s2/c1/e0
diff --git a/Tests/LibWeb/Text/input/display_list/paint-damage-scrollbar-hover.html b/Tests/LibWeb/Text/input/display_list/paint-damage-scrollbar-hover.html
deleted file mode 100644
index 2d339413869..00000000000
--- a/Tests/LibWeb/Text/input/display_list/paint-damage-scrollbar-hover.html
+++ /dev/null
@@ -1,214 +0,0 @@
-<!doctype html>
-<html id="html">
-<script src="../include.js"></script>
-<script src="recording-test.js"></script>
-<style>
- body { margin: 0; }
- #scroller { width: 300px; height: 100px; overflow: scroll; }
- #content { height: 500px; }
- #other { width: 300px; height: 50px; }
-</style>
-<body id="body">
-<div id="scroller"><div id="content"></div></div><div id="other"></div>
-<script>
-// Hovering a scrollbar enlarges it, which re-records only the overlay producers of its box.
-displayListTest({
- setup: removeBodyWhitespace,
- steps: [
- {
- name: "paint with overlays",
- paintOverlay: true,
- expect: `
- damage: rows=0 moved=0 order=0 eligibility=0 all=false
- @canvas RECORD (empty)
- @viewport RECORD
- @viewport/preamble RECORD (empty)
- @viewport/background/hit-test RECORD
- @viewport/scroll-metadata RECORD
- @viewport/background SKIP
- @viewport/border SKIP
- BlockContainer<HTML>#html/descendants(background-and-borders) RECORD
- @viewport/foreground/hit-test RECORD (empty)
- @viewport/foreground RECORD (empty)
- BlockContainer<HTML>#html/descendants(foreground) RECORD
- BlockContainer<HTML>#html RECORD
- BlockContainer<HTML>#html/preamble RECORD (empty)
- BlockContainer<HTML>#html/background/hit-test RECORD
- BlockContainer<HTML>#html/scroll-metadata RECORD
- BlockContainer<HTML>#html/background RECORD (empty)
- BlockContainer<HTML>#html/border SKIP
- BlockContainer<BODY>#body/descendants(background-and-borders) RECORD
- BlockContainer<BODY>#body/background/hit-test RECORD
- BlockContainer<BODY>#body/scroll-metadata RECORD
- BlockContainer<BODY>#body/background SKIP
- BlockContainer<BODY>#body/border SKIP
- BlockContainer<DIV>#scroller/descendants(background-and-borders) RECORD
- BlockContainer<DIV>#scroller/background/hit-test RECORD
- BlockContainer<DIV>#scroller/scroll-metadata RECORD
- BlockContainer<DIV>#scroller/background SKIP
- BlockContainer<DIV>#scroller/border SKIP
- BlockContainer<DIV>#content/descendants(background-and-borders) RECORD
- BlockContainer<DIV>#content/background/hit-test RECORD
- BlockContainer<DIV>#content/scroll-metadata RECORD
- BlockContainer<DIV>#content/background SKIP
- BlockContainer<DIV>#content/border SKIP
- BlockContainer<DIV>#other/descendants(background-and-borders) RECORD
- BlockContainer<DIV>#other/background/hit-test RECORD
- BlockContainer<DIV>#other/scroll-metadata RECORD
- BlockContainer<DIV>#other/background SKIP
- BlockContainer<DIV>#other/border SKIP
- BlockContainer<HTML>#html/foreground/hit-test RECORD (empty)
- BlockContainer<HTML>#html/foreground RECORD (empty)
- BlockContainer<BODY>#body/descendants(foreground) RECORD
- BlockContainer<BODY>#body/foreground/hit-test RECORD (empty)
- BlockContainer<BODY>#body/foreground RECORD (empty)
- BlockContainer<DIV>#scroller/descendants(foreground) RECORD
- BlockContainer<DIV>#scroller/foreground/hit-test RECORD (empty)
- BlockContainer<DIV>#scroller/foreground RECORD (empty)
- BlockContainer<DIV>#content/descendants(foreground) RECORD
- BlockContainer<DIV>#content/foreground/hit-test RECORD (empty)
- BlockContainer<DIV>#content/foreground RECORD (empty)
- BlockContainer<DIV>#content/outline SKIP
- BlockContainer<DIV>#content/overlay/hit-test RECORD (empty)
- BlockContainer<DIV>#content/overlay SKIP
- BlockContainer<DIV>#scroller/outline SKIP
- BlockContainer<DIV>#scroller/overlay/hit-test RECORD
- BlockContainer<DIV>#scroller/overlay RECORD
- BlockContainer<DIV>#other/descendants(foreground) RECORD
- BlockContainer<DIV>#other/foreground/hit-test RECORD (empty)
- BlockContainer<DIV>#other/foreground RECORD (empty)
- BlockContainer<DIV>#other/outline SKIP
- BlockContainer<DIV>#other/overlay/hit-test RECORD (empty)
- BlockContainer<DIV>#other/overlay SKIP
- BlockContainer<BODY>#body/outline SKIP
- BlockContainer<BODY>#body/overlay/hit-test RECORD (empty)
- BlockContainer<BODY>#body/overlay SKIP
- BlockContainer<HTML>#html/outline SKIP
- BlockContainer<HTML>#html/overlay/hit-test RECORD (empty)
- BlockContainer<HTML>#html/overlay SKIP
- @viewport/outline SKIP
- @viewport/overlay/hit-test RECORD (empty)
- @viewport/overlay RECORD (empty)
- `
- },
- {
- name: "hover the vertical scrollbar",
- paintOverlay: true,
- mutate: () => { internals.mouseMove(295, 30); },
- expect: `
- damage: rows=4 moved=0 order=0 eligibility=0 all=false
- @canvas RECORD (empty)
- @viewport ASSEMBLE
- @viewport/preamble COPY
- @viewport/background/hit-test COPY
- @viewport/scroll-metadata COPY
- @viewport/background COPY
- @viewport/border COPY
- BlockContainer<HTML>#html/descendants(background-and-borders) ASSEMBLE
- @viewport/foreground/hit-test COPY
- @viewport/foreground COPY
- BlockContainer<HTML>#html/descendants(foreground) ASSEMBLE
- BlockContainer<HTML>#html ASSEMBLE
- BlockContainer<HTML>#html/preamble COPY
- BlockContainer<HTML>#html/background/hit-test COPY
- BlockContainer<HTML>#html/scroll-metadata COPY
- BlockContainer<HTML>#html/background COPY
- BlockContainer<HTML>#html/border COPY
- BlockContainer<BODY>#body/descendants(background-and-borders) ASSEMBLE
- BlockContainer<BODY>#body/background/hit-test COPY
- BlockContainer<BODY>#body/scroll-metadata COPY
- BlockContainer<BODY>#body/background COPY
- BlockContainer<BODY>#body/border COPY
- BlockContainer<DIV>#scroller/descendants(background-and-borders) ASSEMBLE
- BlockContainer<DIV>#scroller/background/hit-test COPY
- BlockContainer<DIV>#scroller/scroll-metadata COPY
- BlockContainer<DIV>#scroller/background SKIP
- BlockContainer<DIV>#scroller/border SKIP
- BlockContainer<DIV>#content/descendants(background-and-borders) COPY
- BlockContainer<DIV>#other/descendants(background-and-borders) COPY
- BlockContainer<HTML>#html/foreground/hit-test COPY
- BlockContainer<HTML>#html/foreground COPY
- BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
- BlockContainer<BODY>#body/foreground/hit-test COPY
- BlockContainer<BODY>#body/foreground COPY
- BlockContainer<DIV>#scroller/descendants(foreground) ASSEMBLE
- BlockContainer<DIV>#scroller/foreground/hit-test COPY
- BlockContainer<DIV>#scroller/foreground RECORD (empty)
- BlockContainer<DIV>#content/descendants(foreground) COPY
- BlockContainer<DIV>#scroller/outline SKIP
- BlockContainer<DIV>#scroller/overlay/hit-test RECORD
- BlockContainer<DIV>#scroller/overlay RECORD
- BlockContainer<DIV>#other/descendants(foreground) COPY
- BlockContainer<BODY>#body/outline COPY
- BlockContainer<BODY>#body/overlay/hit-test COPY
- BlockContainer<BODY>#body/overlay COPY
- BlockContainer<HTML>#html/outline COPY
- BlockContainer<HTML>#html/overlay/hit-test COPY
- BlockContainer<HTML>#html/overlay COPY
- @viewport/outline COPY
- @viewport/overlay/hit-test COPY
- @viewport/overlay COPY
- `
- },
- {
- name: "leave the scrollbar",
- paintOverlay: true,
- mutate: () => { internals.mouseMove(150, 130); },
- expect: `
- damage: rows=4 moved=0 order=0 eligibility=0 all=false
- @canvas RECORD (empty)
- @viewport ASSEMBLE
- @viewport/preamble COPY
- @viewport/background/hit-test COPY
- @viewport/scroll-metadata COPY
- @viewport/background COPY
- @viewport/border COPY
- BlockContainer<HTML>#html/descendants(background-and-borders) ASSEMBLE
- @viewport/foreground/hit-test COPY
- @viewport/foreground COPY
- BlockContainer<HTML>#html/descendants(foreground) ASSEMBLE
- BlockContainer<HTML>#html ASSEMBLE
- BlockContainer<HTML>#html/preamble COPY
- BlockContainer<HTML>#html/background/hit-test COPY
- BlockContainer<HTML>#html/scroll-metadata COPY
- BlockContainer<HTML>#html/background COPY
- BlockContainer<HTML>#html/border COPY
- BlockContainer<BODY>#body/descendants(background-and-borders) ASSEMBLE
- BlockContainer<BODY>#body/background/hit-test COPY
- BlockContainer<BODY>#body/scroll-metadata COPY
- BlockContainer<BODY>#body/background COPY
- BlockContainer<BODY>#body/border COPY
- BlockContainer<DIV>#scroller/descendants(background-and-borders) ASSEMBLE
- BlockContainer<DIV>#scroller/background/hit-test COPY
- BlockContainer<DIV>#scroller/scroll-metadata COPY
- BlockContainer<DIV>#scroller/background SKIP
- BlockContainer<DIV>#scroller/border SKIP
- BlockContainer<DIV>#content/descendants(background-and-borders) COPY
- BlockContainer<DIV>#other/descendants(background-and-borders) COPY
- BlockContainer<HTML>#html/foreground/hit-test COPY
- BlockContainer<HTML>#html/foreground COPY
- BlockContainer<BODY>#body/descendants(foreground) ASSEMBLE
- BlockContainer<BODY>#body/foreground/hit-test COPY
- BlockContainer<BODY>#body/foreground COPY
- BlockContainer<DIV>#scroller/descendants(foreground) ASSEMBLE
- BlockContainer<DIV>#scroller/foreground/hit-test COPY
- BlockContainer<DIV>#scroller/foreground RECORD (empty)
- BlockContainer<DIV>#content/descendants(foreground) COPY
- BlockContainer<DIV>#scroller/outline SKIP
- BlockContainer<DIV>#scroller/overlay/hit-test RECORD
- BlockContainer<DIV>#scroller/overlay RECORD
- BlockContainer<DIV>#other/descendants(foreground) COPY
- BlockContainer<BODY>#body/outline COPY
- BlockContainer<BODY>#body/overlay/hit-test COPY
- BlockContainer<BODY>#body/overlay COPY
- BlockContainer<HTML>#html/outline COPY
- BlockContainer<HTML>#html/overlay/hit-test COPY
- BlockContainer<HTML>#html/overlay COPY
- @viewport/outline COPY
- @viewport/overlay/hit-test COPY
- @viewport/overlay COPY
- `
- }
- ]
-});
-</script>