summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/API/qt
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-09-10 19:10:20 +0200
commit284837daa07b29d6a63a748544a90b1f5842ac5c (patch)
treeecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/WebKit2/UIProcess/API/qt
parent2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff)
downloadqtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/WebKit2/UIProcess/API/qt')
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h1
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp411
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h12
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h17
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp63
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h16
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp28
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h5
-rw-r--r--Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h3
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp21
-rw-r--r--Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h4
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h2
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_devicePixelRatio.qml62
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml11
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml7
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml11
-rw-r--r--Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp2
17 files changed, 542 insertions, 134 deletions
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
index ad1c6ad3f..c7ac86c3d 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebpage_p_p.h
@@ -26,7 +26,6 @@
namespace WebKit {
class WebPageProxy;
-class QtViewportHandler;
class QtWebPageEventHandler;
}
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
index 921586d1b..490b9ba7c 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview.cpp
@@ -23,9 +23,9 @@
#include "DownloadProxy.h"
#include "DrawingAreaProxyImpl.h"
+#include "PageViewportControllerClientQt.h"
#include "QtDialogRunner.h"
#include "QtDownloadManager.h"
-#include "QtViewportHandler.h"
#include "QtWebContext.h"
#include "QtWebError.h"
#include "QtWebIconDatabaseClient.h"
@@ -272,6 +272,7 @@ QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport)
, m_navigatorQtObjectEnabled(false)
, m_renderToOffscreenBuffer(false)
, m_allowAnyHTTPSCertificateForLocalHost(false)
+ , m_customDevicePixelRatio(0)
, m_loadProgress(0)
{
viewport->setClip(true);
@@ -325,8 +326,9 @@ void QQuickWebViewPrivate::initialize(WKContextRef contextRef, WKPageGroupRef pa
void QQuickWebViewPrivate::onComponentComplete()
{
Q_Q(QQuickWebView);
- m_viewportHandler.reset(new QtViewportHandler(webPageProxy.get(), q, pageView.data()));
- pageView->eventHandler()->setViewportHandler(m_viewportHandler.data());
+ m_pageViewportControllerClient.reset(new PageViewportControllerClientQt(q, pageView.data()));
+ m_pageViewportController.reset(new PageViewportController(webPageProxy.get(), m_pageViewportControllerClient.data()));
+ pageView->eventHandler()->setViewportController(m_pageViewportControllerClient.data());
}
void QQuickWebViewPrivate::setTransparentBackground(bool enable)
@@ -473,7 +475,10 @@ void QQuickWebViewPrivate::didRelaunchProcess()
{
qWarning("WARNING: The web process has been successfully restarted.");
+ // Reset to default so that the later update can reach the web process.
+ webPageProxy->setCustomDeviceScaleFactor(0);
webPageProxy->drawingArea()->setSize(viewSize(), IntSize());
+
updateViewportSize();
updateUserScripts();
}
@@ -789,6 +794,20 @@ void QQuickWebViewPrivate::didReceiveMessageFromNavigatorQtObject(const String&
emit q_ptr->experimental()->messageReceived(variantMap);
}
+void QQuickWebViewPrivate::didChangeContentsSize(const QSize& newSize)
+{
+ if (newSize.isEmpty() || !m_customDevicePixelRatio || webPageProxy->deviceScaleFactor() == m_customDevicePixelRatio)
+ return;
+
+ // DrawingAreaProxy returns early if the page size is empty
+ // and the device pixel ratio property is propagated from QML
+ // before the QML page item has a valid size yet, thus the
+ // information would not reach the web process.
+ // Set the custom device pixel ratio requested from QML as soon
+ // as the content item has a valid size.
+ webPageProxy->setCustomDeviceScaleFactor(m_customDevicePixelRatio);
+}
+
QQuickWebViewLegacyPrivate::QQuickWebViewLegacyPrivate(QQuickWebView* viewport)
: QQuickWebViewPrivate(viewport)
{
@@ -836,11 +855,6 @@ QQuickWebViewFlickablePrivate::QQuickWebViewFlickablePrivate(QQuickWebView* view
viewport->setAcceptHoverEvents(false);
}
-QQuickWebViewFlickablePrivate::~QQuickWebViewFlickablePrivate()
-{
- m_viewportHandler->disconnect();
-}
-
void QQuickWebViewFlickablePrivate::initialize(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
{
QQuickWebViewPrivate::initialize(contextRef, pageGroupRef);
@@ -856,28 +870,29 @@ void QQuickWebViewFlickablePrivate::onComponentComplete()
void QQuickWebViewFlickablePrivate::didChangeViewportProperties(const WebCore::ViewportAttributes& newAttributes)
{
- if (m_viewportHandler)
- m_viewportHandler->viewportAttributesChanged(newAttributes);
+ if (m_pageViewportController)
+ m_pageViewportController->didChangeViewportAttributes(newAttributes);
}
void QQuickWebViewFlickablePrivate::updateViewportSize()
{
- // FIXME: Examine why there is not an viewportHandler here in the beginning.
- if (m_viewportHandler)
- m_viewportHandler->viewportItemSizeChanged();
+ Q_Q(QQuickWebView);
+
+ if (m_pageViewportController)
+ m_pageViewportController->setViewportSize(QSizeF(q->width(), q->height()));
}
void QQuickWebViewFlickablePrivate::pageDidRequestScroll(const QPoint& pos)
{
- m_viewportHandler->pageContentPositionRequested(pos);
+ if (m_pageViewportController)
+ m_pageViewportController->pageDidRequestScroll(pos);
}
void QQuickWebViewFlickablePrivate::didChangeContentsSize(const QSize& newSize)
{
- Q_Q(QQuickWebView);
-
pageView->setContentsSize(newSize); // emits contentsSizeChanged()
- m_viewportHandler->pageContentsSizeChanged(newSize, q->boundingRect().size().toSize());
+ QQuickWebViewPrivate::didChangeContentsSize(newSize);
+ m_pageViewportController->didChangeContentsSize(newSize);
}
void QQuickWebViewFlickablePrivate::handleMouseEvent(QMouseEvent* event)
@@ -889,22 +904,6 @@ void QQuickWebViewFlickablePrivate::handleMouseEvent(QMouseEvent* event)
pageView->eventHandler()->handleInputEvent(event);
}
-/*!
- \qmlsignal WebView::onNavigationRequested(WebNavigationRequest request)
-
- This signal is emitted for every navigation request. The request object contains url,
- button and modifiers properties describing the navigation action, e.g. "a middle click
- with shift key pressed to 'http://qt-project.org'".
-
- The navigation will be accepted by default. To change that, one can set the action
- property to WebView.IgnoreRequest to reject the request or WebView.DownloadRequest to
- trigger a download instead of navigating to the url.
-
- The request object cannot be used after the signal handler function ends.
-
- \sa WebNavigationRequest
-*/
-
QQuickWebViewExperimental::QQuickWebViewExperimental(QQuickWebView *webView)
: QObject(webView)
, q_ptr(webView)
@@ -1233,19 +1232,23 @@ void QQuickWebViewExperimental::setUserAgent(const QString& userAgent)
down but still provide a better looking image.
*/
-double QQuickWebViewExperimental::devicePixelRatio() const
+qreal QQuickWebViewExperimental::devicePixelRatio() const
{
Q_D(const QQuickWebView);
+
+ if (d->m_customDevicePixelRatio)
+ return d->m_customDevicePixelRatio;
+
return d->webPageProxy->deviceScaleFactor();
}
-void QQuickWebViewExperimental::setDevicePixelRatio(double devicePixelRatio)
+void QQuickWebViewExperimental::setDevicePixelRatio(qreal devicePixelRatio)
{
Q_D(QQuickWebView);
- if (devicePixelRatio == this->devicePixelRatio())
+ if (0 >= devicePixelRatio || devicePixelRatio == this->devicePixelRatio())
return;
- d->webPageProxy->setCustomDeviceScaleFactor(devicePixelRatio);
+ d->m_customDevicePixelRatio = devicePixelRatio;
emit devicePixelRatioChanged();
}
@@ -1427,13 +1430,55 @@ QQuickWebPage* QQuickWebViewExperimental::page()
}
/*!
- \qmlclass WebView QWebView
- \inqmlmodule QtWebKit 3.0
+ \page index.html
+
+ \title QtWebKit: QML WebView version 3.0
+
+ The WebView API allows QML applications to render regions of dynamic
+ web content. A \e{WebView} component may share the screen with other
+ QML components or encompass the full screen as specified within the
+ QML application.
+
+ QML WebView version 3.0 is incompatible with previous QML WebView API
+ versions. It allows an application to load pages into the WebView,
+ either by URL or with an HTML string, and navigate within session
+ history. By default, links to different pages load within the same
+ WebView, but applications may intercept requests to delegate links to
+ other functions.
+
+ This sample QML application loads a web page, responds to session
+ history context, and intercepts requests for external links:
+
+ \code
+ import QtQuick 2.0
+ import QtWebKit 3.0
+
+ Page {
+ WebView {
+ id: webview
+ url: "http://qt-project.org"
+ width: parent.width
+ height: parent.height
+ onNavigationRequested: {
+ // detect URL scheme prefix, most likely an external link
+ var schemaRE = /^\w+:/;
+ if (schemaRE.test(request.url)) {
+ request.action = WebView.AcceptRequest;
+ } else {
+ request.action = WebView.IgnoreRequest;
+ // delegate request.url here
+ }
+ }
+ }
+ }
+ \endcode
*/
+
/*!
- \qmlmethod WebView(Item parent)
- \brief Constructs a WebView with a parent.
+ \qmltype WebView
+ \inqmlmodule QtWebKit 3.0
+ \brief A WebView renders web content within a QML application
*/
QQuickWebView::QQuickWebView(QQuickItem* parent)
@@ -1464,24 +1509,49 @@ QQuickWebPage* QQuickWebView::page()
return d->pageView.data();
}
+/*!
+ \qmlmethod void WebView::goBack()
+
+ Go backward within the browser's session history, if possible.
+ (Equivalent to the \c{window.history.back()} DOM method.)
+
+ \sa WebView::canGoBack
+*/
void QQuickWebView::goBack()
{
Q_D(QQuickWebView);
d->webPageProxy->goBack();
}
+/*!
+ \qmlmethod void WebView::goForward()
+
+ Go forward within the browser's session history, if possible.
+ (Equivalent to the \c{window.history.forward()} DOM method.)
+*/
void QQuickWebView::goForward()
{
Q_D(QQuickWebView);
d->webPageProxy->goForward();
}
+/*!
+ \qmlmethod void WebView::stop()
+
+ Stop loading the current page.
+*/
void QQuickWebView::stop()
{
Q_D(QQuickWebView);
d->webPageProxy->stopLoading();
}
+/*!
+ \qmlmethod void WebView::reload()
+
+ Reload the current page. (Equivalent to the
+ \c{window.location.reload()} DOM method.)
+*/
void QQuickWebView::reload()
{
Q_D(QQuickWebView);
@@ -1502,6 +1572,15 @@ void QQuickWebView::reload()
d->webPageProxy->reload(reloadFromOrigin);
}
+/*!
+ \qmlproperty url WebView::url
+
+ The location of the currently displaying HTML page. This writable
+ property offers the main interface to load a page into a web view.
+ It functions the same as the \c{window.location} DOM property.
+
+ \sa WebView::loadHtml()
+*/
QUrl QQuickWebView::url() const
{
Q_D(const QQuickWebView);
@@ -1535,6 +1614,24 @@ void QQuickWebView::emitUrlChangeIfNeeded()
}
}
+/*!
+ \qmlproperty url WebView::icon
+
+ The location of the currently displaying Web site icon, also known as favicon
+ or shortcut icon. This read-only URL corresponds to the image used within a
+ mobile browser application to represent a bookmarked page on the device's home
+ screen.
+
+ This example uses the \c{icon} property to build an \c{Image} element:
+
+ \code
+ Image {
+ id: appIcon
+ source: webView.icon != "" ? webView.icon : "fallbackFavIcon.png";
+ ...
+ }
+ \endcode
+*/
QUrl QQuickWebView::icon() const
{
Q_D(const QQuickWebView);
@@ -1543,23 +1640,34 @@ QUrl QQuickWebView::icon() const
/*!
\qmlproperty int WebView::loadProgress
- \brief The progress of loading the current web page.
- The range is from 0 to 100.
+ The amount of the page that has been loaded, expressed as an integer
+ percentage in the range from \c{0} to \c{100}.
*/
-
int QQuickWebView::loadProgress() const
{
Q_D(const QQuickWebView);
return d->loadProgress();
}
+/*!
+ \qmlproperty bool WebView::canGoBack
+
+ Returns \c{true} if there are prior session history entries, \c{false}
+ otherwise.
+*/
bool QQuickWebView::canGoBack() const
{
Q_D(const QQuickWebView);
return d->webPageProxy->canGoBack();
}
+/*!
+ \qmlproperty bool WebView::canGoForward
+
+ Returns \c{true} if there are subsequent session history entries,
+ \c{false} otherwise.
+*/
bool QQuickWebView::canGoForward() const
{
Q_D(const QQuickWebView);
@@ -1568,9 +1676,9 @@ bool QQuickWebView::canGoForward() const
/*!
\qmlproperty bool WebView::loading
- \brief True if the web view is currently loading a web page, false otherwise.
-*/
+ Returns \c{true} if the HTML page is currently loading, \c{false} otherwise.
+*/
bool QQuickWebView::loading() const
{
Q_D(const QQuickWebView);
@@ -1619,9 +1727,10 @@ QRectF QQuickWebView::mapRectFromWebContent(const QRectF& rectInCSSCoordinates)
/*!
\qmlproperty string WebView::title
- \brief The title of the loaded page.
-*/
+ The title of the currently displaying HTML page, a read-only value
+ that reflects the contents of the \c{<title>} tag.
+*/
QString QQuickWebView::title() const
{
Q_D(const QQuickWebView);
@@ -1657,7 +1766,7 @@ QVariant QQuickWebView::inputMethodQuery(Qt::InputMethodQuery property) const
}
/*!
- \preliminary
+ internal
The experimental module consisting on experimental API which will break
from version to version.
@@ -1901,8 +2010,14 @@ void QQuickWebView::handleFlickableMouseRelease(const QPointF& position, qint64
\qmlmethod void WebView::loadHtml(string html, url baseUrl, url unreachableUrl)
\brief Loads the specified \a html as the content of the web view.
+ (This method offers a lower-level alternative to the \c{url} property,
+ which references HTML pages via URL.)
+
External objects such as stylesheets or images referenced in the HTML
- document are located relative to \a baseUrl.
+ document are located relative to \a baseUrl. For example if provided \a html
+ was originally retrieved from \c http://www.example.com/documents/overview.html
+ and that was the base url, then an image referenced with the relative url \c diagram.png
+ would be looked for at \c{http://www.example.com/documents/diagram.png}.
If an \a unreachableUrl is passed it is used as the url for the loaded
content. This is typically used to display error pages for a failed
@@ -1955,5 +2070,201 @@ void QQuickWebView::setAllowAnyHTTPSCertificateForLocalHost(bool allow)
d->m_allowAnyHTTPSCertificateForLocalHost = allow;
}
+/*!
+ \qmlsignal WebView::onLoadingChanged(loadRequest)
+
+ Occurs when any page load begins, ends, or fails. Various read-only
+ parameters are available on the \a loadRequest:
+
+ \list
+
+ \li \c{url}: the location of the resource that is loading.
+
+ \li \c{status}: Reflects one of three load states:
+ \c{LoadStartedStatus}, \c{LoadSucceededStatus}, or
+ \c{LoadFailedStatus}. See \c{WebView::LoadStatus}.
+
+ \li \c{errorString}: description of load error.
+
+ \li \c{errorCode}: HTTP error code.
+
+ \li \c{errorDomain}: high-level error types, one of
+ \c{NetworkErrorDomain}, \c{HttpErrorDomain}, \c{InternalErrorDomain},
+ \c{DownloadErrorDomain}, or \c{NoErrorDomain}. See
+ \l{WebView::ErrorDomain}.
+
+ \endlist
+
+ \sa WebView::loading
+*/
+
+/*!
+ \qmlsignal WebView::onLinkHovered(hoveredUrl, hoveredTitle)
+
+ Within a mouse-driven interface, this signal is emitted when a mouse
+ pointer passes over a link, corresponding to the \c{mouseover} DOM
+ event. (May also occur in touch interfaces for \c{mouseover} events
+ that are not cancelled with \c{preventDefault()}.) The \a{hoveredUrl}
+ provides the link's location, and the \a{hoveredTitle} is any avalable
+ link text.
+*/
+
+/*!
+ \qmlsignal WebView::onNavigationRequested(request)
+
+ Occurs for various kinds of navigation. If the application listens
+ for this signal, it must set the \c{request.action} to either of the
+ following \l{WebView::NavigationRequestAction} enum values:
+
+ \list
+
+ \li \c{AcceptRequest}: Allow navigation to external pages within the
+ web view. This represents the default behavior when no listener is
+ active.
+
+ \li \c{IgnoreRequest}: Suppress navigation to new pages within the web
+ view. (The listener may then delegate navigation externally to
+ the browser application.)
+
+ \endlist
+
+ The \a{request} also provides the following read-only values:
+
+ \list
+
+ \li \c{url}: The location of the requested page.
+
+ \li \c{navigationType}: contextual information, one of
+ \c{LinkClickedNavigation}, \c{BackForwardNavigation},
+ \c{ReloadNavigation}, \c{FormSubmittedNavigation},
+ \c{FormResubmittedNavigation}, or \c{OtherNavigation} enum values.
+ See \l{WebView::NavigationType}.
+
+ \li \c{keyboardModifiers}: potential states for \l{Qt::KeyboardModifier}.
+
+ \li \c{mouseButton}: potential states for \l{Qt::MouseButton}.
+
+ \endlist
+*/
+
+/*!
+ \qmlproperty enumeration WebView::ErrorDomain
+
+ Details various high-level error types.
+
+ \table
+
+ \header
+ \li Constant
+ \li Description
+
+ \row
+ \li InternalErrorDomain
+ \li Content fails to be interpreted by QtWebKit.
+
+ \row
+ \li NetworkErrorDomain
+ \li Error results from faulty network connection.
+
+ \row
+ \li HttpErrorDomain
+ \li Error is produced by server.
+
+ \row
+ \li DownloadErrorDomain
+ \li Error in saving file.
+
+ \row
+ \li NoErrorDomain
+ \li Unspecified fallback error.
+
+ \endtable
+*/
+
+/*!
+ \qmlproperty enumeration WebView::NavigationType
+
+ Distinguishes context for various navigation actions.
+
+ \table
+
+ \header
+ \li Constant
+ \li Description
+
+ \row
+ \li LinkClickedNavigation
+ \li Navigation via link.
+
+ \row
+ \li FormSubmittedNavigation
+ \li Form data is posted.
+
+ \row
+ \li BackForwardNavigation
+ \li Navigation back and forth within session history.
+
+ \row
+ \li ReloadNavigation
+ \li The current page is reloaded.
+
+ \row
+ \li FormResubmittedNavigation
+ \li Form data is re-posted.
+
+ \row
+ \li OtherNavigation
+ \li Unspecified fallback method of navigation.
+
+ \endtable
+*/
+
+/*!
+ \qmlproperty enumeration WebView::LoadStatus
+
+ Reflects a page's load status.
+
+ \table
+
+ \header
+ \li Constant
+ \li Description
+
+ \row
+ \li LoadStartedStatus
+ \li Page is currently loading.
+
+ \row
+ \li LoadSucceededStatus
+ \li Page has successfully loaded, and is not currently loading.
+
+ \row
+ \li LoadFailedStatus
+ \li Page has failed to load, and is not currently loading.
+
+ \endtable
+*/
+
+/*!
+ \qmlproperty enumeration WebView::NavigationRequestAction
+
+ Specifies a policy when navigating a link to an external page.
+
+ \table
+
+ \header
+ \li Constant
+ \li Description
+
+ \row
+ \li AcceptRequest
+ \li Allow navigation to external pages within the web view.
+
+ \row
+ \li IgnoreRequest
+ \li Suppress navigation to new pages within the web view.
+
+ \endtable
+*/
#include "moc_qquickwebview_p.cpp"
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
index 8d0f4ffb9..68e5fca30 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p.h
@@ -48,8 +48,8 @@ class PlatformWebView;
}
namespace WebKit {
-class QtRefCountedNetworkRequestData;
-class QtViewportHandler;
+struct QtRefCountedNetworkRequestData;
+class PageViewportControllerClientQt;
class QtWebPageLoadClient;
class QtWebPagePolicyClient;
class QtWebPageUIClient;
@@ -217,7 +217,7 @@ private:
QQuickWebViewExperimental* m_experimental;
friend class QWebKitTest;
- friend class WebKit::QtViewportHandler;
+ friend class WebKit::PageViewportControllerClientQt;
friend class WebKit::QtWebPageLoadClient;
friend class WebKit::QtWebPagePolicyClient;
friend class WebKit::QtWebPageUIClient;
@@ -255,7 +255,7 @@ class QWEBKIT_EXPORT QQuickWebViewExperimental : public QObject {
Q_PROPERTY(int preferredMinimumContentsWidth WRITE setPreferredMinimumContentsWidth READ preferredMinimumContentsWidth NOTIFY preferredMinimumContentsWidthChanged)
Q_PROPERTY(int deviceWidth WRITE setDeviceWidth READ deviceWidth NOTIFY deviceWidthChanged)
Q_PROPERTY(int deviceHeight WRITE setDeviceHeight READ deviceHeight NOTIFY deviceHeightChanged)
- Q_PROPERTY(double devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
+ Q_PROPERTY(qreal devicePixelRatio READ devicePixelRatio WRITE setDevicePixelRatio NOTIFY devicePixelRatioChanged)
Q_PROPERTY(QWebNavigationHistory* navigationHistory READ navigationHistory CONSTANT FINAL)
@@ -312,8 +312,8 @@ public:
void setDeviceWidth(int);
int deviceHeight() const;
void setDeviceHeight(int);
- double devicePixelRatio() const;
- void setDevicePixelRatio(double);
+ qreal devicePixelRatio() const;
+ void setDevicePixelRatio(qreal);
QList<QUrl> userScripts() const;
void setUserScripts(const QList<QUrl>& userScripts);
QUrl remoteInspectorUrl() const;
diff --git a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
index d8a88f8c9..d1d3d9e88 100644
--- a/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qquickwebview_p_p.h
@@ -21,13 +21,13 @@
#ifndef qquickwebview_p_p_h
#define qquickwebview_p_p_h
+#include "PageViewportController.h"
+#include "PageViewportControllerClient.h"
#include "QtPageClient.h"
#include "QtWebPageUIClient.h"
#include "QtWebUndoController.h"
-
#include "qquickwebview_p.h"
#include "qquickwebpage_p.h"
-
#include <QtCore/QElapsedTimer>
#include <QtCore/QObject>
#include <QtCore/QScopedPointer>
@@ -39,7 +39,7 @@ namespace WebKit {
class DownloadProxy;
class DrawingAreaProxy;
class QtDialogRunner;
-class QtViewportHandler;
+class PageViewportControllerClientQt;
class QtWebContext;
class QtWebError;
class QtWebPageLoadClient;
@@ -87,7 +87,7 @@ public:
int loadProgress() const { return m_loadProgress; }
void setNeedsDisplay();
- virtual WebKit::QtViewportHandler* viewportHandler() { return 0; }
+ WebKit::PageViewportController* viewportController() const { return m_pageViewportController.data(); }
virtual void updateViewportSize() { }
void updateTouchViewportSize();
@@ -128,7 +128,7 @@ public:
WebCore::IntSize viewSize() const;
void didReceiveMessageFromNavigatorQtObject(const String& message);
virtual void pageDidRequestScroll(const QPoint& pos) { }
- virtual void didChangeContentsSize(const QSize& newSize) { }
+ virtual void didChangeContentsSize(const QSize& newSize);
void processDidCrash();
void didRelaunchProcess();
PassOwnPtr<WebKit::DrawingAreaProxy> createDrawingAreaProxy();
@@ -170,7 +170,9 @@ protected:
QScopedPointer<QQuickWebPage> pageView;
QQuickWebView* q_ptr;
- QScopedPointer<WebKit::QtViewportHandler> m_viewportHandler;
+ QScopedPointer<WebKit::PageViewportController> m_pageViewportController;
+ QScopedPointer<WebKit::PageViewportControllerClientQt> m_pageViewportControllerClient;
+
FlickableAxisLocker axisLocker;
QQmlComponent* alertDialog;
@@ -190,6 +192,7 @@ protected:
bool m_navigatorQtObjectEnabled;
bool m_renderToOffscreenBuffer;
bool m_allowAnyHTTPSCertificateForLocalHost;
+ qreal m_customDevicePixelRatio;
WTF::String m_iconUrl;
int m_loadProgress;
WTF::String m_currentUrl;
@@ -211,13 +214,11 @@ class QQuickWebViewFlickablePrivate : public QQuickWebViewPrivate {
Q_DECLARE_PUBLIC(QQuickWebView)
public:
QQuickWebViewFlickablePrivate(QQuickWebView* viewport);
- virtual ~QQuickWebViewFlickablePrivate();
virtual void initialize(WKContextRef contextRef = 0, WKPageGroupRef pageGroupRef = 0);
virtual void onComponentComplete();
virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&);
- virtual WebKit::QtViewportHandler* viewportHandler() { return m_viewportHandler.data(); }
virtual void updateViewportSize();
virtual void pageDidRequestScroll(const QPoint& pos);
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
index 1c39a53cd..a8a9c686b 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest.cpp
@@ -21,7 +21,7 @@
#include "config.h"
#include "qwebkittest_p.h"
-#include "QtViewportHandler.h"
+#include "PageViewportControllerClientQt.h"
#include "qquickwebview_p_p.h"
#include <QMutableListIterator>
#include <QTouchEvent>
@@ -137,51 +137,42 @@ QSize QWebKitTest::contentsSize() const
return QSize(m_webViewPrivate->pageView->contentsSize().toSize());
}
-QVariant QWebKitTest::contentsScale() const
+static inline QJsonObject toJsonObject(const QSizeF& sizeF)
{
- if (QtViewportHandler* viewport = m_webViewPrivate->viewportHandler())
- return viewport->currentCSSScale();
- return 1.0;
+ QJsonObject result;
+ result.insert(QLatin1String("width"), sizeF.width());
+ result.insert(QLatin1String("height"), sizeF.height());
+ return result;
}
-QVariant QWebKitTest::devicePixelRatio() const
+QJsonObject QWebKitTest::viewport() const
{
- if (QtViewportHandler* viewport = m_webViewPrivate->viewportHandler())
- return viewport->m_devicePixelRatio;
- return 1.0;
-}
-
-QVariant QWebKitTest::initialScale() const
-{
- if (QtViewportHandler* viewport = m_webViewPrivate->viewportHandler())
- return viewport->m_rawAttributes.initialScale;
- return 1.0;
+ QJsonObject viewportData;
+ if (const PageViewportController* const viewportHandler = m_webViewPrivate->viewportController()) {
+ viewportData.insert(QLatin1String("layoutSize"), toJsonObject(viewportHandler->contentsLayoutSize()));
+ viewportData.insert(QLatin1String("isScalable"), viewportHandler->allowsUserScaling());
+ viewportData.insert(QLatin1String("minimumScale"), viewportHandler->minimumContentsScale());
+ viewportData.insert(QLatin1String("maximumScale"), viewportHandler->maximumContentsScale());
+ } else {
+ viewportData.insert(QLatin1String("initialScale"), 1.0);
+ viewportData.insert(QLatin1String("layoutSize"), toJsonObject(QSizeF()));
+ viewportData.insert(QLatin1String("isScalable"), false);
+ viewportData.insert(QLatin1String("minimumScale"), 1.0);
+ viewportData.insert(QLatin1String("maximumScale"), 1.0);
+ }
+ return viewportData;
}
-QVariant QWebKitTest::minimumScale() const
+QVariant QWebKitTest::devicePixelRatio() const
{
- if (QtViewportHandler* viewport = m_webViewPrivate->viewportHandler())
- return viewport->m_minimumScale;
+ if (const PageViewportController* const viewport = m_webViewPrivate->viewportController())
+ return viewport->devicePixelRatio();
return 1.0;
}
-QVariant QWebKitTest::maximumScale() const
+QVariant QWebKitTest::contentsScale() const
{
- if (QtViewportHandler* viewport = m_webViewPrivate->viewportHandler())
- return viewport->m_maximumScale;
+ if (const PageViewportController* const viewport = m_webViewPrivate->viewportController())
+ return viewport->currentContentsScale();
return 1.0;
}
-
-QVariant QWebKitTest::isScalable() const
-{
- if (QtViewportHandler* viewport = m_webViewPrivate->viewportHandler())
- return !!viewport->m_rawAttributes.userScalable;
- return false;
-}
-
-QVariant QWebKitTest::layoutSize() const
-{
- if (QtViewportHandler* viewport = m_webViewPrivate->viewportHandler())
- return QSizeF(viewport->m_rawAttributes.layoutSize);
- return QSizeF();
-}
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
index 3754f169a..bfabb69fb 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebkittest_p.h
@@ -24,6 +24,7 @@
#include "qwebkitglobal.h"
#include "qquickwebview_p.h"
+#include <QtCore/QJsonObject>
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <QtCore/QSize>
@@ -40,17 +41,14 @@ class QWEBKIT_EXPORT QWebKitTest : public QObject {
Q_PROPERTY(QVariant contentsScale READ contentsScale NOTIFY contentsScaleChanged)
- Q_PROPERTY(QVariant devicePixelRatio READ devicePixelRatio NOTIFY viewportChanged)
- Q_PROPERTY(QVariant initialScale READ initialScale NOTIFY viewportChanged)
- Q_PROPERTY(QVariant isScalable READ isScalable NOTIFY viewportChanged)
- Q_PROPERTY(QVariant maximumScale READ maximumScale NOTIFY viewportChanged)
- Q_PROPERTY(QVariant minimumScale READ minimumScale NOTIFY viewportChanged)
- Q_PROPERTY(QVariant layoutSize READ layoutSize NOTIFY viewportChanged)
+ Q_PROPERTY(QVariant devicePixelRatio READ devicePixelRatio NOTIFY devicePixelRatioChanged)
+ Q_PROPERTY(QJsonObject viewport READ viewport NOTIFY viewportChanged)
Q_SIGNALS:
void contentsSizeChanged();
void contentsScaleChanged();
void contentsScaleCommitted();
+ void devicePixelRatioChanged();
void viewportChanged();
public Q_SLOTS:
@@ -68,11 +66,7 @@ public:
QVariant contentsScale() const;
QVariant devicePixelRatio() const;
- QVariant initialScale() const;
- QVariant isScalable() const;
- QVariant layoutSize() const;
- QVariant maximumScale() const;
- QVariant minimumScale() const;
+ QJsonObject viewport() const;
private:
QQuickWebViewPrivate* m_webViewPrivate;
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp
index e66f368c5..e27f51264 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences.cpp
@@ -71,6 +71,10 @@ bool QWebPreferencesPrivate::testAttribute(QWebPreferencesPrivate::WebAttribute
return WKPreferencesGetCSSCustomFilterEnabled(preferencesRef());
#endif
#endif
+#if ENABLE(WEB_AUDIO)
+ case WebAudioEnabled:
+ return WKPreferencesGetWebAudioEnabled(preferencesRef());
+#endif
default:
ASSERT_NOT_REACHED();
return false;
@@ -124,6 +128,11 @@ void QWebPreferencesPrivate::setAttribute(QWebPreferencesPrivate::WebAttribute a
break;
#endif
#endif
+#if ENABLE(WEB_AUDIO)
+ case WebAudioEnabled:
+ WKPreferencesSetWebAudioEnabled(preferencesRef(), enable);
+ break;
+#endif
default:
ASSERT_NOT_REACHED();
}
@@ -513,6 +522,25 @@ void QWebPreferences::setWebGLEnabled(bool enable)
#endif
}
+bool QWebPreferences::webAudioEnabled() const
+{
+#if ENABLE(WEB_AUDIO)
+ return d->testAttribute(QWebPreferencesPrivate::WebAudioEnabled);
+#else
+ return false;
+#endif
+}
+
+void QWebPreferences::setWebAudioEnabled(bool enable)
+{
+#if ENABLE(WEB_AUDIO)
+ d->setAttribute(QWebPreferencesPrivate::WebAudioEnabled, enable);
+ emit webAudioEnabledChanged();
+#else
+ UNUSED_PARAM(enable);
+#endif
+}
+
WKPreferencesRef QWebPreferencesPrivate::preferencesRef() const
{
WKPageGroupRef pageGroupRef = toAPI(webViewPrivate->webPageProxy->pageGroup());
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h
index 8618f4fc3..373df7504 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p.h
@@ -44,6 +44,7 @@ public:
Q_PROPERTY(bool frameFlatteningEnabled READ frameFlatteningEnabled WRITE setFrameFlatteningEnabled NOTIFY frameFlatteningEnabledChanged FINAL)
Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled NOTIFY developerExtrasEnabledChanged FINAL)
Q_PROPERTY(bool webGLEnabled READ webGLEnabled WRITE setWebGLEnabled NOTIFY webGLEnabledChanged FINAL)
+ Q_PROPERTY(bool webAudioEnabled READ webAudioEnabled WRITE setWebAudioEnabled NOTIFY webAudioEnabledChanged FINAL)
Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily NOTIFY standardFontFamilyChanged FINAL)
Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily NOTIFY fixedFontFamilyChanged FINAL)
@@ -95,6 +96,9 @@ public:
bool webGLEnabled() const;
void setWebGLEnabled(bool enable);
+ bool webAudioEnabled() const;
+ void setWebAudioEnabled(bool enable);
+
QString standardFontFamily() const;
void setStandardFontFamily(const QString& family);
@@ -136,6 +140,7 @@ Q_SIGNALS:
void frameFlatteningEnabledChanged();
void developerExtrasEnabledChanged();
void webGLEnabledChanged();
+ void webAudioEnabledChanged();
void standardFontFamilyChanged();
void fixedFontFamilyChanged();
diff --git a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h
index 004500c90..c606bbe89 100644
--- a/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/qwebpreferences_p_p.h
@@ -40,7 +40,8 @@ public:
DnsPrefetchEnabled,
DeveloperExtrasEnabled,
WebGLEnabled,
- CSSCustomFilterEnabled
+ CSSCustomFilterEnabled,
+ WebAudioEnabled
};
enum FontFamily {
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
index 6250348a6..0a7a684cf 100644
--- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview.cpp
@@ -185,7 +185,7 @@ PassRefPtr<WebKit::WebContextMenuProxy> QRawWebViewPrivate::createContextMenuPro
}
#if ENABLE(INPUT_TYPE_COLOR)
-PassRefPtr<WebKit::WebColorChooserProxy> QRawWebViewPrivate::createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor)
+PassRefPtr<WebKit::WebColorChooserProxy> QRawWebViewPrivate::createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&)
{
notImplemented();
return PassRefPtr<WebKit::WebColorChooserProxy>();
@@ -240,7 +240,10 @@ PassOwnPtr<WebKit::DrawingAreaProxy> QRawWebViewPrivate::createDrawingAreaProxy(
}
QRawWebViewPrivate::QRawWebViewPrivate(WebKit::WebContext* context, WebKit::WebPageGroup* pageGroup, QRawWebViewClient* client)
- : m_client(client)
+ : m_focused(false)
+ , m_visible(false)
+ , m_active(false)
+ , m_client(client)
, m_webPageProxy(context->createWebPage(this, pageGroup))
{
m_webPageProxy->pageGroup()->preferences()->setForceCompositingMode(true);
@@ -325,14 +328,20 @@ QSize QRawWebView::size() const
void QRawWebView::setSize(const QSize& size)
{
- d->m_size = size;
- d->m_webPageProxy->setViewportSize(size);
-
-
WebKit::DrawingAreaProxy* drawingArea = d->m_webPageProxy->drawingArea();
if (!drawingArea)
return;
+ if (d->m_webPageProxy->useFixedLayout())
+ d->m_webPageProxy->setViewportSize(size);
+ else {
+ WebKit::LayerTreeCoordinatorProxy* coordinator = drawingArea->layerTreeCoordinatorProxy();
+ if (!coordinator)
+ return;
+ coordinator->setContentsSize(WebCore::FloatSize(size.width(), size.height()));
+ }
+
+ d->m_size = size;
drawingArea->setSize(d->m_size, WebCore::IntSize());
drawingArea->setVisibleContentsRect(WebCore::IntRect(WebCore::IntPoint(), d->m_size), 1 /*scale*/, WebCore::FloatPoint());
diff --git a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h
index 0a4bf5a9e..55bc85ba0 100644
--- a/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h
+++ b/Source/WebKit2/UIProcess/API/qt/raw/qrawwebview_p_p.h
@@ -25,8 +25,10 @@
#ifndef qrawwebview_p_p_h
#define qrawwebview_p_p_h
+#include "FindIndicator.h"
#include "PageClient.h"
#include "WebContextMenuProxy.h"
+#include "WebEditCommandProxy.h"
#include "WebPopupMenuProxy.h"
#include "qrawwebview_p.h"
@@ -87,7 +89,7 @@ public:
virtual PassRefPtr<WebKit::WebContextMenuProxy> createContextMenuProxy(WebKit::WebPageProxy* webPageProxy);
#if ENABLE(INPUT_TYPE_COLOR)
- virtual PassRefPtr<WebKit::WebColorChooserProxy> createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor);
+ virtual PassRefPtr<WebKit::WebColorChooserProxy> createColorChooserProxy(WebKit::WebPageProxy*, const WebCore::Color& intialColor, const WebCore::IntRect&);
#endif
QRawWebViewPrivate(WebKit::WebContext*, WebKit::WebPageGroup*, QRawWebViewClient*);
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
index 2262a5f1a..95b005f3a 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
+++ b/Source/WebKit2/UIProcess/API/qt/tests/bytearraytestdata.h
@@ -30,7 +30,7 @@
#include <QObject>
#include <QtQuick/qquickitem.h>
-class QWEBKIT_EXPORT ByteArrayTestData : public QObject {
+class ByteArrayTestData : public QObject {
Q_OBJECT
Q_PROPERTY(QVariant latin1Data READ latin1Data)
Q_PROPERTY(QVariant utf8Data READ utf8Data)
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_devicePixelRatio.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_devicePixelRatio.qml
new file mode 100644
index 000000000..0442b53c9
--- /dev/null
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_devicePixelRatio.qml
@@ -0,0 +1,62 @@
+import QtQuick 2.0
+import QtTest 1.0
+import QtWebKit 3.0
+import QtWebKit.experimental 1.0
+import "../common"
+
+
+TestWebView {
+ id: webView
+ property variant lastResult
+ width: 400
+ height: 300
+ focus: true
+
+ SignalSpy {
+ id: resultSpy
+ target: webView
+ signalName: "lastResultChanged"
+ }
+
+ TestCase {
+ name: "DevicePixelRatio"
+
+ function init() {
+ resultSpy.clear()
+ webView.lastResult = null
+ }
+
+ function test_devicePixelRatio() {
+ resultSpy.clear()
+ webView.url = Qt.resolvedUrl("../common/test1.html");
+ webView.experimental.devicePixelRatio = 2.0
+ verify(webView.waitForLoadSucceeded())
+
+ webView.experimental.evaluateJavaScript(
+ "(function() { return window.devicePixelRatio })()",
+ function(result) {
+ webView.lastResult = result
+ })
+
+ resultSpy.wait()
+ compare(webView.lastResult, 2.0)
+ compare(webView.lastResult, webView.experimental.devicePixelRatio)
+ }
+
+ function test_devicePixelRatioMediaQuery() {
+ resultSpy.clear()
+ webView.url = Qt.resolvedUrl("../common/test2.html");
+ webView.experimental.devicePixelRatio = 2.0
+ verify(webView.waitForLoadSucceeded())
+
+ webView.experimental.evaluateJavaScript(
+ "(function() { return window.matchMedia(\"(-webkit-device-pixel-ratio: 2)\").matches })()",
+ function(result) {
+ webView.lastResult = result
+ })
+
+ resultSpy.wait()
+ verify(webView.lastResult)
+ }
+ }
+}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml
index b2a860e73..691455708 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_doubleTapToZoom.qml
@@ -13,8 +13,6 @@ Item {
property variant result
- experimental.test.onContentsScaleCommitted: scaleChanged()
-
property variant content: "data:text/html," +
"<head>" +
" <meta name='viewport' content='width=device-width'>" +
@@ -26,7 +24,6 @@ Item {
"</body>"
signal resultReceived
- signal scaleChanged
}
SignalSpy {
@@ -37,8 +34,8 @@ Item {
SignalSpy {
id: scaleSpy
- target: webView
- signalName: "scaleChanged"
+ target: webView.experimental.test
+ signalName: "contentsScaleCommitted"
}
TestCase {
@@ -67,8 +64,8 @@ Item {
var result;
webView.experimental.evaluateJavaScript(
- "document.getElementById('" + id + "').getBoundingClientRect();",
- function(rect) { webView.resultReceived(); result = rect });
+ "JSON.stringify(document.getElementById('" + id + "').getBoundingClientRect());",
+ function(rect) { webView.resultReceived(); result = JSON.parse(rect); });
resultSpy.wait();
return result;
}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml
index febd948b8..f12da5de8 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_fitToView.qml
@@ -13,8 +13,6 @@ Item {
property variant result
- experimental.test.onContentsScaleCommitted: scaleChanged()
-
property variant content: "data:text/html," +
"<head>" +
" <meta name='viewport' content='width=device-width'>" +
@@ -24,7 +22,6 @@ Item {
"</body>"
signal resultReceived
- signal scaleChanged
}
SignalSpy {
@@ -35,8 +32,8 @@ Item {
SignalSpy {
id: scaleSpy
- target: webView
- signalName: "scaleChanged"
+ target: webView.experimental.test
+ signalName: "contentsScaleCommitted"
}
TestCase {
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml
index d24312610..1fc1559ab 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qmltests/WebView/tst_wheelEventHandling.qml
@@ -42,5 +42,16 @@ Item {
// The check below will fail if the previous position was not restored after reload.
verify(position == webView.contentY)
}
+
+ function test_wheelScrollEventAfterReload() {
+ scrollSpy.clear()
+ webView.reload()
+ verify(webView.waitForLoadSucceeded())
+ var centerPoint = Qt.point(webView.width / 2, webView.height / 2)
+ test.wheelEvent(webView, centerPoint.x, centerPoint.y, -500);
+ // The signal spy below will time out if the wheel event did not scroll the content.
+ scrollSpy.wait()
+ }
}
+
}
diff --git a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
index 93d669cee..0338ecff6 100644
--- a/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
+++ b/Source/WebKit2/UIProcess/API/qt/tests/qrawwebview/tst_qrawwebview.cpp
@@ -150,7 +150,7 @@ class tst_qrawwebview : public QObject {
Q_OBJECT
public:
tst_qrawwebview()
- : m_resourceDir(QString::fromAscii(TESTS_SOURCE_DIR "/html/resources"))
+ : m_resourceDir(QString::fromLatin1(TESTS_SOURCE_DIR "/html/resources"))
, m_baseUrl(QUrl::fromLocalFile(TESTS_SOURCE_DIR "/html").toString())
{ }