Trait webview2_sys::ICoreWebView2Controller3[][src]

pub trait ICoreWebView2Controller3: ICoreWebView2Controller2 {
    unsafe fn get_rasterization_scale(&self, scale: *mut f64) -> HRESULT;
unsafe fn put_rasterization_scale(&self, scale: f64) -> HRESULT;
unsafe fn get_should_detect_monitor_scale_changes(
        &self,
        value: *mut BOOL
    ) -> HRESULT;
unsafe fn put_should_detect_monitor_scale_changes(
        &self,
        value: BOOL
    ) -> HRESULT;
unsafe fn add_rasterization_scale_changed(
        &self,
        event_handler: *mut *mut ICoreWebView2RasterizationScaleChangedEventHandlerVTable,
        token: *mut EventRegistrationToken
    ) -> HRESULT;
unsafe fn remove_rasterization_scale_changed(
        &self,
        token: EventRegistrationToken
    ) -> HRESULT;
unsafe fn get_bounds_mode(&self, bounds_mode: *mut BoundsMode) -> HRESULT;
unsafe fn put_bounds_mode(&self, bounds_mode: BoundsMode) -> HRESULT; }
Expand description

A continuation of the ICoreWebView2Controller2 interface.

Required methods

The rasterization scale for the WebView. The rasterization scale is the combination of the monitor DPI scale and text scaling set by the user. This value should be updated when the DPI scale of the app’s top level window changes (i.e. monitor DPI scale changes or window changes monitor) or when the text scale factor of the system changes.

\snippet AppWindow.cpp DPIChanged

\snippet AppWindow.cpp TextScaleChanged1

\snippet AppWindow.cpp TextScaleChanged2

Rasterization scale applies to the WebView content, as well as popups, context menus, scroll bars, and so on. Normal app scaling scenarios should use the ZoomFactor property or SetBoundsAndZoomFactor API which only scale the rendered HTML content and not popups, context menus, scroll bars, and so on.

\snippet ViewComponent.cpp RasterizationScale

Set the rasterization scale property.

ShouldDetectMonitorScaleChanges property determines whether the WebView attempts to track monitor DPI scale changes. When true, the WebView will track monitor DPI scale changes, update the RasterizationScale property, and raises RasterizationScaleChanged event. When false, the WebView will not track monitor DPI scale changes, and the app must update the RasterizationScale property itself. RasterizationScaleChanged event will never raise when ShouldDetectMonitorScaleChanges is false.

Set the ShouldDetectMonitorScaleChanges property.

Add an event handler for the RasterizationScaleChanged event. The event is raised when the WebView detects that the monitor DPI scale has changed, ShouldDetectMonitorScaleChanges is true, and the WebView has changed the RasterizationScale property.

\snippet ViewComponent.cpp RasterizationScaleChanged

Remove an event handler previously added with add_RasterizationScaleChanged.

BoundsMode affects how setting the Bounds and RasterizationScale properties work. Bounds mode can either be in COREWEBVIEW2_BOUNDS_MODE_USE_RAW_PIXELS mode or COREWEBVIEW2_BOUNDS_MODE_USE_RASTERIZATION_SCALE mode.

When the mode is in COREWEBVIEW2_BOUNDS_MODE_USE_RAW_PIXELS, setting the bounds property will set the size of the WebView in raw screen pixels. Changing the rasterization scale in this mode won’t change the raw pixel size of the WebView and will only change the rasterization scale.

When the mode is in COREWEBVIEW2_BOUNDS_MODE_USE_RASTERIZATION_SCALE, setting the bounds property will change the logical size of the WebView which can be described by the following equation:

Logical size * rasterization scale = Raw Pixel size

In this case, changing the rasterization scale will keep the logical size the same and change the raw pixel size.

\snippet ViewComponent.cpp BoundsMode

Set the BoundsMode property.

Trait Implementations

A COM compatible V-Table

The interface that this interface inherits from

The associated id for this interface

Check whether a given IID is in the inheritance hierarchy of this interface

Get the vtable for a particular COM interface

Implementations on Foreign Types

Implementors