gi-webkit-3.0.11: WebKit bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.WebKit.Objects.ViewportAttributes

Contents

Description

ViewportAttributes offers the viewport properties to user agents to control the viewport layout. It contains the viewport size, initial scale with limits, and information about whether a user is able to scale the contents in the viewport. This makes a web page fit the device screen.

The WebView::viewport-attributes-changed signal will be emitted with ViewportAttributes when the viewport attributes are updated in the case of loading web pages contain the viewport properties and calling webkit_viewport_attributes_recompute.

If the device size, available size, desktop width, or device DPI needs to be changed due to a consequence of an explicit browser request (caused by screen rotation, resizing, or similar reasons), You should call webkit_viewport_attributes_recompute to recompute the viewport properties and override those values in the handler of WebView::viewport-attributes-recompute-requested signal.

For more information on the viewport properties, refer to the Safari reference library at http://developer.apple.com/safari/library/documentation/appleapplications/reference/safarihtmlref/articles/metatags.html

<informalexample><programlisting> /<!-- -->* Connect to the viewport-attributes-changes signal *<!-- -->/ WebKitViewportAttributes* attributes = webkit_web_view_get_viewport_attributes (web_view); g_signal_connect (web_view, "viewport-attributes-recompute-requested", G_CALLBACK (viewport_recompute_cb), window); g_signal_connect (web_view, "viewport-attributes-changed", G_CALLBACK (viewport_changed_cb), window); g_signal_connect (attributes, "notify::valid", G_CALLBACK (viewport_valid_changed_cb), web_view);

/<!-- -->* Handle the viewport-attributes-recompute-requested signal to override the device width *<!-- -->/ static void viewport_recompute_cb (WebKitWebView* web_view, WebKitViewportAttributes* attributes, GtkWidget* window) { int override_available_width = 480; g_object_set (G_OBJECT(attributes), "available-width", override_available_width, NULL); }

/<!-- -->* Handle the viewport-attributes-changed signal to recompute the initial scale factor *<!-- -->/ static void viewport_changed_cb (WebKitWebView* web_view, WebKitViewportAttributes* attributes, gpointer data) { gfloat initialScale; g_object_get (G_OBJECT (atributes), "initial-scale-factor", &initialScale, NULL); webkit_web_view_set_zoom_level (web_view, initialScale); }

/<!-- -->* Handle the notify::valid signal to initialize the zoom level *<!-- -->/ static void viewport_valid_changed_cb (WebKitViewportAttributes* attributes, GParamSpec* pspec, WebKitWebView* web_view) { gboolean is_valid; g_object_get (attributes, "valid", &is_valid, NULL); if (!is_valid) webkit_web_view_set_zoom_level (web_view, 1.0); } </programlisting></informalexample>

Synopsis

Exported types

Methods

recompute

viewportAttributesRecompute Source #

Arguments

:: (HasCallStack, MonadIO m, IsViewportAttributes a) 
=> a

viewportAttributes: a ViewportAttributes

-> m () 

Recompute the optimal viewport attributes and emit the viewport-attribute-changed signal. The viewport-attributes-recompute-requested signal also will be handled to override the device size, available size, desktop width, or device DPI.

Since: 1.3.8

Properties

availableHeight

data ViewportAttributesAvailableHeightPropertyInfo Source #

Instances

AttrInfo ViewportAttributesAvailableHeightPropertyInfo Source # 
type AttrOrigin ViewportAttributesAvailableHeightPropertyInfo Source # 
type AttrLabel ViewportAttributesAvailableHeightPropertyInfo Source # 
type AttrGetType ViewportAttributesAvailableHeightPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesAvailableHeightPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesAvailableHeightPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesAvailableHeightPropertyInfo Source # 

availableWidth

data ViewportAttributesAvailableWidthPropertyInfo Source #

Instances

AttrInfo ViewportAttributesAvailableWidthPropertyInfo Source # 
type AttrOrigin ViewportAttributesAvailableWidthPropertyInfo Source # 
type AttrLabel ViewportAttributesAvailableWidthPropertyInfo Source # 
type AttrGetType ViewportAttributesAvailableWidthPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesAvailableWidthPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesAvailableWidthPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesAvailableWidthPropertyInfo Source # 

desktopWidth

data ViewportAttributesDesktopWidthPropertyInfo Source #

Instances

AttrInfo ViewportAttributesDesktopWidthPropertyInfo Source # 
type AttrOrigin ViewportAttributesDesktopWidthPropertyInfo Source # 
type AttrLabel ViewportAttributesDesktopWidthPropertyInfo Source # 
type AttrGetType ViewportAttributesDesktopWidthPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesDesktopWidthPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesDesktopWidthPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesDesktopWidthPropertyInfo Source # 

deviceDpi

data ViewportAttributesDeviceDpiPropertyInfo Source #

Instances

AttrInfo ViewportAttributesDeviceDpiPropertyInfo Source # 
type AttrOrigin ViewportAttributesDeviceDpiPropertyInfo Source # 
type AttrLabel ViewportAttributesDeviceDpiPropertyInfo Source # 
type AttrGetType ViewportAttributesDeviceDpiPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesDeviceDpiPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesDeviceDpiPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesDeviceDpiPropertyInfo Source # 

deviceHeight

