2010-12-09 Joone Hur <joone@kldp.org>

        Reviewed by Martin Robinson.

        [GTK] Support for viewport meta tag
        https://bugs.webkit.org/show_bug.cgi?id=45443

        Included viewport test cases for WebKitGtk

        * platform/gtk/Skipped: Unskip fast/viewport except viewport-45.html.
2010-12-09  Joone Hur  <joone@kldp.org>

        Reviewed by Martin Robinson.

        [GTK] Support for viewport meta tag
        https://bugs.webkit.org/show_bug.cgi?id=45443

        This patch adds a new gobject to offer the viewport properties to user agents.
        It is WebKitViewportAttributes that contains the viewport size, initial scale with limits,
        and information about whether a user is able to scale the contents in the viewport.

        This feature was introduced by Safari on the iPhone. 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

        * GNUmakefile.am: Added webkitviewportattributes.h webkitviewportattributes.cpp.
        * WebCoreSupport/ChromeClientGtk.cpp:
        (WebKit::ChromeClient::dispatchViewportDataDidChange): Added this callback to know whether the viewport arguments is available.
        * WebCoreSupport/ChromeClientGtk.h:
        * WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
        (DumpRenderTreeSupportGtk::dumpConfigurationForViewport): Added this function to compute the viewport attributes with the given availableWidth and availableHeight.
        * WebCoreSupport/DumpRenderTreeSupportGtk.h:
        * WebCoreSupport/FrameLoaderClientGtk.cpp:
        (WebKit::postCommitFrameViewSetup): Invalidate the viewport attributes.
        * webkit/webkit.h:
        * webkit/webkitdefines.h:
        * webkit/webkitprivate.h: Added webkitViewportAttributesRecompute as a private function.
        * webkit/webkitviewportattributes.cpp: Added.
        (webkit_viewport_attributes_class_init):
        (webkit_viewport_attributes_init):
        (webkit_viewport_attributes_get_property):
        (webkit_viewport_attributes_set_property):
        (webkitViewportAttributesRecompute): Recompute the optimal viewport attributes and emit the viewport-attributes-changed signal.
        (webkit_viewport_attributes_recompute): a public API for calling webkitViewportAttributesRecompute.
        * webkit/webkitviewportattributes.h: Added.
        * webkit/webkitwebview.cpp:
        (webkit_web_view_get_property): Added PROP_VIEWPORT_ATTRIBUTES.
        (webkit_web_view_dispose): Deallocate the WebKitViewportAttributes instance.
        (webkit_web_view_class_init): Added the viewport-attributes-recompute-requested and viewport-attributes-changed signals.
        (webkit_web_view_init): Set the WebKitViewportAttributes instance.
        (webkit_web_view_get_viewport_attributes): Added a getter to obtain the WebKitViewportAttributes instance held by the given WebKitWebView.
        * webkit/webkitwebview.h:
        * webkit/webkitwebviewprivate.h: Added WebKitViewportAttributes as a private variable.
2010-12-09  Joone Hur  <joone@kldp.org>

         Reviewed by Martin Robinson.

         [GTK] Support for viewport meta tag
         https://bugs.webkit.org/show_bug.cgi?id=45443

         Add support for testing the viewport properties for WebKitGtk.

         * DumpRenderTree/LayoutTestController.cpp:
         (dumpConfigurationForViewportCallback): Added this JS callback to set the size of the visible viewport.
         (LayoutTestController::staticFunctions):
         * DumpRenderTree/LayoutTestController.h:
         * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
         (LayoutTestController::dumpConfigurationForViewport): Added this function to test the viewport properties.
         * DumpRenderTree/mac/LayoutTestControllerMac.mm:
         (LayoutTestController::dumpConfigurationForViewport): Ditto.
         * DumpRenderTree/qt/LayoutTestControllerQt.cpp:
         (LayoutTestController::dumpConfigurationForViewport): Ditto.
         * DumpRenderTree/win/LayoutTestControllerWin.cpp:
         (LayoutTestController::dumpConfigurationForViewport): Ditto.
         * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
         (LayoutTestController::dumpConfigurationForViewport): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73608 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bb594650
