HitTestResult

class HitTestResult(**properties: Any)

Superclasses: Object

Result of a Hit Test.

A Hit Test is an operation to get context information about a given point in a WebKitWebView. HitTestResult represents the result of a Hit Test. It provides context information about what is at the coordinates of the Hit Test, such as if there’s a link, an image or a media.

You can get the context of the HitTestResult with get_context() that returns a bitmask of WebKitHitTestResultContext flags. You can also use context_is_link(), context_is_image() and context_is_media() to determine whether there’s a link, image or a media element at the coordinates of the Hit Test. Note that it’s possible that several WebKitHitTestResultContext flags are active at the same time, for example if there’s a link containing an image.

When the mouse is moved over a WebKitWebView a Hit Test is performed for the mouse coordinates and WebKitWebView::mouse-target-changed signal is emitted with a HitTestResult.

Methods

class HitTestResult
context_is_editable() bool

Gets whether EDITABLE flag is present in HitTestResult:context.

context_is_image() bool

Gets whether IMAGE flag is present in HitTestResult:context.

Gets whether LINK flag is present in HitTestResult:context.

context_is_media() bool

Gets whether MEDIA flag is present in HitTestResult:context.

context_is_scrollbar() bool

Gets whether SCROLLBAR flag is present in HitTestResult:context.

context_is_selection() bool

Gets whether SELECTION flag is present in HitTestResult:context.

Added in version 2.8.

get_context() int

Gets the value of the HitTestResult:context property.

get_image_uri() str

Gets the value of the HitTestResult:image-uri property.

Gets the value of the HitTestResult:link-label property.

Gets the value of the HitTestResult:link-title property.

Gets the value of the HitTestResult:link-uri property.

get_media_uri() str

Gets the value of the HitTestResult:media-uri property.

Properties

class HitTestResult
props.context: int

Bitmask of WebKitHitTestResultContext flags representing the context of the HitTestResult.

props.image_uri: str

The URI of the image if flag IMAGE is present in HitTestResult:context

The label of the link if flag LINK is present in HitTestResult:context

The title of the link if flag LINK is present in HitTestResult:context

The URI of the link if flag LINK is present in HitTestResult:context

props.media_uri: str

The URI of the media if flag MEDIA is present in HitTestResult:context