WebKitWebFrame

WebKitWebFrame — The content of a WebKitWebView

Synopsis

enum                WebKitLoadStatus;
                    WebKitWebFrame;
GType               webkit_web_frame_get_type           (void);
const gchar *       webkit_web_frame_get_name           (WebKitWebFrame *frame);
const gchar *       webkit_web_frame_get_title          (WebKitWebFrame *frame);
const gchar *       webkit_web_frame_get_uri            (WebKitWebFrame *frame);
WebKitWebPage *     webkit_web_frame_get_page           (WebKitWebFrame *Param1);
WebKitWebFrame *    webkit_web_frame_get_parent         (WebKitWebFrame *frame);
void                webkit_web_frame_load_uri           (WebKitWebFrame *frame,
                                                         const gchar *uri);
void                webkit_web_frame_load_string        (WebKitWebFrame *frame,
                                                         const gchar *content,
                                                         const gchar *mime_type,
                                                         const gchar *encoding,
                                                         const gchar *base_uri);
void                webkit_web_frame_load_alternate_string
                                                        (WebKitWebFrame *frame,
                                                         const gchar *content,
                                                         const gchar *base_url,
                                                         const gchar *unreachable_url);
void                webkit_web_frame_load_request       (WebKitWebFrame *frame,
                                                         WebKitNetworkRequest *request);
void                webkit_web_frame_stop_loading       (WebKitWebFrame *frame);
void                webkit_web_frame_reload             (WebKitWebFrame *frame);
WebKitWebFrame *    webkit_web_frame_find_frame         (WebKitWebFrame *frame,
                                                         const gchar *name);
JSGlobalContextRef  webkit_web_frame_get_global_context (WebKitWebFrame *frame);
void                webkit_web_frame_print              (WebKitWebFrame *frame);
WebKitLoadStatus    webkit_web_frame_get_load_status    (WebKitWebFrame *frame);
WebKitWebDataSource * webkit_web_frame_get_data_source  (WebKitWebFrame *frame);
WebKitWebDataSource * webkit_web_frame_get_provisional_data_source
                                                        (WebKitWebFrame *frame);
WebKitSecurityOrigin * webkit_web_frame_get_security_origin
                                                        (WebKitWebFrame *frame);
WebKitNetworkResponse * webkit_web_frame_get_network_response
                                                        (WebKitWebFrame *frame);
gboolean            webkit_web_frame_get_contents_size  (WebKitWebFrame *webFrame,
                                                         int *width,
                                                         int *height);
int                 webkit_web_frame_get_contents_width (WebKitWebFrame *webFrame);
int                 webkit_web_frame_get_contents_height
                                                        (WebKitWebFrame *webFrame);
gboolean            webkit_web_frame_get_scroll_offset  (WebKitWebFrame *webFrame,
                                                         int *x,
                                                         int *y);
int                 webkit_web_frame_get_x_scroll_offset
                                                        (WebKitWebFrame *webFrame);
int                 webkit_web_frame_get_y_scroll_offset
                                                        (WebKitWebFrame *webFrame);
void                webkit_web_frame_set_scroll_offset  (WebKitWebFrame *webFrame,
                                                         int x,
                                                         int y);
void                webkit_web_frame_set_x_scroll_offset
                                                        (WebKitWebFrame *webFrame,
                                                         int offset);
void                webkit_web_frame_set_y_scroll_offset
                                                        (WebKitWebFrame *webFrame,
                                                         int offset);
void                webkit_web_frame_scroll             (WebKitWebFrame *webFrame,
                                                         int x,
                                                         int y);
void                webkit_web_frame_render             (WebKitWebFrame *webFrame,
                                                         cairo_t *cr,
                                                         gint x_offset,
                                                         gint y_offset,
                                                         gint width,
                                                         gint height);
gfloat              webkit_web_frame_get_zoom_level     (WebKitWebFrame *webFrame);
void                webkit_web_frame_set_zoom_level     (WebKitWebFrame *webFrame,
                                                         gfloat zoomLevel);