2010-12-09 Joone Hur <joone@kldp.org>
Reviewed by Martin Robinson.
[GTK] Support for viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=45443
Included viewport test cases for WebKitGtk
* platform/gtk/Skipped: Unskip fast/viewport except viewport-45.html.
2010-12-09 Yury Semikhatsky <yurys@chromium.org>
Reviewed by Pavel Feldman.
......
......@@ -5491,7 +5491,8 @@ fullscreen/
canvas/philip/tests/2d.path.isPointInPath.edge.html
# viewport meta tag support
fast/viewport
# https://bugs.webkit.org/show_bug.cgi?id=47481
fast/viewport/viewport-45.html
# Pre-HMTL5 parser quirks only apply to the mac port for now.
fast/parser/pre-html5-parser-quirks.html
......
2010-12-09 Joone Hur <joone@kldp.org>
Reviewed by Martin Robinson.
[GTK] Support for viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=45443
This patch adds a new gobject to offer the viewport properties to user agents.
It is WebKitViewportAttributes that contains the viewport size, initial scale with limits,
and information about whether a user is able to scale the contents in the viewport.
This feature was introduced by Safari on the iPhone. 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
* GNUmakefile.am: Added webkitviewportattributes.h webkitviewportattributes.cpp.
* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::dispatchViewportDataDidChange): Added this callback to know whether the viewport arguments is available.
* WebCoreSupport/ChromeClientGtk.h:
* WebCoreSupport/DumpRenderTreeSupportGtk.cpp:
(DumpRenderTreeSupportGtk::dumpConfigurationForViewport): Added this function to compute the viewport attributes with the given availableWidth and availableHeight.
* WebCoreSupport/DumpRenderTreeSupportGtk.h:
* WebCoreSupport/FrameLoaderClientGtk.cpp:
(WebKit::postCommitFrameViewSetup): Invalidate the viewport attributes.
* webkit/webkit.h:
* webkit/webkitdefines.h:
* webkit/webkitprivate.h: Added webkitViewportAttributesRecompute as a private function.
* webkit/webkitviewportattributes.cpp: Added.
(webkit_viewport_attributes_class_init):
(webkit_viewport_attributes_init):
(webkit_viewport_attributes_get_property):
(webkit_viewport_attributes_set_property):
(webkitViewportAttributesRecompute): Recompute the optimal viewport attributes and emit the viewport-attributes-changed signal.
(webkit_viewport_attributes_recompute): a public API for calling webkitViewportAttributesRecompute.
* webkit/webkitviewportattributes.h: Added.
* webkit/webkitwebview.cpp:
(webkit_web_view_get_property): Added PROP_VIEWPORT_ATTRIBUTES.
(webkit_web_view_dispose): Deallocate the WebKitViewportAttributes instance.
(webkit_web_view_class_init): Added the viewport-attributes-recompute-requested and viewport-attributes-changed signals.
(webkit_web_view_init): Set the WebKitViewportAttributes instance.
(webkit_web_view_get_viewport_attributes): Added a getter to obtain the WebKitViewportAttributes instance held by the given WebKitWebView.
* webkit/webkitwebview.h:
* webkit/webkitwebviewprivate.h: Added WebKitViewportAttributes as a private variable.
2010-12-09 Xan Lopez <xlopez@igalia.com>
Reviewed by Martin Robinson.
......
......@@ -119,6 +119,7 @@ webkitgtk_static_h_api += \
$(srcdir)/WebKit/gtk/webkit/webkitnetworkresponse.h \
$(srcdir)/WebKit/gtk/webkit/webkitsecurityorigin.h \
$(srcdir)/WebKit/gtk/webkit/webkitsoupauthdialog.h \
$(srcdir)/WebKit/gtk/webkit/webkitviewportattributes.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebbackforwardlist.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebdatabase.h \
$(srcdir)/WebKit/gtk/webkit/webkitwebdatasource.h \
......@@ -182,6 +183,7 @@ webkitgtk_sources += \
WebKit/gtk/webkit/webkitprivate.h \
WebKit/gtk/webkit/webkitsoupauthdialog.c \
WebKit/gtk/webkit/webkitversion.cpp \
WebKit/gtk/webkit/webkitviewportattributes.cpp \
WebKit/gtk/webkit/webkitwebbackforwardlist.cpp \
WebKit/gtk/webkit/webkitwebdatasource.cpp \
WebKit/gtk/webkit/webkitwebframe.cpp \
......
......@@ -24,6 +24,7 @@
#include "config.h"
#include "ChromeClientGtk.h"
#include "Chrome.h"
#include "Console.h"
#include "DumpRenderTreeSupportGtk.h"
#include "Element.h"
......@@ -617,6 +618,12 @@ void ChromeClient::chooseIconForFiles(const Vector<WTF::String>& filenames, WebC
chooser->iconLoaded(Icon::createIconForFiles(filenames));
}
void ChromeClient::dispatchViewportDataDidChange(const ViewportArguments& arguments) const
{
// Recompute the viewport attributes making it valid.
webkitViewportAttributesRecompute(webkit_web_view_get_viewport_attributes(m_webView));
}
void ChromeClient::setCursor(const Cursor&)
{
notImplemented();
......
......@@ -110,6 +110,8 @@ namespace WebKit {
virtual void setToolTip(const WTF::String&, WebCore::TextDirection);
virtual void dispatchViewportDataDidChange(const WebCore::ViewportArguments& arguments) const;
virtual void print(WebCore::Frame*);
#if ENABLE(DATABASE)
virtual void exceededDatabaseQuota(WebCore::Frame*, const WTF::String&);
......
/*
* Copyright (C) Research In Motion Limited 2010. All rights reserved.
* Copyright (C) 2010 Joone Hur <joone@kldp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -408,3 +409,15 @@ void DumpRenderTreeSupportGtk::layoutFrame(WebKitWebFrame* frame)
view->layout();
}
// For testing fast/viewport.
void DumpRenderTreeSupportGtk::dumpConfigurationForViewport(WebKitWebView* webView, gint availableWidth, gint availableHeight)
{
g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
ViewportArguments arguments = webView->priv->corePage->mainFrame()->document()->viewportArguments();
// desktopWidth = 980, deviceWidth = 320, deviceHeight = 480, deviceDPI = 160
ViewportAttributes attrs = computeViewportAttributes(arguments, 980, 320, 480, 160, IntSize(availableWidth, availableHeight));
fprintf(stdout, "viewport size %dx%d scale %f with limits [%f, %f]\n", attrs.layoutSize.width(), attrs.layoutSize.height(), attrs.initialScale, attrs.minimumScale, attrs.maximumScale);
}
......@@ -21,6 +21,7 @@
#include "JSStringRef.h"
#include <webkit/webkitdefines.h>
#include <atk/atk.h>
#include <glib.h>
......@@ -40,6 +41,7 @@ public:
static void setLinksIncludedInFocusChain(bool);
static bool linksIncludedInFocusChain();
static JSValueRef nodesFromRect(JSContextRef context, JSValueRef value, int x, int y, unsigned top, unsigned right, unsigned bottom, unsigned left, bool ignoreClipping);
static void dumpConfigurationForViewport(WebKitWebView* webView, gint availableWidth, gint availableHeight);
// FIXME: Move these to webkitwebframe.h once their API has been discussed.
static GSList* getFrameChildren(WebKitWebFrame* frame);
......
......@@ -1292,6 +1292,12 @@ static void postCommitFrameViewSetup(WebKitWebFrame *frame, FrameView *view, boo
WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(containingWindow);
view->setGtkAdjustments(priv->horizontalAdjustment.get(), priv->verticalAdjustment.get(), resetValues);
// Invalidate the viewport attributes - they will only be valid
// again if the page we're beginning to load now has an
// appropriate viewport meta tag.
containingWindow->priv->viewportAttributes->priv->isValid = FALSE;
g_object_notify(G_OBJECT(containingWindow->priv->viewportAttributes.get()), "valid");
if (priv->currentMenu) {
PlatformRefPtr<GtkMenu> menu(priv->currentMenu);
priv->currentMenu.clear();
......
......@@ -30,6 +30,7 @@
#include <webkit/webkitnetworkrequest.h>
#include <webkit/webkitnetworkresponse.h>
#include <webkit/webkitsoupauthdialog.h>
#include <webkit/webkitviewportattributes.h>
#include <webkit/webkitwebdatasource.h>
#include <webkit/webkitwebframe.h>
#include <webkit/webkitwebsettings.h>
......
......@@ -92,6 +92,9 @@ typedef struct _WebKitHitTestResultClass WebKitHitTestResultClass;
typedef struct _WebKitGeolocationPolicyDecision WebKitGeolocationPolicyDecision;
typedef struct _WebKitGeolocationPolicyDecisionClass WebKitGeolocationPolicyDecisionClass;
typedef struct _WebKitViewportAttributes WebKitViewportAttributes;
typedef struct _WebKitViewportAttributesClass WebKitViewportAttributesClass;
G_END_DECLS
#endif
......@@ -33,6 +33,7 @@
#include <webkit/webkitdownload.h>
#include <webkit/webkithittestresult.h>
#include <webkit/webkitnetworkrequest.h>
#include <webkit/webkitviewportattributes.h>
#include <webkit/webkitwebview.h>
#include <webkit/webkitwebdatasource.h>
#include <webkit/webkitwebframe.h>
......@@ -141,6 +142,25 @@ extern "C" {
gboolean disposed;
};
struct _WebKitViewportAttributesPrivate {
WebKitWebView* webView;
int deviceWidth;
int deviceHeight;
int availableWidth;
int availableHeight;
int desktopWidth;
int deviceDPI;
int width;
int height;
float initialScaleFactor;
float minimumScaleFactor;
float maximumScaleFactor;
float devicePixelRatio;
gboolean userScalable;
gboolean isValid;
};
WTF::String
webkitUserAgent();
......@@ -249,6 +269,9 @@ extern "C" {
WEBKIT_API WebKitWebDatabase *
webkit_security_origin_get_web_database(WebKitSecurityOrigin* securityOrigin, const char* databaseName);
// WebKitViewportAttributes private
void webkitViewportAttributesRecompute(WebKitViewportAttributes*);
}
#endif
This diff is collapsed.
/*
* Copyright (C) 2010 Joone Hur <joone@kldp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef webkitviewportattributes_h
#define webkitviewportattributes_h
#include <glib-object.h>
#include <webkit/webkitdefines.h>
G_BEGIN_DECLS
#define WEBKIT_TYPE_VIEWPORT_ATTRIBUTES (webkit_viewport_attributes_get_type())
#define WEBKIT_VIEWPORT_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_VIEWPORT_ATTRIBUTES, WebKitViewportAttributes))
#define WEBKIT_VIEWPORT_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_VIEWPORT_ATTRIBUTES, WebKitViewportAttributesClass))
#define WEBKIT_IS_VIEWPORT_ATTRIBUTES(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_VIEWPORT_ATTRIBUTES))
#define WEBKIT_IS_VIEWPORT_ATTRIBUTES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_VIEWPORT_ATTRIBUTES))
#define WEBKIT_VIEWPORT_ATTRIBUTES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_VIEWPORT_ATTRIBUTES, WebKitViewportAttributesClass))
typedef struct _WebKitViewportAttributesPrivate WebKitViewportAttributesPrivate;
struct _WebKitViewportAttributes {
GObject parent_instance;
/*< private >*/
WebKitViewportAttributesPrivate *priv;
};
struct _WebKitViewportAttributesClass {
GObjectClass parent_class;
/* Padding for future expansion */
void (*_webkit_reserved0) (void);
void (*_webkit_reserved1) (void);
void (*_webkit_reserved2) (void);
void (*_webkit_reserved3) (void);
};
WEBKIT_API GType
webkit_viewport_attributes_get_type (void);
WEBKIT_API void
webkit_viewport_attributes_recompute(WebKitViewportAttributes* viewportAttributes);
G_END_DECLS
#endif
......@@ -10,6 +10,7 @@
* Copyright (C) 2009, 2010 Igalia S.L.
* Copyright (C) 2009 Movial Creative Technologies Inc.
* Copyright (C) 2009 Bobby Powers
* Copyright (C) 2010 Joone Hur <joone@kldp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -174,7 +175,6 @@ enum {
GEOLOCATION_POLICY_DECISION_CANCELLED,
ONLOAD_EVENT,
FRAME_CREATED,
SHOULD_BEGIN_EDITING,
SHOULD_END_EDITING,
SHOULD_INSERT_NODE,
......@@ -186,6 +186,8 @@ enum {
EDITING_BEGAN,
USER_CHANGED_CONTENTS,
EDITING_ENDED,
VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED,
VIEWPORT_ATTRIBUTES_CHANGED,
LAST_SIGNAL
};
......@@ -200,6 +202,7 @@ enum {
PROP_EDITABLE,
PROP_SETTINGS,
PROP_WEB_INSPECTOR,
PROP_VIEWPORT_ATTRIBUTES,
PROP_WINDOW_FEATURES,
PROP_TRANSPARENT,
PROP_ZOOM_LEVEL,
......@@ -525,6 +528,9 @@ static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue*
case PROP_WEB_INSPECTOR:
g_value_set_object(value, webkit_web_view_get_inspector(webView));
break;
case PROP_VIEWPORT_ATTRIBUTES:
g_value_set_object(value, webkit_web_view_get_viewport_attributes(webView));
break;
case PROP_WINDOW_FEATURES:
g_value_set_object(value, webkit_web_view_get_window_features(webView));
break;
......@@ -1372,6 +1378,7 @@ static void webkit_web_view_dispose(GObject* object)
}
priv->webInspector.clear();
priv->viewportAttributes.clear();
priv->webWindowFeatures.clear();
priv->mainResource.clear();
priv->subResources.clear();
......@@ -2734,6 +2741,55 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
G_TYPE_FROM_CLASS(webViewClass), static_cast<GSignalFlags>(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION), 0, 0, 0,
g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
/*
* WebKitWebView::viewport-attributes-recompute-requested
* @web_view: the object which received the signal
* @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
*
* The #WebKitWebView::viewport-attributes-recompute-requested
* signal will be emitted when a page with a viewport meta tag
* loads and when webkit_viewport_attributes_recompute is called.
*
* The #WebKitViewportAttributes will have device size, available size,
* desktop width, and device DPI pre-filled by values that make sense
* for the current screen and widget, but you can override those values
* if you have special requirements (for instance, if you made your
* widget bigger than the available visible area, you should override
* the available-width and available-height properties to the actual
* visible area).
*
* Since: 1.3.8
*/
webkit_web_view_signals[VIEWPORT_ATTRIBUTES_RECOMPUTE_REQUESTED] = g_signal_new("viewport-attributes-recompute-requested",
G_TYPE_FROM_CLASS(webViewClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
0,
0, 0,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
/*
* WebKitWebView::viewport-attributes-changed
* @web_view: the object which received the signal
* @viewport_attributes: the #WebKitViewportAttributes which has the viewport attributes.
*
* The #WebKitWebView::viewport-attributes-changed signal will be emitted
* after the emission of #WebKitWebView::viewport-attributes-recompute-requested
* and the subsequent viewport attribute recomputation. At this point,
* if the #WebKitViewportAttributes are valid, the viewport attributes are available.
*
* Since: 1.3.8
*/
webkit_web_view_signals[VIEWPORT_ATTRIBUTES_CHANGED] = g_signal_new("viewport-attributes-changed",
G_TYPE_FROM_CLASS(webViewClass),
(GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
0,
0, 0,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE, 1,
WEBKIT_TYPE_VIEWPORT_ATTRIBUTES);
/*
* implementations of virtual methods
*/
......@@ -2977,6 +3033,20 @@ static void webkit_web_view_class_init(WebKitWebViewClass* webViewClass)
WEBKIT_TYPE_WEB_INSPECTOR,
WEBKIT_PARAM_READABLE));
/**
* WebKitWebView:viewport-attributes:
*
* The associated #WebKitViewportAttributes instance.
*
* Since: 1.3.8
*/
g_object_class_install_property(objectClass, PROP_VIEWPORT_ATTRIBUTES,
g_param_spec_object("viewport-attributes",
_("Viewport Attributes"),
_("The associated WebKitViewportAttributes instance"),
WEBKIT_TYPE_VIEWPORT_ATTRIBUTES,
WEBKIT_PARAM_READABLE));
/**
* WebKitWebView:window-features:
*
......@@ -3404,6 +3474,10 @@ static void webkit_web_view_init(WebKitWebView* webView)
priv->webInspector = adoptPlatformRef(WEBKIT_WEB_INSPECTOR(g_object_new(WEBKIT_TYPE_WEB_INSPECTOR, NULL)));
webkit_web_inspector_set_inspector_client(priv->webInspector.get(), priv->corePage);
// And our ViewportAttributes friend.
priv->viewportAttributes = adoptPlatformRef(WEBKIT_VIEWPORT_ATTRIBUTES(g_object_new(WEBKIT_TYPE_VIEWPORT_ATTRIBUTES, NULL)));
priv->viewportAttributes->priv->webView = webView;
// The smart pointer will call g_object_ref_sink on these adjustments.
priv->horizontalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
priv->verticalAdjustment = GTK_ADJUSTMENT(gtk_adjustment_new(0.0, 0.0, 0.0, 0.0, 0.0, 0.0));
......@@ -3543,6 +3617,29 @@ WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView)
return webView->priv->webInspector.get();
}
/**
* webkit_web_view_get_viewport_attributes:
* @webView: a #WebKitWebView
*
* Obtains the #WebKitViewportAttributes associated with the
* #WebKitWebView. Every #WebKitWebView object has a
* #WebKitWebViewporAttributes object attached to it as soon as it is
* created, so this function will only return NULL if the argument is
* not a valid #WebKitWebView. Do note however that the viewport
* attributes object only contains valid information when the current
* page has a viewport meta tag. You can check whether the data should
* be used by checking the #WebKitViewport:valid property.
*
* Return value: (transfer none): the #WebKitViewportAttributes instance.
*
* Since: 1.3.8
*/
WebKitViewportAttributes* webkit_web_view_get_viewport_attributes(WebKitWebView* webView)
{
g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
return webView->priv->viewportAttributes.get();
}
// internal
static void webkit_web_view_set_window_features(WebKitWebView* webView, WebKitWebWindowFeatures* webWindowFeatures)
{
......
......@@ -427,6 +427,9 @@ webkit_get_cache_model (void);
WEBKIT_API WebKitDOMDocument *
webkit_web_view_get_dom_document (WebKitWebView *webView);
WEBKIT_API WebKitViewportAttributes*
webkit_web_view_get_viewport_attributes (WebKitWebView *webView);
G_END_DECLS
#endif
......@@ -54,6 +54,7 @@ struct _WebKitWebViewPrivate {
WebCore::Page* corePage;
PlatformRefPtr<WebKitWebSettings> webSettings;
PlatformRefPtr<WebKitWebInspector> webInspector;
PlatformRefPtr<WebKitViewportAttributes> viewportAttributes;
PlatformRefPtr<WebKitWebWindowFeatures> webWindowFeatures;
WebKitWebFrame* mainFrame;
......
2010-12-09 Joone Hur <joone@kldp.org>
Reviewed by Martin Robinson.
[GTK] Support for viewport meta tag
https://bugs.webkit.org/show_bug.cgi?id=45443
Add support for testing the viewport properties for WebKitGtk.
* DumpRenderTree/LayoutTestController.cpp:
(dumpConfigurationForViewportCallback): Added this JS callback to set the size of the visible viewport.
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::dumpConfigurationForViewport): Added this function to test the viewport properties.
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::dumpConfigurationForViewport): Ditto.
* DumpRenderTree/qt/LayoutTestControllerQt.cpp:
(LayoutTestController::dumpConfigurationForViewport): Ditto.
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::dumpConfigurationForViewport): Ditto.
* DumpRenderTree/wx/LayoutTestControllerWx.cpp:
(LayoutTestController::dumpConfigurationForViewport): Ditto.
2010-12-08 William Siegrist <wsiegrist@apple.com>
Reviewed by Eric Seidel.
......
/*
* Copyright (C) 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2010 Joone Hur <joone@kldp.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -140,6 +141,22 @@ static JSValueRef dumpChildFrameScrollPositionsCallback(JSContextRef context, JS
return JSValueMakeUndefined(context);
}
static JSValueRef dumpConfigurationForViewportCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 2)
return JSValueMakeUndefined(context);
double availableWidth = JSValueToNumber(context, arguments[0], exception);
ASSERT(!*exception);
double availableHeight = JSValueToNumber(context, arguments[1], exception);
ASSERT(!*exception);
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
controller->dumpConfigurationForViewport(static_cast<int>(availableWidth), static_cast<int>(availableHeight));
return JSValueMakeUndefined(context);
}
static JSValueRef dumpDatabaseCallbacksCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
......@@ -1914,6 +1931,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "dumpBackForwardList", dumpBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpChildFrameScrollPositions", dumpChildFrameScrollPositionsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpChildFramesAsText", dumpChildFramesAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpConfigurationForViewport", dumpConfigurationForViewportCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpDOMAsWebArchive", dumpDOMAsWebArchiveCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpDatabaseCallbacks", dumpDatabaseCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "dumpEditingCallbacks", dumpEditingCallbacksCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
......
......@@ -285,6 +285,8 @@ public:
bool hasSpellingMarker(int from, int length);
void dumpConfigurationForViewport(int availableWidth, int availableHeight);
// The following API test functions should probably be moved to platform-specific
// unit tests outside of DRT once they exist.
void apiTestNewWindowDataLoadBaseURL(JSStringRef utf8Data, JSStringRef baseURL);
......
......@@ -4,6 +4,7 @@
* Copyright (C) 2008 Nuanti Ltd.
* Copyright (C) 2009 Jan Michael Alonzo <jmalonzo@gmail.com>
* Copyright (C) 2009 Collabora Ltd.
* Copyright (C) 2010 Joone Hur <joone@kldp.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
......@@ -819,3 +820,10 @@ bool LayoutTestController::hasSpellingMarker(int, int)
// FIXME: Implement this.
return false;
}
void LayoutTestController::dumpConfigurationForViewport(int availableWidth, int availableHeight)
{
WebKitWebView* webView = webkit_web_frame_get_web_view(mainFrame);
ASSERT(webView);
DumpRenderTreeSupportGtk::dumpConfigurationForViewport(webView, availableWidth, availableHeight);
}
......@@ -989,3 +989,7 @@ bool LayoutTestController::hasSpellingMarker(int from, int length)
{
return [mainFrame hasSpellingMarker:from length:length];
}
void LayoutTestController::dumpConfigurationForViewport(int /*availableWidth*/, int /*availableHeight*/)
{
}
......@@ -1415,3 +1415,8 @@ bool LayoutTestController::hasSpellingMarker(int from, int length)
return false;
return ret;
}
void LayoutTestController::dumpConfigurationForViewport(int /*availableWidth*/, int /*availableHeight*/)
{
// FIXME: Implement this.
}
......@@ -511,6 +511,11 @@ bool LayoutTestController::hasSpellingMarker(int, int)
return false;
}
void LayoutTestController::dumpConfigurationForViewport(int /*availableWidth*/, int /*availableHeight*/)
{
// FIXME: Implement
}
JSRetainPtr<JSStringRef> LayoutTestController::pageProperty(const char* propertyName, int pageNumber) const
{
// FIXME: Implement
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment