Commit f54d2522 authored by hausmann@webkit.org's avatar hausmann@webkit.org
Browse files

[Qt] Improve the handling of mock geolocation, device orientation and motion clients

Reviewed by Tor Arne Vestbø.

The mock versions of these web facing features should be instantiated when
running in DumpRenderTree only. In order for them to work, no extra Qt modules
such as QtLocation are actually needed.

This patch decouples enabling device orientation/motion and geolocation from
the underlying Qt modules and makes them available in developer builds
(!production_build) and backed by mock backends when running in drt.

So if the Qt 5 modules are available, they'll be used (unless drtRun). For
developers the web facing features are always enabled (although requests will
time out) and the mock backends are enabled inside DRT, allowing for the layout
tests to run with less dependencies.

In addition this also enables the mock device motion client, which was
previously never instantiated.

.:

* Source/widgetsapi.pri:

Source/WebCore:

* Target.pri:
* WebCore.pri:

Source/WebKit:

* WebKit1.pri:
* WebKit1.pro:

Source/WebKit/qt:

* WebCoreSupport/QWebFrameAdapter.cpp:
(QWebFrameAdapter::_q_orientationChanged):
* WebCoreSupport/QWebFrameAdapter.h:
* WebCoreSupport/QWebPageAdapter.cpp:
(QWebPageAdapter::initializeWebCorePage):
* WebCoreSupport/QWebPageAdapter.h:
* WidgetApi/qwebframe.cpp:
(QWebFrame::QWebFrame):
* WidgetApi/qwebpage.cpp:
(QWebPage::setFeaturePermission):

Source/WebKit2:

* Target.pri:
* UIProcess/qt/WebContextQt.cpp:
(WebKit::WebContext::platformInitializeWebProcess):
* UIProcess/qt/WebGeolocationProviderQt.cpp:
* WebKit2.pri:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):

Tools:

* qmake/mkspecs/features/features.prf:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145805 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8abe6e20
2013-03-14 Simon Hausmann <simon.hausmann@digia.com>
[Qt] Improve the handling of mock geolocation, device orientation and motion clients
Reviewed by Tor Arne Vestbø.
The mock versions of these web facing features should be instantiated when
running in DumpRenderTree only. In order for them to work, no extra Qt modules
such as QtLocation are actually needed.
This patch decouples enabling device orientation/motion and geolocation from
the underlying Qt modules and makes them available in developer builds
(!production_build) and backed by mock backends when running in drt.
So if the Qt 5 modules are available, they'll be used (unless drtRun). For
developers the web facing features are always enabled (although requests will
time out) and the mock backends are enabled inside DRT, allowing for the layout
tests to run with less dependencies.
In addition this also enables the mock device motion client, which was
previously never instantiated.
* Source/widgetsapi.pri:
2013-03-13 Ryosuke Niwa <rniwa@webkit.org>
Threaded HTML Parser is missing feature define flags in all but Chromium port's build files
......
2013-03-14 Simon Hausmann <simon.hausmann@digia.com>
[Qt] Improve the handling of mock geolocation, device orientation and motion clients
Reviewed by Tor Arne Vestbø.
The mock versions of these web facing features should be instantiated when
running in DumpRenderTree only. In order for them to work, no extra Qt modules
such as QtLocation are actually needed.
This patch decouples enabling device orientation/motion and geolocation from
the underlying Qt modules and makes them available in developer builds
(!production_build) and backed by mock backends when running in drt.
So if the Qt 5 modules are available, they'll be used (unless drtRun). For
developers the web facing features are always enabled (although requests will
time out) and the mock backends are enabled inside DRT, allowing for the layout
tests to run with less dependencies.
In addition this also enables the mock device motion client, which was
previously never instantiated.
* Target.pri:
* WebCore.pri:
2013-03-14 Allan Sandfeld Jensen <allan.jensen@digia.com>
 