void                webkit_web_frame_zoom_in            (WebKitWebFrame *webFrame);
void                webkit_web_frame_zoom_out           (WebKitWebFrame *webFrame);
gfloat              webkit_web_frame_get_text_zoom_level
                                                        (WebKitWebFrame *webFrame);
void                webkit_web_frame_set_text_zoom_level
                                                        (WebKitWebFrame *webFrame,
                                                         gfloat zoomLevel);
void                webkit_web_frame_save_as_pdf        (WebKitWebFrame *frame,
                                                         const char *file_name,
                                                         gfloat width,
                                                         gfloat height);
gfloat              webkit_web_frame_get_contents_scale (WebKitWebFrame *webFrame);
void                webkit_web_frame_set_contents_frozen
                                                        (WebKitWebFrame *webFrame,
                                                         gboolean freeze);
void                webkit_web_frame_set_contents_scale (WebKitWebFrame *webFrame,
                                                         gfloat scale);

Object Hierarchy

  GObject
   +----WebKitWebFrame

Properties

  "contents-height"          gint                  : Read
  "contents-width"           gint                  : Read
  "load-status"              WebKitLoadStatus      : Read
  "name"                     gchar*                : Read
  "text-zoom-level"          gfloat                : Read / Write
  "title"                    gchar*                : Read
  "uri"                      gchar*                : Read
  "x-scroll-offset"          gint                  : Read / Write
  "y-scroll-offset"          gint                  : Read / Write
  "zoom-level"               gfloat                : Read / Write

Signals

  "cleared"                                        : Run Last
  "contents-size-changed"                          : Run Last
  "hovering-over-link"                             : Run Last
  "load-committed"                                 : Run Last
  "load-done"                                      : Run Last
  "scroll-offset-changed"                          : Run Last
  "title-changed"                                  : Run Last

Description

A WebKitWebView contains a main WebKitWebFrame. A WebKitWebFrame contains the content of one URI. The URI and name of the frame can be retrieved, the load status and progress can be observed using the signals and can be controlled using the methods of the WebKitWebFrame. A WebKitWebFrame can have any number of children and one child can be found by using webkit_web_frame_find_frame.

/* Get the frame from the WebKitWebView */
WebKitWebFrame *frame = webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW(my_view));
g_print("The URI of this frame is '%s'", webkit_web_frame_get_uri (frame));

Details

enum WebKitLoadStatus

typedef enum {
    WEBKIT_LOAD_PROVISIONAL,
    WEBKIT_LOAD_COMMITTED,
    WEBKIT_LOAD_FINISHED,
    WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT,
    WEBKIT_LOAD_FAILED
} WebKitLoadStatus;

WEBKIT_LOAD_PROVISIONAL

No data has been received yet, empty structures have been allocated to perform the load; the load may still fail for transport issues such as not being able to resolve a name, or connect to a port.

WEBKIT_LOAD_COMMITTED

The first data chunk has arrived, meaning that the necessary transport requirements are stabilished, and the load is being performed.

WEBKIT_LOAD_FINISHED

This state means that everything that was required to display the page has been loaded.

WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT

The first layout with actual visible content happened; one or more layouts may have happened before that caused nothing to be visible on the screen, because the data available at the time was not significant enough.

WEBKIT_LOAD_FAILED

This state means that some error occurred during the page load that prevented it from being completed. You can connect to the "load-error" signal if you want to know precisely what kind of error occurred.

WebKitWebFrame

typedef struct _WebKitWebFrame WebKitWebFrame;


webkit_web_frame_get_type ()

GType               webkit_web_frame_get_type           (void);


webkit_web_frame_get_name ()

const gchar *       webkit_web_frame_get_name           (WebKitWebFrame *frame);

Returns the frame's name

frame :

a WebKitWebFrame

Returns :

the name of frame

webkit_web_frame_get_title ()

const gchar *       webkit_web_frame_get_title          (WebKitWebFrame *frame);

Returns the frame's document title

frame :

a WebKitWebFrame

Returns :

the title of frame

webkit_web_frame_get_uri ()

const gchar *       webkit_web_frame_get_uri            (WebKitWebFrame *frame);

