Skip to content

Truly independent web browser

LibWeb+LibCompositing+Compositor: Give viewport scroll bars layers too

Aliaksandr Kalenik7924b9ea433e
diff --git a/Libraries/LibCompositing/Rust/src/display_list/commands.rs b/Libraries/LibCompositing/Rust/src/display_list/commands.rs
index ab0bea1e861..9972bca2df4 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/commands.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/commands.rs
@@ -1692,7 +1692,6 @@ pub struct CompositorScrollbar {
pub thumb_outline_color: Color,
pub track_color: Color,
pub vertical: bool,
- pub is_painted_by_compositor: bool,
}
display_list_record_fields!(CompositorScrollbar {
scroll_node_index,
@@ -1708,8 +1707,7 @@ display_list_record_fields!(CompositorScrollbar {
thumb_color,
thumb_outline_color,
track_color,
- vertical,
- is_painted_by_compositor
+ vertical
});
impl DisplayListCommand for CompositorScrollbar {
diff --git a/Libraries/LibCompositing/Rust/src/display_list/layers/planning.rs b/Libraries/LibCompositing/Rust/src/display_list/layers/planning.rs
index c0cf303c265..45b07aa0afd 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/layers/planning.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/layers/planning.rs
@@ -30,7 +30,8 @@ use crate::display_list::effect_geometry::{
};
use crate::display_list::placement::{
ANTIALIASING_MARGIN_IN_DEVICE_PIXELS, CompositeClip, FiltersAndClipsOfList, RasterSpace, RasterSpaceAnchorKind,
- RasterSpaceIndex, RunGroupIndex, RunGroups, enclosing_int_rect_within_extent_limit, is_finite_rect,
+ RasterSpaceIndex, RunGroupIndex, RunGroups, compositor_scroll_record_of, enclosing_int_rect_within_extent_limit,
+ is_finite_rect,
};
use crate::display_list::reach::Reach;
use crate::display_list::storage::{DisplayListStorage, ListPosition, ListSpan, RunIndexInChunk, RunIndexInList};
@@ -949,14 +950,19 @@ impl<'a> ListBeingPlaced<'a> {
}
}
// Past the most layers that live content of its kind gets, canvases and videos keep theirs before nested
- // contexts, and carets before scroll bars.
- let gives_way_to_others_of_its_kind = |media: &PlacedMedia| {
- matches!(
- media.content,
- LiveContent::CompositedContext(_) | LiveContent::ScrollBar { .. }
- )
+ // contexts, carets before scroll bars, and the scroll bars of the viewport before those of other scrollers.
+ let order_among_others_of_its_kind = |media: &PlacedMedia| match media.content {
+ LiveContent::CompositedContext(_) => 1,
+ LiveContent::ScrollBar { scroll_node, .. } => {
+ if compositor_scroll_record_of(tree, scroll_node).is_some_and(|record| record.is_viewport) {
+ 1
+ } else {
+ 2
+ }
+ }
+ _ => 0,
};
- placed_media.sort_by_key(gives_way_to_others_of_its_kind);
+ placed_media.sort_by_key(order_among_others_of_its_kind);
let mut layer_count_by_kind = [0usize; 2];
placed_media.retain(|media| {
let layer_count = &mut layer_count_by_kind[usize::from(media.content.is_drawn_by_its_record())];
@@ -3199,6 +3205,61 @@ mod tests {
);
}
+ // A scroll bar of the viewport is drawn over the document in the space of the viewport, and does not scroll with
+ // the document.
+ #[test]
+ fn a_scroll_bar_of_the_viewport_gets_a_layer_of_its_own() {
+ let (tree, viewport, document) = tree_with_document_scroll();
+ let planned = ListOfOneChunk::default()
+ .with(fill(IntRect::new(0, 0, 800, 2600), GREEN), document)
+ .with(scroll_bar(document.spatial, IntRect::new(790, 0, 10, 600)), viewport)
+ .planned(&tree, &[]);
+ assert!(planned.placement.media_without_layers.is_empty());
+ assert_eq!(
+ kinds_of_layers_from_base_up_that_may_hold_content(&planned.stack),
+ ["base document band 0", "vertical scroll bar #0 viewport"]
+ );
+ }
+
+ // The scroll bars of the viewport are recorded after all else, and past the most carets and scroll bars that get
+ // layers, they keep theirs before the scroll bars of other scrollers.
+ #[test]
+ fn the_scroll_bars_of_the_viewport_keep_their_layers_before_those_of_other_scrollers() {
+ let (tree, viewport, contexts) = tree_with_document_scroller(&[IntRect::new(100, 100, 300, 200)]);
+ let (document, scroller) = (contexts[0], contexts[1]);
+ let mut list = ListOfOneChunk::default().with(fill(IntRect::new(0, 0, 800, 2600), GREEN), document);
+ for index in 0..MAXIMUM_LAYER_COUNT_OF_LIVE_CONTENT_DRAWN_BY_ITS_RECORD as i32 {
+ list = list.with(
+ scroll_bar(scroller.spatial, IntRect::new(10 + index * 12, 100, 10, 200)),
+ document,
+ );
+ }
+ let planned = list
+ .with(scroll_bar(document.spatial, IntRect::new(790, 0, 10, 600)), viewport)
+ .planned(&tree, &[]);
+ let scroll_bar_of_viewport = LiveContent::ScrollBar {
+ scroll_node: document.spatial,
+ vertical: true,
+ };
+ assert!(
+ planned
+ .placement
+ .placed_media
+ .iter()
+ .any(|media| media.content == scroll_bar_of_viewport)
+ );
+ assert_eq!(
+ planned.placement.media_without_layers,
+ [(
+ LiveContent::ScrollBar {
+ scroll_node: scroller.spatial,
+ vertical: true
+ },
+ WhyMediaHasNoLayer::MoreMediaThanLayersFor
+ )]
+ );
+ }
+
#[test]
fn a_canvas_that_no_record_painted_after_it_overlaps_cuts_no_tile() {
let (tree, _, document) = tree_with_document_scroll();
diff --git a/Libraries/LibCompositing/Rust/src/display_list/validate.rs b/Libraries/LibCompositing/Rust/src/display_list/validate.rs
index 4277b217fb3..5e26de7f376 100644
--- a/Libraries/LibCompositing/Rust/src/display_list/validate.rs
+++ b/Libraries/LibCompositing/Rust/src/display_list/validate.rs
@@ -533,10 +533,7 @@ fn validate_command_fields(
nested.add(offset_of!(PaintVectorImage, records))?;
p.bool_at(offset_of!(PaintVectorImage, requires_direct_replay))?;
}
- T::CompositorScrollbar => {
- p.bool_at(offset_of!(CompositorScrollbar, vertical))?;
- p.bool_at(offset_of!(CompositorScrollbar, is_painted_by_compositor))?;
- }
+ T::CompositorScrollbar => p.bool_at(offset_of!(CompositorScrollbar, vertical))?,
T::PaintScrollBar => p.bool_at(offset_of!(PaintScrollBar, vertical))?,
T::Canvas2DFillPath => {
p.span_at(offset_of!(Canvas2DFillPath, path_data))?;
diff --git a/Libraries/LibCompositing/Rust/src/scrolling/async_scrolling_state.rs b/Libraries/LibCompositing/Rust/src/scrolling/async_scrolling_state.rs
index faa4f90ab6d..5ef1636c4ac 100644
--- a/Libraries/LibCompositing/Rust/src/scrolling/async_scrolling_state.rs
+++ b/Libraries/LibCompositing/Rust/src/scrolling/async_scrolling_state.rs
@@ -124,9 +124,8 @@ pub struct AsyncScrollbar {
pub thumb_outline_color: Color,
pub track_color: Color,
pub vertical: bool,
- // 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.
- pub is_painted_by_compositor: bool,
+ // The page takes no pointer input on a scrollbar of the viewport, which the compositor drags by itself.
+ pub scrolls_viewport: bool,
}
// A scroll node that is a snap container, with the geometry snap positions are selected from.
@@ -416,7 +415,7 @@ pub fn async_scrolling_state_from(
thumb_outline_color: command.thumb_outline_color,
track_color: command.track_color,
vertical: command.vertical,
- is_painted_by_compositor: command.is_painted_by_compositor,
+ scrolls_viewport: false,
});
next_paint_order_index = next_paint_order_index.wrapping_add(1);
}
@@ -427,6 +426,7 @@ pub fn async_scrolling_state_from(
for scroll_node in &async_scrolling_state.scroll_nodes {
if scroll_node.scroll_node_index == scrollbar.scroll_node_index {
scrollbar.scroller_stable_node_id = Some(scroll_node.stable_node_id);
+ scrollbar.scrolls_viewport = scroll_node.is_viewport;
break;
}
}
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 e22c60e2509..e49ddf6bf97 100644
--- a/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
+++ b/Libraries/LibWeb/Rust/src/painting/record/async_scroll_metadata.rs
@@ -8,10 +8,8 @@ use crate::painting::paint_read::{GeometryRead, PaintRead};
use crate::painting::record::trace::Observer;
use crate::css::css_pixels::{CssPixelRect, CssPixelSize};
-use crate::layout::node_data::{DomPaintFact, NodeKind, NodeSlotId};
-use crate::painting::chrome_geometry::{
- ChromeGeometry, ScrollbarColors, maximum_scroll_offset, minimum_scroll_offset, scrollbar_colors_for_paint,
-};
+use crate::layout::node_data::{DomPaintFact, NodeSlotId};
+use crate::painting::chrome_geometry::{ChromeGeometry, ScrollbarColors, maximum_scroll_offset, minimum_scroll_offset};
use crate::painting::display_list::commands::*;
use crate::painting::ffi::ScrollDirection;
use crate::painting::paintable_geometry;
@@ -176,7 +174,6 @@ impl<O: Observer> PaintRecorder<'_, O> {
paintable: NodeSlotId,
direction: ScrollDirection,
colors: ScrollbarColors,
- is_painted_by_compositor: bool,
) -> Option<CompositorScrollbar> {
let chrome_geometry = ChromeGeometry::for_recording(self.source, self.inputs);
let scrollbar = chrome_geometry.compute_scrollbar_data(paintable, direction, false)?;
@@ -210,46 +207,18 @@ impl<O: Observer> PaintRecorder<'_, O> {
thumb_outline_color: colors.thumb_outline,
track_color: colors.track,
vertical,
- is_painted_by_compositor,
})
}
- fn record_viewport_scrollbar_state(&mut self, paintable: NodeSlotId) {
- let records_viewport_scrollbars = self.source.node_kind_if_live(paintable) == Some(NodeKind::Viewport)
- && self.inputs.uncaptured.paint_viewport_scrollbars
- && self.source.node_style_if_live(paintable).is_some_and(|style| {
- style.misc_interaction().scrollbar_width != crate::css::css_enums::scrollbar_width::NONE
- });
- if !records_viewport_scrollbars {
- return;
- }
- let colors = scrollbar_colors_for_paint(
- self.source,
- paintable,
- self.inputs.uncaptured.root_background_source,
- self.inputs
- .uncaptured
- .canvas_color
- .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) {
- self.recorder.compositor_scrollbar(scrollbar);
- }
- }
- }
-
- // The compositor may drag a scrollbar the display list paints only where the main thread would
- // hit test that scrollbar, so this mirrors the conditions its chrome widget hit test items are
- // recorded under.
- pub(crate) fn record_compositor_scrollbar_painted_by_display_list(
+ // The compositor may drag a scrollbar only where the main thread would hit test that scrollbar, so
+ // this mirrors the conditions its chrome widget hit test items are recorded under.
+ pub(crate) fn record_compositor_scrollbar(
&mut self,
paintable: NodeSlotId,
direction: ScrollDirection,
colors: ScrollbarColors,
) {
- if self.source.node_kind_if_live(paintable) == Some(NodeKind::Viewport)
- || !self.has_compositor_scroll_node(paintable)
+ if !self.has_compositor_scroll_node(paintable)
|| !self.visibility_is_visible(paintable)
|| !self.visible_for_hit_testing(paintable)
{
@@ -263,7 +232,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) {
+ if let Some(scrollbar) = self.compositor_scrollbar_for(paintable, direction, colors) {
self.recorder.compositor_scrollbar(scrollbar);
}
}
@@ -286,6 +255,5 @@ impl<O: Observer> PaintRecorder<'_, O> {
self.record_main_thread_wheel_event_region(paintable);
}
}
- self.record_viewport_scrollbar_state(paintable);
}
}
diff --git a/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs b/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs
index 46dce1173e8..bac1155b97d 100644
--- a/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs
+++ b/Libraries/LibWeb/Rust/src/painting/record/paint/overlay.rs
@@ -30,7 +30,8 @@ pub(crate) fn paint_overlay<O: Observer>(recorder: &mut PaintRecorder<'_, O>, pa
let chrome_geometry = ChromeGeometry::for_recording(recorder.source, recorder.inputs);
let style = recorder.source.node_style_if_live(paintable);
let paints_scrollbars = style.is_some_and(|style| {
- !is_viewport && style.misc_interaction().scrollbar_width != crate::css::css_enums::scrollbar_width::NONE
+ style.misc_interaction().scrollbar_width != crate::css::css_enums::scrollbar_width::NONE
+ && (!is_viewport || recorder.inputs.uncaptured.paint_viewport_scrollbars)
});
if paints_scrollbars {
@@ -54,7 +55,7 @@ pub(crate) fn paint_overlay<O: Observer>(recorder: &mut PaintRecorder<'_, O>, pa
.compute_scrollbar_data(paintable, direction, true)
.map(|expanded| expanded.gutter_rect)
.unwrap_or_default();
- recorder.record_compositor_scrollbar_painted_by_display_list(paintable, direction, colors);
+ recorder.record_compositor_scrollbar(paintable, direction, colors);
recorder.recorder.paint_scrollbar(
scroll_node_index,
converter.rounded_device_rect(scrollbar.gutter_rect),
diff --git a/Libraries/LibWebCommon/Page/InputRoutingDecision.h b/Libraries/LibWebCommon/Page/InputRoutingDecision.h
index 0d4dadb39bd..55d309d3e11 100644
--- a/Libraries/LibWebCommon/Page/InputRoutingDecision.h
+++ b/Libraries/LibWebCommon/Page/InputRoutingDecision.h
@@ -37,8 +37,8 @@ namespace Web {
X(NestedContextUnavailable, "nested-context-unavailable") \
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(HoveringViewportScrollbar, "hovering-viewport-scrollbar") \
+ X(HoveringElementScrollbar, "hovering-element-scrollbar") \
X(BeganScrollbarDrag, "began-scrollbar-drag") \
X(ContinuedScrollbarDrag, "continued-scrollbar-drag") \
X(EndedScrollbarDrag, "ended-scrollbar-drag") \
diff --git a/Libraries/LibWebCommon/Page/InputRoutingDecision.ipc b/Libraries/LibWebCommon/Page/InputRoutingDecision.ipc
index 6057e042c81..50f62d0b8a2 100644
--- a/Libraries/LibWebCommon/Page/InputRoutingDecision.ipc
+++ b/Libraries/LibWebCommon/Page/InputRoutingDecision.ipc
@@ -29,8 +29,8 @@ enum Web::InputRoutingDecision : u8 {
NestedContextUnavailable,
NotOverAScrollbar,
NotPrimaryButton,
- HoveringScrollbarPaintedByCompositor,
- HoveringScrollbarPaintedByDisplayList,
+ HoveringViewportScrollbar,
+ HoveringElementScrollbar,
BeganScrollbarDrag,
ContinuedScrollbarDrag,
EndedScrollbarDrag,
diff --git a/Services/Compositor/Rust/src/context_state/frames_and_viewport.rs b/Services/Compositor/Rust/src/context_state/frames_and_viewport.rs
index 2ebc09f8fb3..7929ddd6e69 100644
--- a/Services/Compositor/Rust/src/context_state/frames_and_viewport.rs
+++ b/Services/Compositor/Rust/src/context_state/frames_and_viewport.rs
@@ -292,7 +292,6 @@ impl ContextState {
.scrollbar_controller
.scrollbars_of_frame(&presented_scroll_state_snapshot);
let overlays = self.overlays.picture_of_frame(
- &scrollbars,
self.viewport_size,
self.device_pixel_ratio,
&self.host.overlay_label_shaper(self.context_id),
@@ -345,13 +344,15 @@ impl ContextState {
}
}
- /// Advances the fades of the scrollbars to a frame. Answers None where none changed, and otherwise what of the viewport
- /// the frame repaints for them besides what it finds changed.
- pub fn advance_scrollbar_fades(&mut self, frame_time: MonotonicTime) -> Option<IntRect> {
- self.scene.visual_context_tree().as_ref()?;
- let damage_rect = self.scrollbar_controller.advance_fades(frame_time);
+ /// Advances the fades of the scrollbars to a frame, and answers whether any of them changed. The frame finds what
+ /// changed in the content hashes of their records.
+ pub fn advance_scrollbar_fades(&mut self, frame_time: MonotonicTime) -> bool {
+ if self.scene.visual_context_tree().is_none() {
+ return false;
+ }
+ let some_scrollbar_changed = self.scrollbar_controller.advance_fades(frame_time);
self.report_scrollbar_visibility_changes();
- damage_rect
+ some_scrollbar_changed
}
/// Each frame shows the scrollbars as of when it is painted, so this updates which of them are shown. Empty until a
@@ -402,10 +403,10 @@ impl ContextState {
let capture_time = now;
self.advance_visual_animations(capture_time);
self.update_scrollbar_visibility(now);
- let scrollbar_fade_damage_rect = self.advance_scrollbar_fades(capture_time);
+ let scrollbar_fades_changed = self.advance_scrollbar_fades(capture_time);
ScreenshotInputs {
frame_inputs: self.frame_inputs_as_presented_now(capture_time),
- scrollbar_fade_damage_rect,
+ scrollbar_fades_changed,
}
}
diff --git a/Services/Compositor/Rust/src/context_state/keys_and_pointer.rs b/Services/Compositor/Rust/src/context_state/keys_and_pointer.rs
index 63595d738d4..2145d33c1b7 100644
--- a/Services/Compositor/Rust/src/context_state/keys_and_pointer.rs
+++ b/Services/Compositor/Rust/src/context_state/keys_and_pointer.rs
@@ -305,15 +305,14 @@ impl ContextState {
self.pointer_position = position;
}
- // A frame that shows how the scrollbars grow. The scrollbars the compositor paints itself are outside of what damage
- // tracking sees, so the frame repaints where they are; it finds what changed of the others in their records.
+ // A frame that shows how the scrollbars grow, which it finds in the content hashes of their records.
fn frame_repainting_scrollbars(&self) -> Option<PendingFrame> {
if self.async_scrolling_viewport_rect.is_empty() {
return None;
}
Some(PendingFrame {
viewport_rect: self.async_scrolling_viewport_rect,
- forced_damage_rect: self.scrollbar_controller.rect_of_scrollbars_painted_by_compositor(),
+ forced_damage_rect: Default::default(),
})
}
@@ -326,14 +325,7 @@ impl ContextState {
}
fn scrollbar_under_pointer(&mut self, position: FloatPoint) -> Option<usize> {
- if let Some(index) = self.scrollbar_controller.hit_test_scrollbar_painted_by_compositor(
- &self.async_scroll_tree,
- &self.scroll_state_snapshot,
- position,
- ) {
- return Some(index);
- }
- self.scrollbar_controller.hit_test_scrollbar_painted_by_display_list(
+ self.scrollbar_controller.hit_test_scrollbar(
&self.async_scroll_tree,
self.scene.visual_context_tree_for_compositing(),
&self.scroll_state_snapshot,
@@ -341,28 +333,15 @@ impl ContextState {
)
}
- // The compositor paints its own scrollbars over everything, so a nested context only takes the pointer where none of
- // them is under it, and where no scrollbar the display list paints comes after the nested context's content in paint
- // order. A press passes by a scrollbar that has faded out, as it does here.
- fn nested_context_taking_mouse_event_at(
- &mut self,
- event_type: MouseEventType,
- position: FloatPoint,
- ) -> Option<NestedContextHit> {
+ // A nested context only takes the pointer where no scrollbar comes after the nested context's content in paint order.
+ // The scrollbars of the viewport come after all else. A scrollbar that has faded out takes no pointer.
+ fn nested_context_taking_mouse_event_at(&mut self, position: FloatPoint) -> Option<NestedContextHit> {
if !self.has_async_scrolling_state {
return None;
}
let tree = self.scene.visual_context_tree_for_compositing();
let hit = self.async_scroll_tree.nested_context_at(tree, position)?;
- if let Some(index) = self.scrollbar_controller.hit_test_scrollbar_painted_by_compositor(
- &self.async_scroll_tree,
- &self.scroll_state_snapshot,
- position,
- ) && (event_type != MouseEventType::MouseDown || self.scrollbar_controller.is_shown(index))
- {
- return None;
- }
- if let Some(index) = self.scrollbar_controller.hit_test_scrollbar_painted_by_display_list(
+ if let Some(index) = self.scrollbar_controller.hit_test_scrollbar(
&self.async_scroll_tree,
tree,
&self.scroll_state_snapshot,
@@ -420,7 +399,7 @@ impl ContextState {
if event.button != MouseButton::Primary {
return ContextUpdateResult::declined(InputRoutingDecision::NotPrimaryButton);
}
- if let Some(hit) = self.nested_context_taking_mouse_event_at(event.r#type, position) {
+ if let Some(hit) = self.nested_context_taking_mouse_event_at(position) {
return hand_to_nested_context(self, hit);
}
let Some(drag) = self.scrollbar_controller.begin_drag(
@@ -441,7 +420,7 @@ impl ContextState {
result.routed_scroller = scroller_of_scrollbar(&self.scrollbar_controller, drag.scrollbar_index);
result.scrollbar_dragged_by_compositor = self
.scrollbar_controller
- .captured_scrollbar_painted_by_display_list(self.context_id);
+ .captured_scrollbar_the_page_takes(self.context_id);
result.frame_to_present = self.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.
@@ -485,7 +464,7 @@ impl ContextState {
if self.scrollbar_controller.has_captured_scrollbar() {
let scrollbar_dragged_by_compositor = self
.scrollbar_controller
- .captured_scrollbar_painted_by_display_list(self.context_id);
+ .captured_scrollbar_the_page_takes(self.context_id);
let drag = self.scrollbar_controller.captured_drag(
self.scene.visual_context_tree_for_compositing(),
&self.scroll_state_snapshot,
@@ -518,7 +497,7 @@ impl ContextState {
..Default::default()
};
}
- if let Some(hit) = self.nested_context_taking_mouse_event_at(event.r#type, position) {
+ if let Some(hit) = self.nested_context_taking_mouse_event_at(position) {
return hand_to_nested_context(self, hit);
}
let hovered_scrollbar_index = self.scrollbar_under_pointer(position);
@@ -533,19 +512,20 @@ impl ContextState {
..Default::default()
};
};
- // The page sees the pointer move over a scrollbar the display list paints, as it is part of the page's content.
+ // The page sees the pointer move over a scrollbar of an element, as it is part of the element, but not over a
+ // scrollbar of the viewport.
let Some(scrollbar) = self.scrollbar_controller.scrollbars().get(index) else {
return ContextUpdateResult::default();
};
- let is_painted_by_compositor = scrollbar.is_painted_by_compositor;
+ let scrolls_viewport = scrollbar.scrolls_viewport;
ContextUpdateResult {
- accepted: is_painted_by_compositor,
+ accepted: scrolls_viewport,
frame_to_present,
should_request_rendering_update: false,
- routing_decision: Some(if is_painted_by_compositor {
- InputRoutingDecision::HoveringScrollbarPaintedByCompositor
+ routing_decision: Some(if scrolls_viewport {
+ InputRoutingDecision::HoveringViewportScrollbar
} else {
- InputRoutingDecision::HoveringScrollbarPaintedByDisplayList
+ InputRoutingDecision::HoveringElementScrollbar
}),
routed_scroller: scroller_of_scrollbar(&self.scrollbar_controller, index),
..Default::default()
@@ -558,7 +538,7 @@ impl ContextState {
let box_of_dragged_scrollbar = self.box_of_captured_scrollbar();
let scrollbar_dragged_by_compositor = self
.scrollbar_controller
- .captured_scrollbar_painted_by_display_list(self.context_id);
+ .captured_scrollbar_the_page_takes(self.context_id);
let drag = self.scrollbar_controller.release_captured_drag(
self.scene.visual_context_tree_for_compositing(),
&self.scroll_state_snapshot,
@@ -604,7 +584,7 @@ impl ContextState {
should_request_rendering_update: false,
scrollbar_dragged_by_compositor: self
.scrollbar_controller
- .captured_scrollbar_painted_by_display_list(self.context_id),
+ .captured_scrollbar_the_page_takes(self.context_id),
routing_decision: Some(if had_capture {
InputRoutingDecision::LeftDuringScrollbarDrag
} else {
diff --git a/Services/Compositor/Rust/src/context_state/mod.rs b/Services/Compositor/Rust/src/context_state/mod.rs
index 481fedb6679..b89848c89dc 100644
--- a/Services/Compositor/Rust/src/context_state/mod.rs
+++ b/Services/Compositor/Rust/src/context_state/mod.rs
@@ -204,8 +204,8 @@ impl Default for ScrollCapabilities {
pub struct ScreenshotInputs {
pub frame_inputs: FrameInputs,
- /// The scrollbar fade damage that the screenshot does not present on screen, where a fade changed.
- pub scrollbar_fade_damage_rect: Option<IntRect>,
+ /// Whether a scrollbar fade changed for the screenshot, which a frame then presents on screen.
+ pub scrollbar_fades_changed: bool,
}
struct ActiveSmoothScrollAnimation {
diff --git a/Services/Compositor/Rust/src/context_state/scrolling.rs b/Services/Compositor/Rust/src/context_state/scrolling.rs
index 66fd65deef0..57a832310f3 100644
--- a/Services/Compositor/Rust/src/context_state/scrolling.rs
+++ b/Services/Compositor/Rust/src/context_state/scrolling.rs
@@ -1098,7 +1098,9 @@ impl ContextState {
mod tests {
use super::*;
use crate::host::{FfiCompositorCoreHost, FfiOverlayLabel};
- use libcompositing_rust::display_list::commands::{CompositorContextId, UniqueNodeId};
+ use libcompositing_rust::display_list::commands::{
+ ClipNodeIndex, CompositorContextId, ContextRef, EffectNodeIndex, UniqueNodeId,
+ };
use libcompositing_rust::display_list::storage::DisplayListStorage;
use libcompositing_rust::node_slot_id::NodeSlotId;
use libcompositing_rust::visual_context::{
@@ -1321,4 +1323,83 @@ mod tests {
assert!(test.context.smooth_scroll_animations.is_empty());
}
}
+
+ // The compositor drags a scrollbar of the viewport by itself, and the page sees neither the pointer moving over it
+ // nor a press on it. A scrollbar of an element is part of the element, so the page sees both.
+ #[test]
+ fn the_page_sees_the_pointer_on_a_scrollbar_of_an_element_only() {
+ for kind in [AsyncScrollNodeKind::Viewport, AsyncScrollNodeKind::Element] {
+ let mut test = WheelTest::new(kind);
+ let scrolls_viewport = kind == AsyncScrollNodeKind::Viewport;
+ test.context.scrollbar_controller = ScrollbarController::new(true);
+ test.context.scrollbar_controller.set_scrollbars(&[AsyncScrollbar {
+ scroller_stable_node_id: Some(AsyncScrollNodeStableID {
+ node_id: UniqueNodeId(1),
+ kind,
+ pseudo_element_type: 0,
+ }),
+ scroll_node_index: test.node_index,
+ context: ContextRef {
+ spatial: VISUAL_VIEWPORT_NODE_INDEX,
+ clip: ClipNodeIndex::NONE,
+ effect: EffectNodeIndex::NONE,
+ },
+ thumb_rect: IntRect::new(90, 0, 10, 25),
+ track_rect: IntRect::new(90, 0, 10, 100),
+ expanded_gutter_rect: IntRect::new(86, 0, 14, 100),
+ expanded_thumb_rect: IntRect::new(88, 0, 12, 25),
+ scroll_size: 0.075,
+ expanded_scroll_size: 0.075,
+ max_scroll_offset: 1000.0,
+ vertical: true,
+ scrolls_viewport,
+ ..Default::default()
+ }]);
+ test.context.rebuild_wheel_hit_test_targets();
+ let position = FloatPoint { x: 95.0, y: 10.0 };
+ let mouse_event = |r#type, button| MouseEvent {
+ r#type,
+ position: DevicePixelPoint { x: 95, y: 10 },
+ screen_position: DevicePixelPoint { x: 95, y: 10 },
+ button,
+ buttons: button,
+ modifiers: KeyModifier::Mod_None,
+ wheel_delta_x: 0.0,
+ wheel_delta_y: 0.0,
+ wheel_tick_120ths_x: 0.0,
+ wheel_tick_120ths_y: 0.0,
+ wheel_delta_precision: WheelDeltaPrecision::Discrete,
+ scroll_gesture_phase: ScrollGesturePhase::None,
+ click_count: 1,
+ async_scroll_performed_default_action: false,
+ id: 1,
+ scrollbar_dragged_by_compositor: None,
+ pointer_data: PointerInputData { properties: None },
+ wheel_gesture_mark: None,
+ };
+ let now = MonotonicTime::from_nanoseconds(1_000_000_000);
+ let hovered = test.context.handle_mouse_event_from_containing_context(
+ &mouse_event(MouseEventType::MouseMove, MouseButton::None),
+ position,
+ now,
+ );
+ assert_eq!(
+ hovered.routing_decision,
+ Some(if scrolls_viewport {
+ InputRoutingDecision::HoveringViewportScrollbar
+ } else {
+ InputRoutingDecision::HoveringElementScrollbar
+ })
+ );
+ assert_eq!(hovered.accepted, scrolls_viewport);
+
+ let pressed = test.context.handle_mouse_event_from_containing_context(
+ &mouse_event(MouseEventType::MouseDown, MouseButton::Primary),
+ position,
+ now,
+ );
+ assert_eq!(pressed.routing_decision, Some(InputRoutingDecision::BeganScrollbarDrag));
+ assert_eq!(pressed.scrollbar_dragged_by_compositor.is_some(), !scrolls_viewport);
+ }
+ }
}
diff --git a/Services/Compositor/Rust/src/core/mod.rs b/Services/Compositor/Rust/src/core/mod.rs
index be2081f369c..9dd4a6c9cd1 100644
--- a/Services/Compositor/Rust/src/core/mod.rs
+++ b/Services/Compositor/Rust/src/core/mod.rs
@@ -1015,12 +1015,11 @@ impl CompositorCore {
scheduling: PresentScheduling::WithDisplayTickInProgress,
});
}
- let damage_rect = context.borrow_mut().advance_scrollbar_fades(frame_time);
- if let Some(damage_rect) = damage_rect {
+ if context.borrow_mut().advance_scrollbar_fades(frame_time) {
self.present_requests.borrow_mut().push(PresentRequest {
context_id,
viewport_rect: None,
- forced_damage_rect: damage_rect,
+ forced_damage_rect: Default::default(),
scheduling: PresentScheduling::WithDisplayTickInProgress,
});
}
diff --git a/Services/Compositor/Rust/src/core/presenting.rs b/Services/Compositor/Rust/src/core/presenting.rs
index fb029558f75..05564a443bb 100644
--- a/Services/Compositor/Rust/src/core/presenting.rs
+++ b/Services/Compositor/Rust/src/core/presenting.rs
@@ -1291,14 +1291,14 @@ impl CompositorCore {
presenting
.borrow_mut()
.paint_screenshot(&environment, target, &display_list, &screenshot_inputs.frame_inputs);
- if let Some(forced_damage_rect) = screenshot_inputs.scrollbar_fade_damage_rect {
+ if screenshot_inputs.scrollbar_fades_changed {
let viewport_rect = presenting.borrow().viewport_rect_of_current_frame();
if let Some(viewport_rect) = viewport_rect {
self.schedule_present_frame(
context_id,
PendingFrame {
viewport_rect,
- forced_damage_rect,
+ forced_damage_rect: Default::default(),
},
now,
);
diff --git a/Services/Compositor/Rust/src/frame_inputs.rs b/Services/Compositor/Rust/src/frame_inputs.rs
index 41d631df8fe..221596f4999 100644
--- a/Services/Compositor/Rust/src/frame_inputs.rs
+++ b/Services/Compositor/Rust/src/frame_inputs.rs
@@ -18,7 +18,6 @@ use libgfx_rust::{Color, FloatRect, IntRect};
pub struct ScrollbarOfFrame {
pub scroll_node_index: SpatialNodeIndex,
pub vertical: bool,
- pub is_painted_by_compositor: bool,
pub gutter_rect: FloatRect,
pub thumb_rect: FloatRect,
pub expansion: f32,
@@ -34,7 +33,6 @@ impl Default for ScrollbarOfFrame {
Self {
scroll_node_index: Default::default(),
vertical: false,
- is_painted_by_compositor: false,
gutter_rect: Default::default(),
thumb_rect: Default::default(),
expansion: 0.0,
@@ -69,7 +67,6 @@ impl FrameInputs {
pub fn scrollbars_shown_for_the_page(&self) -> Vec<ScrollbarShownByFrame> {
self.scrollbars
.iter()
- .filter(|scrollbar| !scrollbar.is_painted_by_compositor)
.map(|scrollbar| ScrollbarShownByFrame {
scroll_node_index: scrollbar.scroll_node_index,
vertical: scrollbar.vertical,
@@ -80,26 +77,4 @@ impl FrameInputs {
})
.collect()
}
-
- fn scroll_offset_changed_since(&self, last_frame_inputs: &FrameInputs, index: SpatialNodeIndex) -> bool {
- last_frame_inputs
- .presented_scroll_state_snapshot
- .device_offset_for_index(index)
- != self.presented_scroll_state_snapshot.device_offset_for_index(index)
- }
-
- pub fn gutters_of_compositor_painted_scrollbars_that_scrolled_since(
- &self,
- last_frame_inputs: &FrameInputs,
- ) -> IntRect {
- self.scrollbars
- .iter()
- .filter(|scrollbar| {
- scrollbar.is_painted_by_compositor
- && self.scroll_offset_changed_since(last_frame_inputs, scrollbar.scroll_node_index)
- })
- .fold(IntRect::default(), |damage, scrollbar| {
- damage.united(scrollbar.thin_and_expanded_gutter_rect)
- })
- }
}
diff --git a/Services/Compositor/Rust/src/overlays.rs b/Services/Compositor/Rust/src/overlays.rs
index a9e7819998d..23c5f861d1a 100644
--- a/Services/Compositor/Rust/src/overlays.rs
+++ b/Services/Compositor/Rust/src/overlays.rs
@@ -4,10 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
-//! What the compositor draws over the page of a context: the scrollbars it paints itself, and the overlays the browser
-//! asks for. They are recorded as display list records and played through the same painter as the page.
+//! What the compositor draws over the page of a context: the overlays the browser asks for. They are recorded as display
+//! list records and played through the same painter as the page.
-use crate::frame_inputs::ScrollbarOfFrame;
use libcompositing_rust::display_list::builder::{DisplayListBuilder, HEADER_SIZE, PendingInlineClip};
use libcompositing_rust::display_list::commands::{
ContextRef, DisplayListCommand, DisplayListDataSpan, DisplayListGlyph, DisplayListPaintStyle, DrawGlyphRun,
@@ -17,7 +16,6 @@ use libcompositing_rust::display_list::ffi_bytes::FfiBytes;
use libcompositing_rust::display_list::replay::{
ListReplay, RecordsContext, ReplayFrame, ReplayPainter, replay_records,
};
-use libcompositing_rust::host::PresentedScrollbar;
use libcompositing_rust::overlays::{
PausedDebuggerOverlayGeometry, paused_debugger_overlay_geometry, picture_in_picture_controls_geometry,
scaled_overlay_length,
@@ -186,29 +184,15 @@ impl ContextOverlays {
Some(picture_in_picture_controls_geometry(viewport_size, device_pixel_ratio).buttons_bounds())
}
- /// What the overlays draw over a frame of the page, with the scrollbars the frame shows.
+ /// What the overlays draw over a frame of the page.
pub fn picture_of_frame(
&mut self,
- scrollbars: &[ScrollbarOfFrame],
viewport_size: IntSize,
device_pixel_ratio: f64,
label_shaper: &dyn OverlayLabelShaper,
) -> OverlayPicture {
let viewport_rect = IntRect::new(0, 0, viewport_size.width, viewport_size.height);
let mut bounds = IntRect::default();
- let mut presented_scrollbars = Vec::new();
- for scrollbar in scrollbars.iter().filter(|scrollbar| scrollbar.is_painted_by_compositor) {
- presented_scrollbars.push(presented_compositor_scrollbar(scrollbar));
- if scrollbar.opacity <= 0.0 {
- continue;
- }
- // The thumb's outline is drawn around the gutter, which grows into the expanded gutter as it is hovered.
- bounds = bounds.united(
- enclosing_int_rect(scrollbar.gutter_rect)
- .united(scrollbar.thin_and_expanded_gutter_rect)
- .inflated(2, 2),
- );
- }
let mut ui_overlay_records = DisplayListBuilder::new();
if let Some(paused_debugger) = self.ui_overlays.paused_debugger.clone() {
@@ -241,7 +225,6 @@ impl ContextOverlays {
bounds = viewport_rect;
}
OverlayPicture {
- scrollbars: presented_scrollbars,
ui_overlay_records: AlignedRecords::new(&ui_overlay_records.finish().bytes),
picture_in_picture_controls,
bounds: bounds.intersected(viewport_rect),
@@ -311,7 +294,6 @@ struct PictureInPictureControlsPicture {
/// What the overlays draw over one frame, in the order they are drawn, and the part of the viewport they cover.
pub struct OverlayPicture {
- scrollbars: Vec<PresentedScrollbar>,
ui_overlay_records: AlignedRecords,
picture_in_picture_controls: Option<PictureInPictureControlsPicture>,
pub bounds: IntRect,
@@ -379,17 +361,12 @@ impl OverlayPicture {
_ => false,
};
self.bounds == other.bounds
- && self.scrollbars == other.scrollbars
&& self.ui_overlay_records.as_bytes() == other.ui_overlay_records.as_bytes()
&& picture_in_picture_controls_draw_the_same
}
- /// Paints the overlays over a frame: the scrollbars the compositor paints, and unless they are left out, the
- /// overlays of the browser.
+ /// Paints the overlays over a frame, unless they are left out.
pub fn paint(&self, painter: &mut impl ReplayPainter, paints_ui_overlays: bool) {
- for scrollbar in &self.scrollbars {
- painter.paint_scrollbar(scrollbar);
- }
if !paints_ui_overlays {
return;
}
@@ -416,18 +393,6 @@ impl OverlayPicture {
}
}
-fn presented_compositor_scrollbar(scrollbar: &ScrollbarOfFrame) -> PresentedScrollbar {
- libcompositing_rust::display_list::replay::presented_scrollbar_with_colors(
- scrollbar.gutter_rect,
- scrollbar.thumb_rect,
- scrollbar.expansion,
- scrollbar.opacity,
- scrollbar.thumb_color,
- scrollbar.thumb_outline_color,
- scrollbar.track_color,
- )
-}
-
/// The records of one overlay, with the payload of each command laid out after the command as the painter reads it.
pub(crate) struct OverlayRecorder<'a> {
builder: &'a mut DisplayListBuilder,
diff --git a/Services/Compositor/Rust/src/presenting/damage.rs b/Services/Compositor/Rust/src/presenting/damage.rs
index 5ea2ab921ad..6ad073fab76 100644
--- a/Services/Compositor/Rust/src/presenting/damage.rs
+++ b/Services/Compositor/Rust/src/presenting/damage.rs
@@ -289,13 +289,7 @@ impl ContextPresenting {
);
let live_media_changed = changes.canvas_or_video_changed;
- let scrolled_compositor_scrollbars = self.painted_frame.as_ref().map_or(IntRect::default(), |painted_frame| {
- frame
- .frame_inputs
- .gutters_of_compositor_painted_scrollbars_that_scrolled_since(&painted_frame.frame_inputs)
- });
- let forced_damage_rect =
- self.raster_rect_of(forced_damage_rect.united(scrolled_compositor_scrollbars.intersected(viewport_rect)));
+ let forced_damage_rect = self.raster_rect_of(forced_damage_rect);
let damage_of_layers_moved_by_animated_transforms =
self.damage_of_layers_moved_by_animated_transforms(&layer_update, raster_rect);
let repaints_everything = invalidates_every_tile
diff --git a/Services/Compositor/Rust/src/scrollbar_controller.rs b/Services/Compositor/Rust/src/scrollbar_controller.rs
index 1e49cf6e265..6fb8e0412df 100644
--- a/Services/Compositor/Rust/src/scrollbar_controller.rs
+++ b/Services/Compositor/Rust/src/scrollbar_controller.rs
@@ -111,7 +111,7 @@ fn find_scrollbar_index(scrollbars: &[AsyncScrollbar], identity: &ScrollbarIdent
.position(|scrollbar| scrollbar_has_identity(scrollbar, identity))
}
-// The rects of a scrollbar the compositor paints are in the viewport's space already.
+// The rects of a scrollbar are in the space of the context it is painted in.
fn position_in_space_of_scrollbar(
scrollbar: &AsyncScrollbar,
visual_context_tree: &AccumulatedVisualContextTree,
@@ -119,9 +119,6 @@ fn position_in_space_of_scrollbar(
position: FloatPoint,
clip_behavior: ClipBehavior,
) -> Option<FloatPoint> {
- if scrollbar.is_painted_by_compositor {
- return Some(position);
- }
if !visual_context_tree.context_is_valid(scrollbar.context) {
return None;
}
@@ -179,20 +176,6 @@ fn translated_thumb_rect_with_snapshot(
thumb_rect
}
-fn scrollbar_hit_rect(scrollbar: &AsyncScrollbar, scroll_offset: FloatPoint) -> IntRect {
- const SCROLLBAR_HIT_SLOP: i32 = 4;
- let mut rect = translated_thumb_rect(scrollbar, scroll_offset, false).united(translated_thumb_rect(
- scrollbar,
- scroll_offset,
- true,
- ));
- let expanded_gutter_rect = scrollbar_gutter_rect(scrollbar, true);
- if !expanded_gutter_rect.is_empty() {
- rect = rect.united(expanded_gutter_rect);
- }
- rect.inflated(SCROLLBAR_HIT_SLOP, SCROLLBAR_HIT_SLOP)
-}
-
impl ScrollbarController {
// Overlay scrollbars are hidden until their scroller scrolls. A scrollbar stays shown for this long after its
// scroller last scrolled or the pointer left it, and then fades out.
@@ -254,14 +237,14 @@ impl ScrollbarController {
self.opacity(scrollbar_index) > 0.0
}
- // The main thread still takes the mouse events of a drag that holds a scrollbar the display list paints. The
- // context is the one this controller belongs to.
- pub fn captured_scrollbar_painted_by_display_list(
+ // The main thread still takes the mouse events of a drag that holds a scrollbar of an element, but none of a drag that
+ // holds a scrollbar of the viewport. The context is the one this controller belongs to.
+ pub fn captured_scrollbar_the_page_takes(
&self,
context_id: CompositorContextId,
) -> Option<ScrollbarDraggedByCompositor> {
let scrollbar = self.scrollbars.get(self.captured_scrollbar_index?)?;
- if scrollbar.is_painted_by_compositor || scrollbar.scroller_stable_node_id.is_none() {
+ if scrollbar.scrolls_viewport || scrollbar.scroller_stable_node_id.is_none() {
return None;
}
Some(ScrollbarDraggedByCompositor {
@@ -270,37 +253,10 @@ impl ScrollbarController {
})
}
- pub fn hit_test_scrollbar_painted_by_compositor(
- &self,
- async_scroll_tree: &AsyncScrollTree,
- scroll_state_snapshot: &ScrollStateSnapshot,
- position: FloatPoint,
- ) -> Option<usize> {
- for (i, scrollbar) in self.scrollbars.iter().enumerate() {
- if !scrollbar.is_painted_by_compositor {
- continue;
- }
- let Some(scroll_offset) =
- async_scroll_tree.scroll_offset_for_node(scrollbar.scroll_node_index, scroll_state_snapshot)
- else {
- continue;
- };
- if scrollbar_hit_rect(scrollbar, scroll_offset)
- .to_float()
- .contains_point(position)
- {
- return Some(i);
- }
- }
- None
- }
-
- // 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.
- // A scrollbar the display list paints takes the pointer where it is presented, unless something that takes pointer
- // input is painted over it there.
- pub fn hit_test_scrollbar_painted_by_display_list(
+ // A scrollbar 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.
+ pub fn hit_test_scrollbar(
&self,
async_scroll_tree: &AsyncScrollTree,
visual_context_tree: &AccumulatedVisualContextTree,
@@ -308,7 +264,7 @@ impl ScrollbarController {
position: FloatPoint,
) -> Option<usize> {
for (i, scrollbar) in self.scrollbars.iter().enumerate().rev() {
- if scrollbar.is_painted_by_compositor || scrollbar.scroller_stable_node_id.is_none() || !self.is_shown(i) {
+ if scrollbar.scroller_stable_node_id.is_none() || !self.is_shown(i) {
continue;
}
if async_scroll_tree
@@ -358,18 +314,9 @@ impl ScrollbarController {
scroll_state_snapshot: &ScrollStateSnapshot,
position: FloatPoint,
) -> Option<Drag> {
- let mut scrollbar_index =
- self.hit_test_scrollbar_painted_by_compositor(async_scroll_tree, scroll_state_snapshot, position);
- if scrollbar_index.is_none() {
- scrollbar_index = self.hit_test_scrollbar_painted_by_display_list(
- async_scroll_tree,
- visual_context_tree,
- scroll_state_snapshot,
- position,
- );
- }
+ let scrollbar_index =
+ self.hit_test_scrollbar(async_scroll_tree, visual_context_tree, scroll_state_snapshot, position)?;
// INTEROP: A scrollbar that has faded out takes no press, as in Chromium.
- let scrollbar_index = scrollbar_index?;
if self.opacity(scrollbar_index) <= 0.0 {
return None;
}
@@ -644,13 +591,11 @@ impl ScrollbarController {
false
}
- // Advances the fades to a frame. Answers None where no scrollbar changed, and otherwise the rect in the viewport of the
- // scrollbars the compositor paints that changed: the frame finds what changed of the others, which the display list
- // draws, in the content hashes of their records.
- pub fn advance_fades(&mut self, frame_time: MonotonicTime) -> Option<IntRect> {
+ // Advances the fades to a frame, and answers whether any scrollbar changed. The frame finds what changed in the
+ // content hashes of the records of the scrollbars.
+ pub fn advance_fades(&mut self, frame_time: MonotonicTime) -> bool {
let mut some_scrollbar_changed = false;
- let mut damage_rect = IntRect::default();
- for (scrollbar, visibility) in self.scrollbars.iter().zip(&mut self.visibilities) {
+ for visibility in &mut self.visibilities {
if visibility.fade_out_time.is_some_and(|time| time <= frame_time) {
visibility.fade_out_time = None;
visibility.fade.fade_to(0.0, frame_time);
@@ -662,31 +607,9 @@ impl ScrollbarController {
}
changed |= visibility.expansion.advance_to(frame_time);
some_scrollbar_changed |= changed;
- if changed && scrollbar.is_painted_by_compositor {
- damage_rect = damage_rect.united(rect_painted_by_compositor(scrollbar));
- }
}
- some_scrollbar_changed.then_some(damage_rect)
+ some_scrollbar_changed
}
-
- /// The rect in the viewport of the scrollbars the compositor paints, where they can draw as they grow.
- pub fn rect_of_scrollbars_painted_by_compositor(&self) -> IntRect {
- self.scrollbars
- .iter()
- .filter(|scrollbar| scrollbar.is_painted_by_compositor)
- .fold(IntRect::default(), |rect, scrollbar| {
- rect.united(rect_painted_by_compositor(scrollbar))
- })
- }
-}
-
-// Where the compositor paints a scrollbar of its own over the viewport, with the outline around its thumb.
-fn rect_painted_by_compositor(scrollbar: &AsyncScrollbar) -> IntRect {
- scrollbar
- .gutter_rect
- .united(scrollbar.track_rect)
- .united(scrollbar.expanded_gutter_rect)
- .inflated(2, 2)
}
fn interpolated_rect(from: IntRect, to: IntRect, progress: f32) -> FloatRect {
@@ -725,7 +648,6 @@ impl ScrollbarController {
scrollbars_of_frame.push(ScrollbarOfFrame {
scroll_node_index: scrollbar.scroll_node_index,
vertical: scrollbar.vertical,
- is_painted_by_compositor: scrollbar.is_painted_by_compositor,
gutter_rect: interpolated_rect(scrollbar.track_rect, scrollbar.expanded_gutter_rect, progress),
thumb_rect: interpolated_rect(thin_thumb_rect, expanded_thumb_rect, progress),
expansion: progress,
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 74a54b6490d..a438f101443 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: hovering-scrollbar-painted-by-display-list
+#1 compositor: hovering-element-scrollbar
#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 15562cfc7db..db5e82ed909 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: hovering-scrollbar-painted-by-display-list scroller=#scroller
+#1 compositor: hovering-element-scrollbar 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 444642d3882..dad76421ac7 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: hovering-scrollbar-painted-by-display-list scroller=#scroller
+#1 compositor: hovering-element-scrollbar scroller=#scroller
#1 compositor: forwarded-to-page
#1 web-content: finished-handled
#2 compositor: handed-to-nested-context