pub(crate) struct WebViewRenderer {Show 15 fields
pub id: WebViewId,
pub webview: Box<dyn WebViewTrait>,
pub root_pipeline_id: Option<PipelineId>,
pub rect: DeviceRect,
pub pipelines: FxHashMap<PipelineId, PipelineDetails>,
pending_scroll_zoom_events: Vec<ScrollZoomEvent>,
touch_handler: TouchHandler,
pub page_zoom: Scale<f32, CSSPixel, DeviceIndependentPixel>,
pinch_zoom: PinchZoom,
hidpi_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>,
animating: bool,
viewport_description: Option<ViewportDescription>,
embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>,
refresh_driver: Rc<BaseRefreshDriver>,
webrender_document: DocumentId,
}Expand description
A renderer for a libservo WebView. This is essentially the [ServoRenderer]’s interface to a
libservo WebView, but the code here cannot depend on libservo in order to prevent circular
dependencies, which is why we store a dyn WebViewTrait here instead of the WebView itself.
Fields§
§id: WebViewIdThe WebViewId of the WebView associated with this [WebViewDetails].
webview: Box<dyn WebViewTrait>The renderer’s view of the embedding layer WebView as a trait implementation,
so that the renderer doesn’t need to depend on the embedding layer. This avoids
a dependency cycle.
root_pipeline_id: Option<PipelineId>The root PipelineId of the currently displayed page in this WebView.
rect: DeviceRectThe rectangle of the [WebView] in device pixels, which is the viewport.
pipelines: FxHashMap<PipelineId, PipelineDetails>Tracks details about each active pipeline that the compositor knows about.
pending_scroll_zoom_events: Vec<ScrollZoomEvent>Pending scroll/zoom events.
touch_handler: TouchHandlerTouch input state machine
page_zoom: Scale<f32, CSSPixel, DeviceIndependentPixel>“Desktop-style” zoom that resizes the viewport to fit the window.
pinch_zoom: PinchZoom“Mobile-style” zoom that does not reflow the page. When there is no PinchZoom a
zoom factor of 1.0 is implied and the PinchZoom::transform will be the identity.
hidpi_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>The HiDPI scale factor for the WebView associated with this renderer. This is controlled
by the embedding layer.
animating: boolWhether or not this WebViewRenderer isn’t throttled and has a pipeline with
active animations or animation frame callbacks.
viewport_description: Option<ViewportDescription>A ViewportDescription for this WebViewRenderer, which contains the limitations
and initial values for zoom derived from the viewport meta tag in web content.
embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>The channel on which messages can be sent to the constellation.
refresh_driver: Rc<BaseRefreshDriver>The BaseRefreshDriver which manages the painting of WebViews during animations.
webrender_document: DocumentIdThe active webrender document.
Implementations§
Source§impl WebViewRenderer
impl WebViewRenderer
pub(crate) fn new( renderer_webview: Box<dyn WebViewTrait>, viewport_details: ViewportDetails, embedder_to_constellation_sender: Sender<EmbedderToConstellationMessage>, refresh_driver: Rc<BaseRefreshDriver>, webrender_document: DocumentId, ) -> Self
fn hit_test( &self, webrender_api: &RenderApi, point: DevicePoint, ) -> Vec<CompositorHitTestResult>
pub(crate) fn animation_callbacks_running(&self) -> bool
pub(crate) fn animating(&self) -> bool
Sourcepub(crate) fn ensure_pipeline_details(
&mut self,
pipeline_id: PipelineId,
) -> &mut PipelineDetails
pub(crate) fn ensure_pipeline_details( &mut self, pipeline_id: PipelineId, ) -> &mut PipelineDetails
Returns the PipelineDetails for the given PipelineId, creating it if needed.
pub(crate) fn pipeline_exited( &mut self, pipeline_id: PipelineId, source: PipelineExitSource, )
pub(crate) fn set_frame_tree(&mut self, frame_tree: &SendableFrameTree)
pub(crate) fn send_scroll_positions_to_layout_for_pipeline( &self, pipeline_id: PipelineId, )
pub(crate) fn set_frame_tree_on_pipeline_details( &mut self, frame_tree: &SendableFrameTree, parent_pipeline_id: Option<PipelineId>, )
Sourcepub(crate) fn change_pipeline_running_animations_state(
&mut self,
pipeline_id: PipelineId,
animation_state: AnimationState,
) -> bool
pub(crate) fn change_pipeline_running_animations_state( &mut self, pipeline_id: PipelineId, animation_state: AnimationState, ) -> bool
Sets or unsets the animations-running flag for the given pipeline. Returns true if the pipeline has started animating.
Sourcepub(crate) fn set_throttled(
&mut self,
pipeline_id: PipelineId,
throttled: bool,
) -> bool
pub(crate) fn set_throttled( &mut self, pipeline_id: PipelineId, throttled: bool, ) -> bool
Sets or unsets the throttled flag for the given pipeline. Returns true if the pipeline has started animating.
fn update_animation_state(&mut self)
pub(crate) fn update_touch_handling_at_new_frame_start(&mut self) -> bool
fn dispatch_input_event_with_hit_testing( &mut self, render_api: &RenderApi, event: InputEventAndId, ) -> bool
pub(crate) fn notify_input_event( &mut self, render_api: &RenderApi, event_and_id: InputEventAndId, )
fn on_wheel_event( &mut self, render_api: &RenderApi, wheel_event: WheelEvent, event_and_id: InputEventAndId, )
fn send_touch_event( &mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId, ) -> bool
pub(crate) fn on_touch_event( &mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId, )
fn on_touch_down( &mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId, )
fn on_touch_move( &mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId, )
fn on_touch_up( &mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId, )
fn on_touch_cancel( &mut self, render_api: &RenderApi, event: TouchEvent, id: InputEventId, )
fn on_touch_event_processed( &mut self, render_api: &RenderApi, pending_touch_input_event: PendingTouchInputEvent, result: InputEventResult, )
fn add_touch_move_refresh_obsever(&self)
Sourcefn simulate_mouse_click(&mut self, render_api: &RenderApi, point: DevicePoint)
fn simulate_mouse_click(&mut self, render_api: &RenderApi, point: DevicePoint)
pub(crate) fn notify_scroll_event( &mut self, scroll: Scroll, point: WebViewPoint, )
fn on_scroll_window_event(&mut self, scroll: Scroll, cursor: DevicePoint)
Sourcepub(crate) fn process_pending_scroll_and_pinch_zoom_events(
&mut self,
render_api: &RenderApi,
) -> (PinchZoomResult, Option<ScrollResult>)
pub(crate) fn process_pending_scroll_and_pinch_zoom_events( &mut self, render_api: &RenderApi, ) -> (PinchZoomResult, Option<ScrollResult>)
Process pending scroll events for this WebViewRenderer. Returns a tuple containing:
- A boolean that is true if a zoom occurred.
- An optional
ScrollResultif a scroll occurred.
It is up to the caller to ensure that these events update the rendering appropriately.
Sourcefn scroll_node_at_device_point(
&mut self,
render_api: &RenderApi,
cursor: DevicePoint,
scroll: Scroll,
) -> Option<ScrollResult>
fn scroll_node_at_device_point( &mut self, render_api: &RenderApi, cursor: DevicePoint, scroll: Scroll, ) -> Option<ScrollResult>
Perform a hit test at the given DevicePoint and apply the Scroll
scrolling to the applicable scroll node under that point. If a scroll was
performed, returns the hit test result contains PipelineId of the node
scrolled, the id, and the final scroll delta.
Sourcepub(crate) fn scroll_viewport_by_delta(
&mut self,
delta: LayoutVector2D,
) -> (PinchZoomResult, Vec<ScrollResult>)
pub(crate) fn scroll_viewport_by_delta( &mut self, delta: LayoutVector2D, ) -> (PinchZoomResult, Vec<ScrollResult>)
Scroll the viewport (root pipeline, root scroll node) of this WebView, but first attempting to pan the pinch zoom viewport. This is called when processing key-based scrolling from script.
fn dispatch_scroll_event( &self, external_id: ExternalScrollId, hit_test_result: CompositorHitTestResult, )
pub(crate) fn pinch_zoom(&self) -> PinchZoom
fn set_pinch_zoom(&mut self, requested_pinch_zoom: PinchZoom) -> PinchZoomResult
pub(crate) fn set_page_zoom( &mut self, new_page_zoom: Scale<f32, CSSPixel, DeviceIndependentPixel>, )
Sourcepub(crate) fn device_pixels_per_page_pixel(
&self,
) -> Scale<f32, CSSPixel, DevicePixel>
pub(crate) fn device_pixels_per_page_pixel( &self, ) -> Scale<f32, CSSPixel, DevicePixel>
The scale to use when displaying this WebViewRenderer in WebRender
including both viewport scale (page zoom and hidpi scale) as well as any
pinch zoom applied. This is based on the latest display list received,
as page zoom changes are applied asynchronously and the rendered view
should reflect the latest display list.
Sourcepub(crate) fn device_pixels_per_page_pixel_not_including_pinch_zoom(
&self,
) -> Scale<f32, CSSPixel, DevicePixel>
pub(crate) fn device_pixels_per_page_pixel_not_including_pinch_zoom( &self, ) -> Scale<f32, CSSPixel, DevicePixel>
The current viewport scale (hidpi scale and page zoom and not pinch zoom) based on the current setting of the WebView. Note that this may not be the rendered viewport zoom as that is based on the latest display list and zoom changes are applied asynchronously.
Sourcepub(crate) fn adjust_pinch_zoom(
&mut self,
magnification: f32,
center: DevicePoint,
)
pub(crate) fn adjust_pinch_zoom( &mut self, magnification: f32, center: DevicePoint, )
Adjust the pinch zoom of the [WebView] by the given zoom delta.
fn send_window_size_message(&self)
Sourcepub(crate) fn set_hidpi_scale_factor(
&mut self,
new_scale: Scale<f32, DeviceIndependentPixel, DevicePixel>,
) -> bool
pub(crate) fn set_hidpi_scale_factor( &mut self, new_scale: Scale<f32, DeviceIndependentPixel, DevicePixel>, ) -> bool
Set the hidpi_scale_factor for this renderer, returning true if the value actually changed.
Sourcepub(crate) fn set_rect(&mut self, new_rect: DeviceRect) -> bool
pub(crate) fn set_rect(&mut self, new_rect: DeviceRect) -> bool
Set the rect for this renderer, returning true if the value actually changed.
pub fn set_viewport_description( &mut self, viewport_description: ViewportDescription, )
pub(crate) fn scroll_trees_memory_usage( &self, ops: &mut MallocSizeOfOps, ) -> usize
pub(crate) fn notify_input_event_handled( &mut self, render_api: &RenderApi, id: InputEventId, result: InputEventResult, )
Auto Trait Implementations§
impl !Freeze for WebViewRenderer
impl !RefUnwindSafe for WebViewRenderer
impl !Send for WebViewRenderer
impl !Sync for WebViewRenderer
impl Unpin for WebViewRenderer
impl !UnwindSafe for WebViewRenderer
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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