data ViewportAttributesDeviceHeightPropertyInfo Source #

Instances

AttrInfo ViewportAttributesDeviceHeightPropertyInfo Source # 
type AttrOrigin ViewportAttributesDeviceHeightPropertyInfo Source # 
type AttrLabel ViewportAttributesDeviceHeightPropertyInfo Source # 
type AttrGetType ViewportAttributesDeviceHeightPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesDeviceHeightPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesDeviceHeightPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesDeviceHeightPropertyInfo Source # 

devicePixelRatio

data ViewportAttributesDevicePixelRatioPropertyInfo Source #

Instances

AttrInfo ViewportAttributesDevicePixelRatioPropertyInfo Source # 
type AttrOrigin ViewportAttributesDevicePixelRatioPropertyInfo Source # 
type AttrLabel ViewportAttributesDevicePixelRatioPropertyInfo Source # 
type AttrGetType ViewportAttributesDevicePixelRatioPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesDevicePixelRatioPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesDevicePixelRatioPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesDevicePixelRatioPropertyInfo Source # 

deviceWidth

data ViewportAttributesDeviceWidthPropertyInfo Source #

Instances

AttrInfo ViewportAttributesDeviceWidthPropertyInfo Source # 
type AttrOrigin ViewportAttributesDeviceWidthPropertyInfo Source # 
type AttrLabel ViewportAttributesDeviceWidthPropertyInfo Source # 
type AttrGetType ViewportAttributesDeviceWidthPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesDeviceWidthPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesDeviceWidthPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesDeviceWidthPropertyInfo Source # 

height

data ViewportAttributesHeightPropertyInfo Source #

Instances

AttrInfo ViewportAttributesHeightPropertyInfo Source # 
type AttrOrigin ViewportAttributesHeightPropertyInfo Source # 
type AttrLabel ViewportAttributesHeightPropertyInfo Source # 
type AttrGetType ViewportAttributesHeightPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesHeightPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesHeightPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesHeightPropertyInfo Source # 

initialScaleFactor

data ViewportAttributesInitialScaleFactorPropertyInfo Source #

Instances

AttrInfo ViewportAttributesInitialScaleFactorPropertyInfo Source # 
type AttrOrigin ViewportAttributesInitialScaleFactorPropertyInfo Source # 
type AttrLabel ViewportAttributesInitialScaleFactorPropertyInfo Source # 
type AttrGetType ViewportAttributesInitialScaleFactorPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesInitialScaleFactorPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesInitialScaleFactorPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesInitialScaleFactorPropertyInfo Source # 

maximumScaleFactor

data ViewportAttributesMaximumScaleFactorPropertyInfo Source #

Instances

AttrInfo ViewportAttributesMaximumScaleFactorPropertyInfo Source # 
type AttrOrigin ViewportAttributesMaximumScaleFactorPropertyInfo Source # 
type AttrLabel ViewportAttributesMaximumScaleFactorPropertyInfo Source # 
type AttrGetType ViewportAttributesMaximumScaleFactorPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesMaximumScaleFactorPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesMaximumScaleFactorPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesMaximumScaleFactorPropertyInfo Source # 

minimumScaleFactor

data ViewportAttributesMinimumScaleFactorPropertyInfo Source #

Instances

AttrInfo ViewportAttributesMinimumScaleFactorPropertyInfo Source # 
type AttrOrigin ViewportAttributesMinimumScaleFactorPropertyInfo Source # 
type AttrLabel ViewportAttributesMinimumScaleFactorPropertyInfo Source # 
type AttrGetType ViewportAttributesMinimumScaleFactorPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesMinimumScaleFactorPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesMinimumScaleFactorPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesMinimumScaleFactorPropertyInfo Source # 

userScalable

data ViewportAttributesUserScalablePropertyInfo Source #

Instances

AttrInfo ViewportAttributesUserScalablePropertyInfo Source # 
type AttrOrigin ViewportAttributesUserScalablePropertyInfo Source # 
type AttrLabel ViewportAttributesUserScalablePropertyInfo Source # 
type AttrGetType ViewportAttributesUserScalablePropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesUserScalablePropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesUserScalablePropertyInfo Source # 
type AttrAllowedOps ViewportAttributesUserScalablePropertyInfo Source # 

valid

data ViewportAttributesValidPropertyInfo Source #

Instances

AttrInfo ViewportAttributesValidPropertyInfo Source # 
type AttrOrigin ViewportAttributesValidPropertyInfo Source # 
type AttrLabel ViewportAttributesValidPropertyInfo Source # 
type AttrGetType ViewportAttributesValidPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesValidPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesValidPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesValidPropertyInfo Source # 

width

data ViewportAttributesWidthPropertyInfo Source #

Instances

AttrInfo ViewportAttributesWidthPropertyInfo Source # 
type AttrOrigin ViewportAttributesWidthPropertyInfo Source # 
type AttrLabel ViewportAttributesWidthPropertyInfo Source # 
type AttrGetType ViewportAttributesWidthPropertyInfo Source # 
type AttrBaseTypeConstraint ViewportAttributesWidthPropertyInfo Source # 
type AttrSetTypeConstraint ViewportAttributesWidthPropertyInfo Source # 
type AttrAllowedOps ViewportAttributesWidthPropertyInfo Source #