Returns the current URI of the contents displayed by the frame

frame :

a WebKitWebFrame

Returns :

the URI of frame

webkit_web_frame_get_page ()

WebKitWebPage *     webkit_web_frame_get_page           (WebKitWebFrame *Param1);


webkit_web_frame_get_parent ()

WebKitWebFrame *    webkit_web_frame_get_parent         (WebKitWebFrame *frame);

Returns the frame's parent frame, or NULL if it has none.

frame :

a WebKitWebFrame

Returns :

the parent WebKitWebFrame or NULL in case there is none. [transfer none]

webkit_web_frame_load_uri ()

void                webkit_web_frame_load_uri           (WebKitWebFrame *frame,
                                                         const gchar *uri);

Requests loading of the specified URI string.

frame :

a WebKitWebFrame

uri :

an URI string

Since 1.1.1


webkit_web_frame_load_string ()

void                webkit_web_frame_load_string        (WebKitWebFrame *frame,
                                                         const gchar *content,
                                                         const gchar *mime_type,
                                                         const gchar *encoding,
                                                         const gchar *base_uri);

Requests loading of the given content with the specified mime_type, encoding and base_uri.

If mime_type is NULL, "text/html" is assumed.

If encoding is NULL, "UTF-8" is assumed.

frame :

a WebKitWebFrame

content :

an URI string

mime_type :

the MIME type, or NULL

encoding :

the encoding, or NULL

base_uri :

the base URI for relative locations

Since 1.1.1


webkit_web_frame_load_alternate_string ()

void                webkit_web_frame_load_alternate_string
                                                        (WebKitWebFrame *frame,
                                                         const gchar *content,
                                                         const gchar *base_url,
                                                         const gchar *unreachable_url);

Request loading of an alternate content for a URL that is unreachable. Using this method will preserve the back-forward list. The URI passed in base_url has to be an absolute URI.

frame :

a WebKitWebFrame

content :

the alternate content to display as the main page of the frame

base_url :

the base URI for relative locations

unreachable_url :

the URL for the alternate page content

Since 1.1.6


webkit_web_frame_load_request ()

void                webkit_web_frame_load_request       (WebKitWebFrame *frame,
                                                         WebKitNetworkRequest *request);

Connects to a given URI by initiating an asynchronous client request.

Creates a provisional data source that will transition to a committed data source once any data has been received. Use webkit_web_frame_stop_loading() to stop the load. This function is typically invoked on the main frame.

frame :

a WebKitWebFrame

request :

a WebKitNetworkRequest

webkit_web_frame_stop_loading ()

void                webkit_web_frame_stop_loading       (WebKitWebFrame *frame);

Stops any pending loads on frame's data source, and those of its children.

frame :

a WebKitWebFrame

webkit_web_frame_reload ()

void                webkit_web_frame_reload             (WebKitWebFrame *frame);

Reloads the initial request.

frame :

a WebKitWebFrame

webkit_web_frame_find_frame ()

WebKitWebFrame *    webkit_web_frame_find_frame         (WebKitWebFrame *frame,
                                                         const gchar *name);

For pre-defined names, returns frame if name is "_self" or "_current", returns frame's parent frame if name is "_parent", and returns the main frame if name is "_top". Also returns frame if it is the main frame and name is either "_parent" or "_top". For other names, this function returns the first frame that matches name. This function searches frame and its descendents first, then frame's parent and its children moving up the hierarchy until a match is found. If no match is found in frame's hierarchy, this function will search for a matching frame in other main frame hierarchies. Returns NULL if no match is found.

frame :

a WebKitWebFrame

name :

the name of the frame to be found

Returns :

the found WebKitWebFrame or NULL in case none is found. [transfer none]

webkit_web_frame_get_global_context ()

JSGlobalContextRef  webkit_web_frame_get_global_context (WebKitWebFrame *frame);

Gets the global JavaScript execution context. Use this function to bridge between the WebKit and JavaScriptCore APIs.

frame :

a WebKitWebFrame

Returns :

the global JavaScript context. [transfer none]

webkit_web_frame_print ()