[TexMap] Painting into area of composited tile not cleared
......@@ -3719,7 +3719,7 @@ enable?(TEXT_AUTOSIZING) {
SOURCES += # FIXME!
}
enable?(DEVICE_ORIENTATION) {
have?(qtsensors):enable?(DEVICE_ORIENTATION) {
HEADERS += \
platform/qt/DeviceMotionClientQt.h \
platform/qt/DeviceMotionProviderQt.h \
......
......@@ -152,9 +152,7 @@ enable?(NETSCAPE_PLUGIN_API) {
}
}
enable?(ORIENTATION_EVENTS)|enable?(DEVICE_ORIENTATION) {
QT += sensors
}
have?(qtsensors):if(enable?(ORIENTATION_EVENTS)|enable?(DEVICE_ORIENTATION)): QT += sensors
use?(QT_MOBILITY_SYSTEMINFO) {
CONFIG *= mobility
......
2013-03-14 Simon Hausmann <simon.hausmann@digia.com>
[Qt] Improve the handling of mock geolocation, device orientation and motion clients
Reviewed by Tor Arne Vestbø.
The mock versions of these web facing features should be instantiated when
running in DumpRenderTree only. In order for them to work, no extra Qt modules
such as QtLocation are actually needed.
This patch decouples enabling device orientation/motion and geolocation from
the underlying Qt modules and makes them available in developer builds
(!production_build) and backed by mock backends when running in drt.
So if the Qt 5 modules are available, they'll be used (unless drtRun). For
developers the web facing features are always enabled (although requests will
time out) and the mock backends are enabled inside DRT, allowing for the layout
tests to run with less dependencies.
In addition this also enables the mock device motion client, which was
previously never instantiated.
* WebKit1.pri:
* WebKit1.pro:
2013-03-13 Genevieve Mak <gmak@rim.com>
[BlackBerry] Add Proximity Detector.
......
......@@ -12,11 +12,9 @@ INCLUDEPATH += \
$$SOURCE_DIR/qt/WebCoreSupport \
$$ROOT_WEBKIT_DIR/Source/WTF/wtf/qt
enable?(DEVICE_ORIENTATION)|enable?(ORIENTATION_EVENTS) {
QT += sensors
}
have?(qtsensors):if(enable?(DEVICE_ORIENTATION)|enable?(ORIENTATION_EVENTS)): QT += sensors
enable?(GEOLOCATION): QT += location
have?(qtlocation):enable?(GEOLOCATION): QT += location
contains(CONFIG, texmap): DEFINES += WTF_USE_TEXTURE_MAPPER=1
......
......@@ -98,7 +98,7 @@ INCLUDEPATH += \
use?(3D_GRAPHICS): WEBKIT += angle
enable?(GEOLOCATION) {
have?(qtlocation):enable?(GEOLOCATION) {
HEADERS += \
$$PWD/qt/WebCoreSupport/GeolocationClientQt.h
SOURCES += \
......
2013-03-14 Simon Hausmann <simon.hausmann@digia.com>
[Qt] Improve the handling of mock geolocation, device orientation and motion clients
Reviewed by Tor Arne Vestbø.
The mock versions of these web facing features should be instantiated when
running in DumpRenderTree only. In order for them to work, no extra Qt modules
such as QtLocation are actually needed.
This patch decouples enabling device orientation/motion and geolocation from
the underlying Qt modules and makes them available in developer builds
(!production_build) and backed by mock backends when running in drt.
So if the Qt 5 modules are available, they'll be used (unless drtRun). For
developers the web facing features are always enabled (although requests will
time out) and the mock backends are enabled inside DRT, allowing for the layout
tests to run with less dependencies.
In addition this also enables the mock device motion client, which was
previously never instantiated.
* WebCoreSupport/QWebFrameAdapter.cpp:
(QWebFrameAdapter::_q_orientationChanged):
* WebCoreSupport/QWebFrameAdapter.h:
* WebCoreSupport/QWebPageAdapter.cpp:
(QWebPageAdapter::initializeWebCorePage):
* WebCoreSupport/QWebPageAdapter.h:
* WidgetApi/qwebframe.cpp:
(QWebFrame::QWebFrame):
* WidgetApi/qwebpage.cpp:
(QWebPage::setFeaturePermission):
2013-03-13 Simon Hausmann <simon.hausmann@digia.com>
 
[Qt] Port TestRunner::findString to shared interface
......
......@@ -657,7 +657,7 @@ bool QWebFrameAdapter::renderFromTiledBackingStore(QPainter* painter, const QReg
void QWebFrameAdapter::_q_orientationChanged()
{
#if ENABLE(ORIENTATION_EVENTS)
#if ENABLE(ORIENTATION_EVENTS) && HAVE(QTSENSORS)
int orientation;
switch (m_orientation.reading()->orientation()) {
......
......@@ -22,7 +22,7 @@
#include "FrameLoaderClientQt.h"
#include "PlatformEvent.h"
#if ENABLE(ORIENTATION_EVENTS)
#if ENABLE(ORIENTATION_EVENTS) && HAVE(QTSENSORS)
#include "qorientationsensor.h"
#endif // ENABLE(ORIENTATION_EVENTS).
#include "qwebelement.h"
......@@ -228,7 +228,7 @@ public:
int marginHeight;
Qt::ScrollBarPolicy horizontalScrollBarPolicy;
Qt::ScrollBarPolicy verticalScrollBarPolicy;
#if ENABLE(ORIENTATION_EVENTS)
#if ENABLE(ORIENTATION_EVENTS) && HAVE(QTSENSORS)
QOrientationSensor m_orientation;
#endif // ENABLE(ORIENTATION_EVENTS).
......
......@@ -30,10 +30,15 @@
#include "ContextMenuClientQt.h"
#include "ContextMenuController.h"
#if ENABLE(DEVICE_ORIENTATION)
#include "DeviceMotionClientQt.h"
#include "DeviceMotionClientMock.h"
#include "DeviceMotionController.h"
#include "DeviceOrientationClientMock.h"
#include "DeviceOrientationController.h"
#if HAVE(QTSENSORS)
#include "DeviceMotionClientQt.h"
#include "DeviceOrientationClientQt.h"
#endif
#endif
#include "DocumentLoader.h"
#include "DragClientQt.h"
#include "DragController.h"
......@@ -45,8 +50,10 @@
#include "FrameView.h"
#if ENABLE(GEOLOCATION)
#include "GeolocationClientMock.h"
#include "GeolocationClientQt.h"
#include "GeolocationController.h"
#if HAVE(QTLOCATION)
#include "GeolocationClientQt.h"
#endif
#endif
#include "GeolocationPermissionClientQt.h"
#include "HTMLFrameOwnerElement.h"
......@@ -174,7 +181,7 @@ QWebPageAdapter::QWebPageAdapter()
void QWebPageAdapter::initializeWebCorePage()
{
#if ENABLE(GEOLOCATION) || ENABLE(DEVICE_ORIENTATION)
bool useMock = QWebPageAdapter::drtRun;
const bool useMock = QWebPageAdapter::drtRun;
#endif
Page::PageClients pageClients;
pageClients.chromeClient = new ChromeClientQt(this);
......@@ -183,21 +190,36 @@ void QWebPageAdapter::initializeWebCorePage()
pageClients.dragClient = new DragClientQt(pageClients.chromeClient);
pageClients.inspectorClient = new InspectorClientQt(this);
page = new Page(pageClients);
#if ENABLE(GEOLOCATION)
if (useMock) {
// In case running in DumpRenderTree mode set the controller to mock provider.
GeolocationClientMock* mock = new GeolocationClientMock;
WebCore::provideGeolocationTo(page, mock);
mock->setController(WebCore::GeolocationController::from(page));
} else
}
#if HAVE(QTLOCATION)
else
WebCore::provideGeolocationTo(page, new GeolocationClientQt(this));
#endif
#endif
#if ENABLE(DEVICE_ORIENTATION)
if (useMock)
WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientMock);
else
if (useMock) {
DeviceOrientationClientMock* mockOrientationClient = new DeviceOrientationClientMock;
WebCore::provideDeviceOrientationTo(page, mockOrientationClient);
mockOrientationClient->setController(WebCore::DeviceOrientationController::from(page));
DeviceMotionClientMock* mockMotionClient= new DeviceMotionClientMock;
WebCore::provideDeviceMotionTo(page, mockMotionClient);
mockMotionClient->setController(WebCore::DeviceMotionController::from(page));
}
#if HAVE(QTSENSORS)
else {
WebCore::provideDeviceOrientationTo(page, new DeviceOrientationClientQt);
WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt);
WebCore::provideDeviceMotionTo(page, new DeviceMotionClientQt);
}
#endif
#endif
// By default each page is put into their own unique page group, which affects popup windows
......@@ -1156,7 +1178,7 @@ void QWebPageAdapter::setSystemTrayIcon(QObject *icon)
#endif // QT_NO_SYSTEMTRAYICON
#endif // ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
#if ENABLE(GEOLOCATION)
#if ENABLE(GEOLOCATION) && HAVE(QTLOCATION)
void QWebPageAdapter::setGeolocationEnabledForFrame(QWebFrameAdapter* frame, bool on)
{
GeolocationPermissionClientQt::geolocationPermissionClient()->setPermission(frame, on);
......
......@@ -298,7 +298,7 @@ public:
QString contextMenuItemTagForAction(MenuAction, bool* checkable) const;
QStringList supportedContentTypes() const;
#if ENABLE(GEOLOCATION)
#if ENABLE(GEOLOCATION) && HAVE(QTLOCATION)
void setGeolocationEnabledForFrame(QWebFrameAdapter*, bool);
#endif
#if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS)
......
......@@ -209,7 +209,7 @@ QWebFrame::QWebFrame(QWebPage *parentPage)
d->q = this;
d->init(/*page adapter*/ parentPage->handle());
#if ENABLE(ORIENTATION_EVENTS)
#if ENABLE(ORIENTATION_EVENTS) && HAVE(QTSENSORS)
connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged()));
d->m_orientation.start();
#endif
......@@ -222,7 +222,7 @@ QWebFrame::QWebFrame(QWebFrame* parent, QWebFrameData* frameData)
d->page = parent->d->page;
d->q = this;
d->init(parent->d->pageAdapter, frameData);
#if ENABLE(ORIENTATION_EVENTS)
#if ENABLE(ORIENTATION_EVENTS) && HAVE(QTSENSORS)
connect(&d->m_orientation, SIGNAL(readingChanged()), this, SLOT(_q_orientationChanged()));
d->m_orientation.start();
#endif
......
......@@ -1603,7 +1603,7 @@ void QWebPage::setFeaturePermission(QWebFrame* frame, Feature feature, Permissio
#endif
break;
case Geolocation:
#if ENABLE(GEOLOCATION)
#if ENABLE(GEOLOCATION) && HAVE(QTLOCATION)
if (policy != PermissionUnknown)
d->setGeolocationEnabledForFrame(frame->d, (policy == PermissionGrantedByUser));
#endif
......
2013-03-14 Simon Hausmann <simon.hausmann@digia.com>
[Qt] Improve the handling of mock geolocation, device orientation and motion clients
Reviewed by Tor Arne Vestbø.
The mock versions of these web facing features should be instantiated when
running in DumpRenderTree only. In order for them to work, no extra Qt modules
such as QtLocation are actually needed.
This patch decouples enabling device orientation/motion and geolocation from
the underlying Qt modules and makes them available in developer builds
(!production_build) and backed by mock backends when running in drt.
So if the Qt 5 modules are available, they'll be used (unless drtRun). For
developers the web facing features are always enabled (although requests will
time out) and the mock backends are enabled inside DRT, allowing for the layout
tests to run with less dependencies.
In addition this also enables the mock device motion client, which was
previously never instantiated.
* Target.pri:
* UIProcess/qt/WebContextQt.cpp:
(WebKit::WebContext::platformInitializeWebProcess):
* UIProcess/qt/WebGeolocationProviderQt.cpp:
* WebKit2.pri:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
2013-03-14 Alice Liu <alice.liu@apple.com>
 
Add to HistoryItem a way to know if its underlying CachedPage has expired.
......@@ -912,7 +912,7 @@ enable?(TOUCH_EVENTS) {
}
enable?(GEOLOCATION): QT += location
have?(qtlocation):enable?(GEOLOCATION): QT += location
use?(3D_GRAPHICS): WEBKIT += angle
......
......@@ -52,7 +52,7 @@ String WebContext::applicationCacheDirectory()
void WebContext::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
{
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
#if ENABLE(GEOLOCATION)
#if ENABLE(GEOLOCATION) && HAVE(QTLOCATION)
static WebGeolocationProviderQt* location = WebGeolocationProviderQt::create(toAPI(supplement<WebGeolocationManagerProxy>()));
WKGeolocationManagerSetProvider(toAPI(supplement<WebGeolocationManagerProxy>()), WebGeolocationProviderQt::provider(location));
#endif
......
......@@ -21,7 +21,7 @@
#include "config.h"
#include "WebGeolocationProviderQt.h"
#if ENABLE(GEOLOCATION)
#if ENABLE(GEOLOCATION) && HAVE(QTLOCATION)
#include <QtLocation/QGeoPositionInfoSource>
namespace WebKit {
......
......@@ -82,4 +82,4 @@ linux-*: {
have?(QTQUICK): QT += qml quick
enable?(GEOLOCATION): QT += location
have?(qtlocation):enable?(GEOLOCATION): QT += location
......@@ -167,7 +167,7 @@
#endif
#if PLATFORM(QT)
#if ENABLE(DEVICE_ORIENTATION)
#if ENABLE(DEVICE_ORIENTATION) && HAVE(QTSENSORS)
#include "DeviceMotionClientQt.h"
#include "DeviceOrientationClientQt.h"
#endif
......@@ -316,7 +316,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
#if ENABLE(GEOLOCATION)
WebCore::provideGeolocationTo(m_page.get(), new WebGeolocationClient(this));
#endif
#if ENABLE(DEVICE_ORIENTATION) && PLATFORM(QT)
#if ENABLE(DEVICE_ORIENTATION) && PLATFORM(QT) && HAVE(QTSENSORS)
WebCore::provideDeviceMotionTo(m_page.get(), new DeviceMotionClientQt);
WebCore::provideDeviceOrientationTo(m_page.get(), new DeviceOrientationClientQt);
#endif
......
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