User content

User content — Defines user content types which affect web pages.

Functions

Types and Values

Object Hierarchy

    GBoxed
    ├── WebKitUserContentFilter
    ├── WebKitUserScript
    ╰── WebKitUserStyleSheet

Description

See also: WebKitUserContentManager

Functions

webkit_user_style_sheet_ref ()

WebKitUserStyleSheet *
webkit_user_style_sheet_ref (WebKitUserStyleSheet *user_style_sheet);

Atomically increments the reference count of user_style_sheet by one. This function is MT-safe and may be called from any thread.

Parameters

user_style_sheet

a WebKitUserStyleSheet

 

Returns

The passed WebKitUserStyleSheet

Since: 2.6


webkit_user_style_sheet_unref ()

void
webkit_user_style_sheet_unref (WebKitUserStyleSheet *user_style_sheet);

Atomically decrements the reference count of user_style_sheet by one. If the reference count drops to 0, all memory allocated by WebKitUserStyleSheet is released. This function is MT-safe and may be called from any thread.

Parameters

user_style_sheet

a WebKitUserStyleSheet

 

Since: 2.6


webkit_user_style_sheet_new ()

WebKitUserStyleSheet *
webkit_user_style_sheet_new (const gchar *source,
                             WebKitUserContentInjectedFrames injected_frames,
                             WebKitUserStyleLevel level,
                             const gchar * const *whitelist,
                             const gchar * const *blacklist);

Creates a new user style sheet. Style sheets can be applied to some URIs only by passing non-null values for whitelist or blacklist . Passing a NULL whitelist implies that all URIs are on the whitelist. The style sheet is applied if an URI matches the whitelist and not the blacklist. URI patterns must be of the form [protocol]://[host]/[path], where the *host* and *path* components can contain the wildcard character (*) to represent zero or more other characters.

Parameters

source

Source code of the user style sheet.

 

injected_frames

A WebKitUserContentInjectedFrames value

 

level

A WebKitUserStyleLevel

 

whitelist

A whitelist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

blacklist

A blacklist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

Returns

A new WebKitUserStyleSheet

Since: 2.6


webkit_user_style_sheet_new_for_world ()

WebKitUserStyleSheet *
webkit_user_style_sheet_new_for_world (const gchar *source,
                                       WebKitUserContentInjectedFrames injected_frames,
                                       WebKitUserStyleLevel level,
                                       const gchar *world_name,
                                       const gchar * const *whitelist,
                                       const gchar * const *blacklist);

Creates a new user style sheet for script world with name world_name . See webkit_user_style_sheet_new() for a full description.

Parameters

source

Source code of the user style sheet.

 

injected_frames

A WebKitUserContentInjectedFrames value

 

level

A WebKitUserStyleLevel

 

world_name

the name of a WebKitScriptWorld

 

whitelist

A whitelist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

blacklist

A blacklist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

Returns

A new WebKitUserStyleSheet

Since: 2.22


webkit_user_script_ref ()

WebKitUserScript *
webkit_user_script_ref (WebKitUserScript *user_script);

Atomically increments the reference count of user_script by one. This function is MT-safe and may be called from any thread.

Parameters

user_script

a WebKitUserScript

 

Returns

The passed WebKitUserScript

Since: 2.6


webkit_user_script_unref ()

void
webkit_user_script_unref (WebKitUserScript *user_script);

Atomically decrements the reference count of user_script by one. If the reference count drops to 0, all memory allocated by WebKitUserScript is released. This function is MT-safe and may be called from any thread.

Parameters

user_script

a WebKitUserScript

 

Since: 2.6


webkit_user_script_new ()

WebKitUserScript *
webkit_user_script_new (const gchar *source,
                        WebKitUserContentInjectedFrames injected_frames,
                        WebKitUserScriptInjectionTime injection_time,
                        const gchar * const *whitelist,
                        const gchar * const *blacklist);