void                webkit_web_frame_print              (WebKitWebFrame *frame);


webkit_web_frame_get_load_status ()

WebKitLoadStatus    webkit_web_frame_get_load_status    (WebKitWebFrame *frame);

Determines the current status of the load.

frame :

a WebKitWebView

Returns :

a WebKitLoadStatus object

Since 1.1.7


webkit_web_frame_get_data_source ()

WebKitWebDataSource * webkit_web_frame_get_data_source  (WebKitWebFrame *frame);

Returns the committed data source.

frame :

a WebKitWebFrame

Returns :

the committed WebKitWebDataSource. [transfer none]

Since 1.1.14


webkit_web_frame_get_provisional_data_source ()

WebKitWebDataSource * webkit_web_frame_get_provisional_data_source
                                                        (WebKitWebFrame *frame);

You use the webkit_web_frame_load_request method to initiate a request that creates a provisional data source. The provisional data source will transition to a committed data source once any data has been received. Use webkit_web_frame_get_data_source to get the committed data source.

frame :

a WebKitWebFrame

Returns :

the provisional WebKitWebDataSource or NULL if a load request is not in progress. [transfer none]

Since 1.1.14


webkit_web_frame_get_security_origin ()

WebKitSecurityOrigin * webkit_web_frame_get_security_origin
                                                        (WebKitWebFrame *frame);

Returns the frame's security origin.

frame :

a WebKitWebFrame

Returns :

the security origin of frame. [transfer none]

Since 1.1.14


webkit_web_frame_get_network_response ()

WebKitNetworkResponse * webkit_web_frame_get_network_response
                                                        (WebKitWebFrame *frame);

Returns a WebKitNetworkResponse object representing the response that was given to the request for the given frame, or NULL if the frame was not created by a load. You must unref the object when you are done with it.

frame :

a WebKitWebFrame

Returns :

a WebKitNetworkResponse object. [transfer full]

Since 1.1.18


webkit_web_frame_get_contents_size ()

gboolean            webkit_web_frame_get_contents_size  (WebKitWebFrame *webFrame,
                                                         int *width,
                                                         int *height);


webkit_web_frame_get_contents_width ()

int                 webkit_web_frame_get_contents_width (WebKitWebFrame *webFrame);


webkit_web_frame_get_contents_height ()

int                 webkit_web_frame_get_contents_height
                                                        (WebKitWebFrame *webFrame);


webkit_web_frame_get_scroll_offset ()

gboolean            webkit_web_frame_get_scroll_offset  (WebKitWebFrame *webFrame,
                                                         int *x,
                                                         int *y);

Obtains the current scroll offset the the given webFrame.

webFrame :

a WebKitWebFrame instance

x :

the location where the value for the x position should be stored or NULL

y :

the location where the value for the y position should be stored or NULL

Returns :

TRUE if the position was correctly obtained, FALSE if the frame does not have a view currently.

webkit_web_frame_get_x_scroll_offset ()

int                 webkit_web_frame_get_x_scroll_offset
                                                        (WebKitWebFrame *webFrame);

Obtains the current scroll offset of the x axis for the the given webFrame.

webFrame :

a WebKitWebFrame instance

Returns :

the x scroll offset or -1 if no view exists for the frame.

webkit_web_frame_get_y_scroll_offset ()

int                 webkit_web_frame_get_y_scroll_offset
                                                        (WebKitWebFrame *webFrame);

Obtains the current scroll offset of the y axis for the the given webFrame.

webFrame :

a WebKitWebFrame instance

Returns :

the y scroll offset or -1 if no view exists for the frame.

webkit_web_frame_set_scroll_offset ()

void                webkit_web_frame_set_scroll_offset  (WebKitWebFrame *webFrame,
                                                         int x,
                                                         int y);

Sets the scroll offset of the given frame.

webFrame :

a WebKitWebFrame instance

x :

the x position to where the view should be scrolled

y :

the y position to where the view should be scrolled

webkit_web_frame_set_x_scroll_offset ()

void                webkit_web_frame_set_x_scroll_offset
                                                        (WebKitWebFrame *webFrame,
                                                         int offset);

