WebKit2GTK+ Reference Manual: WebKitHitTestResult

## WebKitHitTestResult WebKitHitTestResult — Result of a Hit Test |

## Synopsis

    struct              WebKitHitTestResult;
    enum                WebKitHitTestResultContext;
    guint               webkit_hit_test_result_get_context  (WebKitHitTestResult *hit_test_result);
    gboolean            webkit_hit_test_result_context_is_link
                                                            (WebKitHitTestResult *hit_test_result);
    gboolean            webkit_hit_test_result_context_is_image
                                                            (WebKitHitTestResult *hit_test_result);
    gboolean            webkit_hit_test_result_context_is_media
                                                            (WebKitHitTestResult *hit_test_result);
    gboolean            webkit_hit_test_result_context_is_editable
                                                            (WebKitHitTestResult *hit_test_result);
    const gchar *       webkit_hit_test_result_get_link_uri (WebKitHitTestResult *hit_test_result);
    const gchar *       webkit_hit_test_result_get_link_title
                                                            (WebKitHitTestResult *hit_test_result);
    const gchar *       webkit_hit_test_result_get_link_label
                                                            (WebKitHitTestResult *hit_test_result);
    const gchar *       webkit_hit_test_result_get_image_uri
                                                            (WebKitHitTestResult *hit_test_result);
    const gchar *       webkit_hit_test_result_get_media_uri
                                                            (WebKitHitTestResult *hit_test_result);
    gboolean            webkit_hit_test_result_context_is_scrollbar
                                                            (WebKitHitTestResult *hit_test_result);

## Object Hierarchy

      GObject
       +----WebKitHitTestResult

## Properties

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

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

## Details

### struct WebKitHitTestResult

    struct WebKitHitTestResult;

### enum WebKitHitTestResultContext

    typedef enum {
        WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT  = 1 << 1,
        WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK      = 1 << 2,
        WEBKIT_HIT_TEST_RESULT_CONTEXT_IMAGE     = 1 << 3,
        WEBKIT_HIT_TEST_RESULT_CONTEXT_MEDIA     = 1 << 4,
        WEBKIT_HIT_TEST_RESULT_CONTEXT_EDITABLE  = 1 << 5,
        WEBKIT_HIT_TEST_RESULT_CONTEXT_SCROLLBAR = 1 << 6
    } WebKitHitTestResultContext;

Enum values with flags representing the context of a WebKitHitTestResult.

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

### webkit_hit_test_result_get_context ()

    guint               webkit_hit_test_result_get_context  (WebKitHitTestResult *hit_test_result);

Gets the value of the "context" property.

`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".

`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".

`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".

`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".

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

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

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

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

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

`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".

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

## Property Details

### The `"context"` property

      "context"                  guint                 : Read / Write / Construct Only

Bitmask of WebKitHitTestResultContext flags representing the context of the WebKitHitTestResult.

Default value: 0

### The `"image-uri"` property

      "image-uri"                gchar*                : Read / Write / Construct Only

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

Default value: NULL

### The `"link-label"` property

      "link-label"               gchar*                : Read / Write / Construct Only

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

Default value: NULL

### The `"link-title"` property

      "link-title"               gchar*                : Read / Write / Construct Only

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

Default value: NULL

### The `"link-uri"` property

      "link-uri"                 gchar*                : Read / Write / Construct Only

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

Default value: NULL

### The `"media-uri"` property

      "media-uri"                gchar*                : Read / Write / Construct Only

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

Default value: NULL

## See Also

WebKitWebView