DisplayFeaturesProvider Class

The display features of the screen of the device (https://drafts.csswg.org/css-viewport/#display-feature-override), of the browsing contexts that share a BrowsingContextOptions (ViewportSegmentsOptions.Provider). Set DisplayFeaturesProvider.DisplayFeatures to simulate a foldable device: the documents evaluate their media queries again and compute their styles again.

public class DisplayFeaturesProvider

Remarks

A provider can be shared by several browsing contexts, and used from any thread.

Constructors

NameDescription
DisplayFeaturesProvider()

DisplayFeaturesProvider()

ViewportSegments.cs
public DisplayFeaturesProvider()

No documentation is available.

Properties

NameDescription
DisplayFeaturesGets or sets the display features of the screen (empty by default: the viewport has a single segment). The offsets are relative to the viewport of the top-level documents. Setting it updates the documents.

DisplayFeatures

ViewportSegments.cs

Gets or sets the display features of the screen (empty by default: the viewport has a single segment). The offsets are relative to the viewport of the top-level documents. Setting it updates the documents.

public IReadOnlyList<DisplayFeature> DisplayFeatures { get; set; }

Property value

IReadOnlyList<DisplayFeature>

Exceptions

ArgumentException
An offset or a mask length is negative or not finite.

Methods

NameDescription
GetDisplayFeatures()Returns the display features of the screen. The default implementation returns DisplayFeaturesProvider.DisplayFeatures. It is called on the thread of an event loop, and must not block it.
OnDisplayFeaturesChanged()Raises DisplayFeaturesProvider.DisplayFeaturesChanged, then updates the documents: their media queries are evaluated again (change events of the MediaQueryList objects) and their styles are computed again. It can be called from any thread.

GetDisplayFeatures()

ViewportSegments.cs

Returns the display features of the screen. The default implementation returns DisplayFeaturesProvider.DisplayFeatures. It is called on the thread of an event loop, and must not block it.

public virtual IReadOnlyList<DisplayFeature> GetDisplayFeatures()

OnDisplayFeaturesChanged()

ViewportSegments.cs

Raises DisplayFeaturesProvider.DisplayFeaturesChanged, then updates the documents: their media queries are evaluated again (change events of the MediaQueryList objects) and their styles are computed again. It can be called from any thread.

protected void OnDisplayFeaturesChanged()

Events

NameDescription
DisplayFeaturesChangedRaised when the display features change (DisplayFeaturesProvider.OnDisplayFeaturesChanged).

DisplayFeaturesChanged

Raised when the display features change (DisplayFeaturesProvider.OnDisplayFeaturesChanged).

public event EventHandler? DisplayFeaturesChanged