Sets the x scroll offset of the given frame.

webFrame :

a WebKitWebFrame instance

offset :

the x position to where the view should be scrolled

webkit_web_frame_set_y_scroll_offset ()

void                webkit_web_frame_set_y_scroll_offset
                                                        (WebKitWebFrame *webFrame,
                                                         int offset);

Sets the y scroll offset of the given frame.

webFrame :

a WebKitWebFrame instance

offset :

the y position to where the view should be scrolled

webkit_web_frame_scroll ()

void                webkit_web_frame_scroll             (WebKitWebFrame *webFrame,
                                                         int x,
                                                         int y);

Shifts the visible area by scrolling the contents of the given frame by the provided amount.

webFrame :

a WebKitWebFrame instance

x :

how many pixels the view should be scrolled in the x axis

y :

how many pixels the view should be scrolled in the y axis

webkit_web_frame_render ()

void                webkit_web_frame_render             (WebKitWebFrame *webFrame,
                                                         cairo_t *cr,
                                                         gint x_offset,
                                                         gint y_offset,
                                                         gint width,
                                                         gint height);


webkit_web_frame_get_zoom_level ()

gfloat              webkit_web_frame_get_zoom_level     (WebKitWebFrame *webFrame);

Returns the zoom level of webFrame, i.e. the factor by which elements in the frame are scaled with respect to their original size.

webFrame :

a WebKitWebFrame

Returns :

the zoom level of web_frame

webkit_web_frame_set_zoom_level ()

void                webkit_web_frame_set_zoom_level     (WebKitWebFrame *webFrame,
                                                         gfloat zoomLevel);

Sets the zoom level of webFrame, i.e. the factor by which elements in the frame are scaled with respect to their original size.

webFrame :

a WebKitWebFrame

zoomLevel :

the new zoom level

webkit_web_frame_zoom_in ()

void                webkit_web_frame_zoom_in            (WebKitWebFrame *webFrame);

Increases the zoom level of webFrame. The current zoom level is incremented by the value of the "zoom-step" property of the WebKitWebSettings associated with web_frame.

webFrame :

a WebKitWebFrame

webkit_web_frame_zoom_out ()

void                webkit_web_frame_zoom_out           (WebKitWebFrame *webFrame);

Decreases the zoom level of webFrame. The current zoom level is decremented by the value of the "zoom-step" property of the WebKitWebSettings associated with web_frame.

webFrame :

a WebKitWebFrame

webkit_web_frame_get_text_zoom_level ()

gfloat              webkit_web_frame_get_text_zoom_level
                                                        (WebKitWebFrame *webFrame);

Returns the text zoom level of webFrame, i.e. the factor by which text in the frame is scaled with respect to its original size.

webFrame :

a WebKitWebFrame

Returns :

the text zoom level of web_frame

webkit_web_frame_set_text_zoom_level ()

void                webkit_web_frame_set_text_zoom_level
                                                        (WebKitWebFrame *webFrame,
                                                         gfloat zoomLevel);

Sets the text zoom level of webFrame, i.e. the factor by which text in the frame is scaled with respect to its original size.

webFrame :

a WebKitWebFrame

zoomLevel :

the new zoom level

webkit_web_frame_save_as_pdf ()

void                webkit_web_frame_save_as_pdf        (WebKitWebFrame *frame,
                                                         const char *file_name,
                                                         gfloat width,
                                                         gfloat height);

Prints the given WebKitWebFrame to a pdf

frame :

a WebKitWebFrame

file_name :

a path to which the file will be written

width :

width of the page

height :

height of the page

webkit_web_frame_get_contents_scale ()

gfloat              webkit_web_frame_get_contents_scale (WebKitWebFrame *webFrame);

Gets the scale factor applied to the frame contents.

webFrame :

a WebKitWebFrame

Returns :

the scale applied to the frame contents

webkit_web_frame_set_contents_frozen ()

void                webkit_web_frame_set_contents_frozen
                                                        (WebKitWebFrame *webFrame,
                                                         gboolean freeze);

