pub struct Compositor { /* private fields */ }Expand description
Receives committed frames from the view thread and produces
CompositorFrame for the GPU.
Owns a copy of the scroll tree + offsets so it can handle wheel events at vsync rate without waiting for the view thread.
Implementations§
Source§impl Compositor
impl Compositor
pub fn new() -> Self
Sourcepub fn commit(
&mut self,
display_list: Arc<DisplayList>,
layer_tree: LayerTree,
scroll_tree: ScrollTree,
)
pub fn commit( &mut self, display_list: Arc<DisplayList>, layer_tree: LayerTree, scroll_tree: ScrollTree, )
Accept a committed frame from the view thread.
Chrome: LayerTreeHostImpl::FinishCommit().
Updates the display list, layer tree, and scroll tree topology.
Scroll offsets are not accepted — the compositor owns them
exclusively and syncs them to the view thread via ScrollSync.
Sourcepub fn try_scroll(&mut self, target: u32, delta: Offset) -> bool
pub fn try_scroll(&mut self, target: u32, delta: Offset) -> bool
Handle a scroll event directly — no view thread round-trip.
Chrome: InputHandlerProxy::RouteToTypeSpecificHandler().
Sourcepub fn produce_frame(&self) -> Option<CompositorFrame>
pub fn produce_frame(&self) -> Option<CompositorFrame>
Produce a frame for the GPU.
The scroll offsets are passed directly — the renderer uses them to override tagged scroll transforms. Zero allocation, O(1) lookup.
Sourcepub fn scroll_offsets(&self) -> &ScrollOffsets
pub fn scroll_offsets(&self) -> &ScrollOffsets
Current scroll offsets — for syncing back to the view thread.
pub fn scroll_tree(&self) -> &ScrollTree
pub fn has_content(&self) -> bool
Sourcepub fn hit_test_scroll_target(&self, point: Point) -> Option<u32>
pub fn hit_test_scroll_target(&self, point: Point) -> Option<u32>
Find the deepest scrollable layer at a screen point.
Chrome: InputHandler::HitTestScrollNode() — compositor-side hit test
against the layer tree to determine which scrollable container should
receive the scroll delta. Returns the DOM node ID of the scroll target.
Walks the layer tree depth-first, checking bounds. Returns the deepest
scrollable layer whose bounds contain the point. Falls back to
root_scroller() if no scrollable layer is hit.
Auto Trait Implementations§
impl Freeze for Compositor
impl !RefUnwindSafe for Compositor
impl Send for Compositor
impl Sync for Compositor
impl Unpin for Compositor
impl UnsafeUnpin for Compositor
impl !UnwindSafe for Compositor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more