Struct WebViewRenderer

Source
pub(crate) struct WebViewRenderer {
Show 13 fields pub id: WebViewId, pub webview: Box<dyn WebViewTrait>, pub root_pipeline_id: Option<PipelineId>, pub rect: DeviceRect, pub pipelines: HashMap<PipelineId, PipelineDetails>, pub(crate) global: Rc<RefCell<ServoRenderer>>, pending_scroll_zoom_events: Vec<ScrollZoomEvent>, touch_handler: TouchHandler, pub page_zoom: Scale<f32, CSSPixel, DeviceIndependentPixel>, pinch_zoom: PinchZoomFactor, hidpi_scale_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>, animating: bool, viewport_description: Option<ViewportDescription>,
}
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: WebViewId

The 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: DeviceRect

The rectangle of the [WebView] in device pixels, which is the viewport.

§pipelines: HashMap<PipelineId, PipelineDetails>

Tracks details about each active pipeline that the compositor knows about.

§global: Rc<RefCell<ServoRenderer>>

Data that is shared by all WebView renderers.

§pending_scroll_zoom_events: Vec<ScrollZoomEvent>

Pending scroll/zoom events.

§touch_handler: TouchHandler

Touch input state machine

§page_zoom: Scale<f32, CSSPixel, DeviceIndependentPixel>

“Desktop-style” zoom that resizes the viewport to fit the window.

§pinch_zoom: PinchZoomFactor

“Mobile-style” zoom that does not reflow the page.

§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: bool

Whether 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.

Implementations§

Source§

impl WebViewRenderer

Source

pub(crate) fn new( global: Rc<RefCell<ServoRenderer>>, renderer_webview: Box<dyn WebViewTrait>, viewport_details: ViewportDetails, ) -> Self

Source

pub(crate) fn animation_callbacks_running(&self) -> bool

Source

pub(crate) fn pipeline_ids(&self) -> Keys<'_, PipelineId, PipelineDetails>

Source

pub(crate) fn animating(&self) -> bool

Source

pub(crate) fn ensure_pipeline_details( &mut self, pipeline_id: PipelineId, ) -> &mut PipelineDetails

Returns the PipelineDetails for the given PipelineId, creating it if needed.

Source

pub(crate) fn pipeline_exited( &mut self, pipeline_id: PipelineId, source: PipelineExitSource, )

Source

pub(crate) fn set_frame_tree(&mut self, frame_tree: &SendableFrameTree)

Source

pub(crate) fn send_scroll_positions_to_layout_for_pipeline( &self, pipeline_id: PipelineId, )

Source

pub(crate) fn set_frame_tree_on_pipeline_details( &mut self, frame_tree: &SendableFrameTree, parent_pipeline_id: Option<PipelineId>, )

Source

pub(crate) fn reset_scroll_tree_for_unattached_pipelines( &mut self, frame_tree: &SendableFrameTree, )

Source

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.

Source

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.

Source

fn update_animation_state(&mut self)

Source

pub(crate) fn on_vsync(&mut self)

On a Window refresh tick (e.g. vsync)

Source

pub(crate) fn dispatch_input_event_with_hit_testing( &self, event: InputEvent, ) -> bool

Source

pub(crate) fn notify_input_event(&mut self, event: InputEvent)

Source

fn send_touch_event(&mut self, event: TouchEvent) -> bool

Source

pub(crate) fn on_touch_event(&mut self, event: TouchEvent)

Source

fn on_touch_down(&mut self, event: TouchEvent)

Source

fn on_touch_move(&mut self, event: TouchEvent)

Source

fn on_touch_up(&mut self, event: TouchEvent)

Source

fn on_touch_cancel(&mut self, event: TouchEvent)

Source

pub(crate) fn on_touch_event_processed(&mut self, result: TouchEventResult)

Source

fn simulate_mouse_click(&mut self, point: DevicePoint)

Source

pub(crate) fn notify_scroll_event( &mut self, scroll_location: ScrollLocation, cursor: DeviceIntPoint, )

Source

fn on_scroll_window_event( &mut self, scroll_location: ScrollLocation, cursor: DeviceIntPoint, )

Source

pub(crate) fn process_pending_scroll_and_pinch_zoom_events( &mut self, ) -> (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 ScrollResult if a scroll occurred.

It is up to the caller to ensure that these events update the rendering appropriately.

Source

fn scroll_node_at_device_point( &mut self, cursor: DevicePoint, scroll_location: ScrollLocation, ) -> Option<ScrollResult>

Perform a hit test at the given DevicePoint and apply the ScrollLocation 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.

Source

fn dispatch_scroll_event( &self, external_id: ExternalScrollId, hit_test_result: CompositorHitTestResult, )

Source

pub(crate) fn pinch_zoom_level(&self) -> Scale<f32, DevicePixel, DevicePixel>

Source

fn set_pinch_zoom_level(&mut self, zoom: f32) -> bool

Source

pub(crate) fn page_zoom( &mut self, ) -> Scale<f32, CSSPixel, DeviceIndependentPixel>

Source

pub(crate) fn set_page_zoom( &mut self, new_page_zoom: Scale<f32, CSSPixel, DeviceIndependentPixel>, )

Source

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.

Source

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.

Source

pub(crate) fn set_pinch_zoom(&mut self, magnification: f32)

Simulate a pinch zoom

Source

fn send_window_size_message(&self)

Source

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.

Source

pub(crate) fn set_rect(&mut self, new_rect: DeviceRect) -> bool

Set the rect for this renderer, returning true if the value actually changed.

Source

pub fn set_viewport_description( &mut self, viewport_description: ViewportDescription, )

Source

pub(crate) fn scroll_trees_memory_usage( &self, ops: &mut MallocSizeOfOps, ) -> usize

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T