Creates a new user script. Scripts can be applied to some URIs only by passing non-null values for whitelist or blacklist . Passing a NULL whitelist implies that all URIs are on the whitelist. The script is applied if an URI matches the whitelist and not the blacklist. URI patterns must be of the form [protocol]://[host]/[path], where the *host* and *path* components can contain the wildcard character (*) to represent zero or more other characters.

Parameters

source

Source code of the user script.

 

injected_frames

A WebKitUserContentInjectedFrames value

 

injection_time

A WebKitUserScriptInjectionTime value

 

whitelist

A whitelist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

blacklist

A blacklist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

Returns

A new WebKitUserScript

Since: 2.6


webkit_user_script_new_for_world ()

WebKitUserScript *
webkit_user_script_new_for_world (const gchar *source,
                                  WebKitUserContentInjectedFrames injected_frames,
                                  WebKitUserScriptInjectionTime injection_time,
                                  const gchar *world_name,
                                  const gchar * const *whitelist,
                                  const gchar * const *blacklist);

Creates a new user script for script world with name world_name . See webkit_user_script_new() for a full description.

Parameters

source

Source code of the user script.

 

injected_frames

A WebKitUserContentInjectedFrames value

 

injection_time

A WebKitUserScriptInjectionTime value

 

world_name

the name of a WebKitScriptWorld

 

whitelist

A whitelist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

blacklist

A blacklist of URI patterns or NULL.

[array zero-terminated=1][allow-none]

Returns

A new WebKitUserScript

Since: 2.22


webkit_user_content_filter_ref ()

WebKitUserContentFilter *
webkit_user_content_filter_ref (WebKitUserContentFilter *user_content_filter);

Atomically increments the reference count of user_content_filter by one. This function is MT-safe and may be called from any thread.

Parameters

user_content_filter

A WebKitUserContentFilter

 

Since: 2.24


webkit_user_content_filter_unref ()

void
webkit_user_content_filter_unref (WebKitUserContentFilter *user_content_filter);

Atomically decrements the reference count of user_content_filter by one. If the reference count drops to 0, all the memory allocated by the WebKitUserContentFilter is released. This function is MT-safe and may be called from any thread.

Parameters

user_content_filter

A WebKitUserContentFilter

 

Since: 2.24


webkit_user_content_filter_get_identifier ()

const char *
webkit_user_content_filter_get_identifier
                               (WebKitUserContentFilter *user_content_filter);

Obtain the identifier previously used to save the user_content_filter in the WebKitUserContentFilterStore.

Parameters

user_content_filter

A WebKitUserContentFilter

 

Returns

the identifier for the filter.

[transfer none]

Since: 2.24

Types and Values

WebKitUserStyleSheet

typedef struct _WebKitUserStyleSheet WebKitUserStyleSheet;

WebKitUserScript

typedef struct _WebKitUserScript WebKitUserScript;

enum WebKitUserContentInjectedFrames

Specifies in which frames user style sheets are to be inserted in.

Members

WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES

Insert the user style sheet in all the frames loaded by the web view, including nested frames. This is the default.

 

WEBKIT_USER_CONTENT_INJECT_TOP_FRAME

Insert the user style sheet *only* in the top-level frame loaded by the web view, and *not* in the nested frames.

 

Since: 2.6


enum WebKitUserStyleLevel

Specifies how to treat an user style sheet.

Members

WEBKIT_USER_STYLE_LEVEL_USER

The style sheet is an user style sheet, its contents always override other style sheets. This is the default.

 

WEBKIT_USER_STYLE_LEVEL_AUTHOR

The style sheet will be treated as if it was provided by the loaded documents. That means other user style sheets may still override it.

 

Since: 2.6


enum WebKitUserScriptInjectionTime

Specifies at which place of documents an user script will be inserted.

Members

WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_START

Insert the code of the user script at the beginning of loaded documents. This is the default.

 

WEBKIT_USER_SCRIPT_INJECT_AT_DOCUMENT_END

Insert the code of the user script at the end of the loaded documents.

 

Since: 2.6


WebKitUserContentFilter

typedef struct _WebKitUserContentFilter WebKitUserContentFilter;