WebKit2GTK+ Reference Manual: WebKitHitTestResult

## WebKitHitTestResult WebKitHitTestResult — Result of a Hit Test |

## Functions

guint | webkit_hit_test_result_get_context ()
gboolean | webkit_hit_test_result_context_is_link ()
gboolean | webkit_hit_test_result_context_is_image ()
gboolean | webkit_hit_test_result_context_is_media ()
gboolean | webkit_hit_test_result_context_is_editable ()
const gchar * | webkit_hit_test_result_get_link_uri ()
const gchar * | webkit_hit_test_result_get_link_title ()
const gchar * | webkit_hit_test_result_get_link_label ()
const gchar * | webkit_hit_test_result_get_image_uri ()
const gchar * | webkit_hit_test_result_get_media_uri ()
gboolean | webkit_hit_test_result_context_is_scrollbar ()

## Properties

guint | context | Read / Write / Construct Only
gchar * | image-uri | Read / Write / Construct Only
gchar * | link-label | Read / Write / Construct Only
gchar * | link-title | Read / Write / Construct Only
gchar * | link-uri | Read / Write / Construct Only
gchar * | media-uri | Read / Write / Construct Only

## Types and Values

struct | WebKitHitTestResult
enum | WebKitHitTestResultContext

## Object Hierarchy

        GObject
        ╰── WebKitHitTestResult

## Description

A Hit Test is an operation to get context information about a given point in a WebKitWebView. WebKitHitTestResult 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 `webkit_hit_test_result_get_context()` that returns a bitmask of WebKitHitTestResultContext flags. You can also use `webkit_hit_test_result_context_is_link()`, `webkit_hit_test_result_context_is_image()` and `webkit_hit_test_result_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 “mouse-target-changed” signal is emitted with a WebKitHitTestResult.

## Functions

### webkit_hit_test_result_get_context ()

    guint
    webkit_hit_test_result_get_context (WebKitHitTestResult *hit_test_result);

Gets the value of the “context” property.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

a bitmask of WebKitHitTestResultContext flags

### webkit_hit_test_result_context_is_link ()

    gboolean
    webkit_hit_test_result_context_is_link
                                   (WebKitHitTestResult *hit_test_result);

Gets whether `WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK` flag is present in “context”.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

`TRUE` if there's a link element in the coordinates of the Hit Test, or `FALSE` otherwise

### webkit_hit_test_result_context_is_image ()

    gboolean
    webkit_hit_test_result_context_is_image
                                   (WebKitHitTestResult *hit_test_result);

Gets whether `WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE` flag is present in “context”.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

`TRUE` if there's an image element in the coordinates of the Hit Test, or `FALSE` otherwise

### webkit_hit_test_result_context_is_media ()

    gboolean
    webkit_hit_test_result_context_is_media
                                   (WebKitHitTestResult *hit_test_result);

Gets whether `WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA` flag is present in “context”.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

`TRUE` if there's a media element in the coordinates of the Hit Test, or `FALSE` otherwise

### webkit_hit_test_result_context_is_editable ()

    gboolean
    webkit_hit_test_result_context_is_editable
                                   (WebKitHitTestResult *hit_test_result);

Gets whether `WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE` flag is present in “context”.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

`TRUE` if there's an editable element at the coordinates of the `hit_test_result` , or `FALSE` otherwise

### webkit_hit_test_result_get_link_uri ()

    const gchar *
    webkit_hit_test_result_get_link_uri (WebKitHitTestResult *hit_test_result);

Gets the value of the “link-uri” property.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

the URI of the link element in the coordinates of the Hit Test, or `NULL` if there ins't a link element in `hit_test_result` context

### webkit_hit_test_result_get_link_title ()

    const gchar *
    webkit_hit_test_result_get_link_title (WebKitHitTestResult *hit_test_result);

Gets the value of the “link-title” property.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

the title of the link element in the coordinates of the Hit Test, or `NULL` if there ins't a link element in `hit_test_result` context or the link element doesn't have a title

### webkit_hit_test_result_get_link_label ()

    const gchar *
    webkit_hit_test_result_get_link_label (WebKitHitTestResult *hit_test_result);

Gets the value of the “link-label” property.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

the label of the link element in the coordinates of the Hit Test, or `NULL` if there ins't a link element in `hit_test_result` context or the link element doesn't have a label

### webkit_hit_test_result_get_image_uri ()

    const gchar *
    webkit_hit_test_result_get_image_uri (WebKitHitTestResult *hit_test_result);

Gets the value of the “image-uri” property.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

the URI of the image element in the coordinates of the Hit Test, or `NULL` if there ins't an image element in `hit_test_result` context

### webkit_hit_test_result_get_media_uri ()

    const gchar *
    webkit_hit_test_result_get_media_uri (WebKitHitTestResult *hit_test_result);

Gets the value of the “media-uri” property.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

the URI of the media element in the coordinates of the Hit Test, or `NULL` if there ins't a media element in `hit_test_result` context

### webkit_hit_test_result_context_is_scrollbar ()

    gboolean
    webkit_hit_test_result_context_is_scrollbar
                                   (WebKitHitTestResult *hit_test_result);

Gets whether `WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR` flag is present in “context”.

#### Parameters

hit_test_result | a WebKitHitTestResult |

#### Returns

`TRUE` if there's a scrollbar element at the coordinates of the `hit_test_result` , or `FALSE` otherwise

## Types and Values

### struct WebKitHitTestResult

    struct WebKitHitTestResult;

### enum WebKitHitTestResultContext

Enum values with flags representing the context of a WebKitHitTestResult.

#### Members

WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT | anywhere in the document. |
WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK | a hyperlink element. |
WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE | an image element. |
WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA | a video or audio element. |
WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE | an editable element |
WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR | a scrollbar element. |

## Property Details

### The `“context”` property

      “context”                  guint

Bitmask of WebKitHitTestResultContext flags representing the context of the WebKitHitTestResult.

Flags: Read / Write / Construct Only

Default value: 0

### The `“image-uri”` property

      “image-uri”                gchar *

The URI of the image if flag `WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE` is present in “context”

Flags: Read / Write / Construct Only

Default value: NULL

### The `“link-label”` property

      “link-label”               gchar *

The label of the link if flag `WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK` is present in “context”

Flags: Read / Write / Construct Only

Default value: NULL

### The `“link-title”` property

      “link-title”               gchar *

The title of the link if flag `WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK` is present in “context”

Flags: Read / Write / Construct Only

Default value: NULL

### The `“link-uri”` property

      “link-uri”                 gchar *

The URI of the link if flag `WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK` is present in “context”

Flags: Read / Write / Construct Only

Default value: NULL

### The `“media-uri”` property

      “media-uri”                gchar *

The URI of the media if flag `WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA` is present in “context”

Flags: Read / Write / Construct Only

Default value: NULL

## See Also

WebKitWebView