Freeze frame contents preventing them from getting relayouted after size or scale changes.

webFrame :

a WebKitWebFrame

freeze :

whether to freeze frame contents

webkit_web_frame_set_contents_scale ()

void                webkit_web_frame_set_contents_scale (WebKitWebFrame *webFrame,
                                                         gfloat scale);

Sets the scale factor to be applied to the frame contents.

webFrame :

a WebKitWebFrame

scale :

the scale for the frame contents

Property Details

The "contents-height" property

  "contents-height"          gint                  : Read

The height of the frame's contents.

Default value: 0


The "contents-width" property

  "contents-width"           gint                  : Read

The width of the frame's contents.

Default value: 0


The "load-status" property

  "load-status"              WebKitLoadStatus      : Read

Determines the current status of the load.

Default value: WEBKIT_LOAD_FINISHED

Since 1.1.7


The "name" property

  "name"                     gchar*                : Read

The name of the frame.

Default value: NULL


The "text-zoom-level" property

  "text-zoom-level"          gfloat                : Read / Write

The level of zoom of the text.

Allowed values: >= G_MINFLOAT

Default value: 1


The "title" property

  "title"                    gchar*                : Read

The document title of the frame.

Default value: NULL


The "uri" property

  "uri"                      gchar*                : Read

The current URI of the contents displayed by the frame.

Default value: NULL


The "x-scroll-offset" property

  "x-scroll-offset"          gint                  : Read / Write

The scroll offset of the x axis.

Default value: 0


The "y-scroll-offset" property

  "y-scroll-offset"          gint                  : Read / Write

The scroll offset of the y axis.

Default value: 0


The "zoom-level" property

  "zoom-level"               gfloat                : Read / Write

The level of zoom of the content.

Allowed values: >= G_MINFLOAT

Default value: 1

Signal Details

The "cleared" signal

void                user_function                      (WebKitWebFrame *webkitwebframe,
                                                        gpointer        user_data)           : Run Last

webkitwebframe :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "contents-size-changed" signal

void                user_function                      (WebKitWebFrame *frame,
                                                        guint           width,
                                                        guint           height,
                                                        gpointer        user_data)      : Run Last

FIXME: Should we notify on the width and height propertied instead?

frame :

the object on which the signal is emitted

width :

The new width

height :

The new height

user_data :

user data set when the signal handler was connected.

The "hovering-over-link" signal

void                user_function                      (WebKitWebFrame *webkitwebframe,
                                                        gchar          *arg1,
                                                        gchar          *arg2,
                                                        gpointer        user_data)           : Run Last

webkitwebframe :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "load-committed" signal

void                user_function                      (WebKitWebFrame *webkitwebframe,
                                                        gpointer        user_data)           : Run Last

webkitwebframe :

the object which received the signal.

user_data :

user data set when the signal handler was connected.

The "load-done" signal

void                user_function                      (WebKitWebFrame *web_frame,
                                                        gboolean        arg1,
                                                        gpointer        user_data)      : Run Last

Warning

WebKitWebFrame::load-done is deprecated and should not be used in newly-written code. Use the "load-status" property instead, and/or WebKitWebView::load-error to be notified of load errors

Emitted when frame loading is done.

web_frame :

the object on which the signal is emitted

user_data :

user data set when the signal handler was connected.

The "scroll-offset-changed" signal

void                user_function                      (WebKitWebFrame *frame,
                                                        gpointer        user_data)      : Run Last

FIXME: This should be a notification on the two scroll properties, but rigth now the engine only signals changes without saying in which direction.

frame :

the object on which the signal is emitted

user_data :

user data set when the signal handler was connected.

The "title-changed" signal

void                user_function                      (WebKitWebFrame *frame,
                                                        gchar          *title,
                                                        gpointer        user_data)      : Run Last

Warning

WebKitWebFrame::title-changed has been deprecated since version 1.1.18 and should not be used in newly-written code. Use "notify::title" instead.

When a WebKitWebFrame changes the document title this signal is emitted.

frame :

the object on which the signal is emitted

title :

the new title

user_data :

user data set when the signal handler was connected.