[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
diegohcg at webkit.org
diegohcg at webkit.org
Wed Dec 22 14:06:32 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 66a500003248fd2d3ff5c6d925f201f3b8c61ae3
Author: diegohcg at webkit.org <diegohcg at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 4 19:04:31 2010 +0000
[Qt] Hook up DeviceOrientation data for Qt support
https://bugs.webkit.org/show_bug.cgi?id=47052
Reviewed by Kenneth Rohde Christiansen.
Get DeviceOrientation necessary data via Qt mobility library
using a provider class.
WebCore:
* WebCore.pro:
WebKit/qt:
* WebCoreSupport/DeviceOrientationClientQt.cpp:
(WebCore::DeviceOrientationClientQt::DeviceOrientationClientQt):
(WebCore::DeviceOrientationClientQt::~DeviceOrientationClientQt):
(WebCore::DeviceOrientationClientQt::startUpdating):
(WebCore::DeviceOrientationClientQt::stopUpdating):
(WebCore::DeviceOrientationClientQt::lastOrientation):
(WebCore::DeviceOrientationClientQt::changeDeviceOrientation):
* WebCoreSupport/DeviceOrientationClientQt.h:
* WebCoreSupport/DeviceOrientationProviderQt.cpp: Added.
(WebCore::DeviceOrientationProviderQt::DeviceOrientationProviderQt):
(WebCore::DeviceOrientationProviderQt::~DeviceOrientationProviderQt):
(WebCore::DeviceOrientationProviderQt::start):
(WebCore::DeviceOrientationProviderQt::stop):
(WebCore::DeviceOrientationProviderQt::filter):
* WebCoreSupport/DeviceOrientationProviderQt.h: Added.
(WebCore::DeviceOrientationProviderQt::isActive):
(WebCore::DeviceOrientationProviderQt::orientation):
(WebCore::DeviceOrientationProviderQt::hasAlpha):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4d79d10..7356289 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,15 @@
+2010-10-04 Diego Gonzalez <diegohcg at webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Hook up DeviceOrientation data for Qt support
+ https://bugs.webkit.org/show_bug.cgi?id=47052
+
+ Get DeviceOrientation necessary data via Qt mobility library
+ using a provider class.
+
+ * WebCore.pro:
+
2010-10-01 Victoria Kirst <vrk at google.com>
Reviewed by James Robinson.
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index d769921..26dd70a 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -3271,11 +3271,16 @@ contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) {
HEADERS += \
../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h \
+ ../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h \
bindings/generic/RuntimeEnabledFeatures.h
SOURCES += \
../WebKit/qt/WebCoreSupport/DeviceMotionClientQt.cpp \
../WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp \
+ ../WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp \
bindings/generic/RuntimeEnabledFeatures.cpp
+
+ CONFIG += mobility
+ MOBILITY += sensors
}
contains(DEFINES, ENABLE_SVG=1) {
diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog
index cebfdc3..96253ed 100644
--- a/WebKit/qt/ChangeLog
+++ b/WebKit/qt/ChangeLog
@@ -1,3 +1,32 @@
+2010-10-04 Diego Gonzalez <diegohcg at webkit.org>
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ [Qt] Hook up DeviceOrientation data for Qt support
+ https://bugs.webkit.org/show_bug.cgi?id=47052
+
+ Get DeviceOrientation necessary data via Qt mobility library
+ using a provider class.
+
+ * WebCoreSupport/DeviceOrientationClientQt.cpp:
+ (WebCore::DeviceOrientationClientQt::DeviceOrientationClientQt):
+ (WebCore::DeviceOrientationClientQt::~DeviceOrientationClientQt):
+ (WebCore::DeviceOrientationClientQt::startUpdating):
+ (WebCore::DeviceOrientationClientQt::stopUpdating):
+ (WebCore::DeviceOrientationClientQt::lastOrientation):
+ (WebCore::DeviceOrientationClientQt::changeDeviceOrientation):
+ * WebCoreSupport/DeviceOrientationClientQt.h:
+ * WebCoreSupport/DeviceOrientationProviderQt.cpp: Added.
+ (WebCore::DeviceOrientationProviderQt::DeviceOrientationProviderQt):
+ (WebCore::DeviceOrientationProviderQt::~DeviceOrientationProviderQt):
+ (WebCore::DeviceOrientationProviderQt::start):
+ (WebCore::DeviceOrientationProviderQt::stop):
+ (WebCore::DeviceOrientationProviderQt::filter):
+ * WebCoreSupport/DeviceOrientationProviderQt.h: Added.
+ (WebCore::DeviceOrientationProviderQt::isActive):
+ (WebCore::DeviceOrientationProviderQt::orientation):
+ (WebCore::DeviceOrientationProviderQt::hasAlpha):
+
2010-09-28 Luiz Agostini <luiz.agostini at openbossa.org>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp
index 88003da..1d0c6d1 100644
--- a/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp
+++ b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp
@@ -20,6 +20,8 @@
#include "config.h"
#include "DeviceOrientationClientQt.h"
+#include "DeviceOrientationController.h"
+#include "DeviceOrientationProviderQt.h"
#include "qwebpage.h"
namespace WebCore {
@@ -27,7 +29,15 @@ namespace WebCore {
DeviceOrientationClientQt::DeviceOrientationClientQt(QWebPage* page)
: m_page(page)
, m_controller(0)
+ , m_provider(new DeviceOrientationProviderQt())
{
+ connect(m_provider, SIGNAL(deviceOrientationChanged(DeviceOrientation*)), SLOT(changeDeviceOrientation(DeviceOrientation*)));
+}
+
+DeviceOrientationClientQt::~DeviceOrientationClientQt()
+{
+ disconnect();
+ delete m_provider;
}
void DeviceOrientationClientQt::setController(DeviceOrientationController* controller)
@@ -37,17 +47,17 @@ void DeviceOrientationClientQt::setController(DeviceOrientationController* contr
void DeviceOrientationClientQt::startUpdating()
{
- // call start method from a orientation provider.
+ m_provider->start();
}
void DeviceOrientationClientQt::stopUpdating()
{
- // call stop method from a orientation provider.
+ m_provider->stop();
}
DeviceOrientation* DeviceOrientationClientQt::lastOrientation() const
{
- return 0;
+ return m_provider->orientation();
}
void DeviceOrientationClientQt::deviceOrientationControllerDestroyed()
@@ -55,6 +65,14 @@ void DeviceOrientationClientQt::deviceOrientationControllerDestroyed()
delete this;
}
+void DeviceOrientationClientQt::changeDeviceOrientation(DeviceOrientation* orientation)
+{
+ if (!m_controller)
+ return;
+
+ m_controller->didChangeDeviceOrientation(orientation);
+}
+
} // namespace WebCore
#include "moc_DeviceOrientationClientQt.cpp"
diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h
index c338ff5..61968c4 100644
--- a/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h
+++ b/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h
@@ -29,11 +29,13 @@ class QWebPage;
namespace WebCore {
+class DeviceOrientationProviderQt;
+
class DeviceOrientationClientQt : public QObject, public DeviceOrientationClient {
Q_OBJECT
public:
DeviceOrientationClientQt(QWebPage*);
- virtual ~DeviceOrientationClientQt() {}
+ virtual ~DeviceOrientationClientQt();
virtual void setController(DeviceOrientationController*);
virtual void startUpdating();
@@ -41,9 +43,13 @@ public:
virtual DeviceOrientation* lastOrientation() const;
virtual void deviceOrientationControllerDestroyed();
+public Q_SLOTS:
+ void changeDeviceOrientation(DeviceOrientation*);
+
private:
QWebPage* m_page;
DeviceOrientationController* m_controller;
+ DeviceOrientationProviderQt* m_provider;
};
} // namespace WebCore
diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp
new file mode 100644
index 0000000..051eba0
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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.
+ *
+ */
+#include "config.h"
+#include "DeviceOrientationProviderQt.h"
+
+namespace WebCore {
+
+DeviceOrientationProviderQt::DeviceOrientationProviderQt()
+{
+ m_rotation.addFilter(this);
+ m_orientation = DeviceOrientation::create();
+}
+
+DeviceOrientationProviderQt::~DeviceOrientationProviderQt()
+{
+}
+
+void DeviceOrientationProviderQt::start()
+{
+ m_rotation.start();
+}
+
+void DeviceOrientationProviderQt::stop()
+{
+ m_rotation.stop();
+}
+
+bool DeviceOrientationProviderQt::filter(QRotationReading* reading)
+{
+ // Provide device orientation data according W3C spec:
+ // http://dev.w3.org/geo/api/spec-source-orientation.html
+ // Qt mobility provide these data via QRotationSensor using the
+ // QRotationReading class:
+ // - the rotation around z axis (alpha) is given as z in QRotationReading;
+ // - the rotation around x axis (beta) is given as x in QRotationReading;
+ // - the rotation around y axis (gamma) is given as y in QRotationReading;
+ // See: http://doc.qt.nokia.com/qtmobility-1.0/qrotationreading.html
+ // The Z (alpha) rotation angle is checked via hasAlpha() private method,
+ // depending if the device is able do detect the alpha rotation. X (beta) and
+ // Y (gamma) axis are availble in this context.
+ m_orientation = DeviceOrientation::create(hasAlpha(), reading->z(),
+ /* x available */ true, reading->x(),
+ /* y available */ true, reading->y());
+ emit deviceOrientationChanged(m_orientation.get());
+
+ return false;
+}
+
+}
+
+#include "moc_DeviceOrientationProviderQt.cpp"
diff --git a/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h
new file mode 100644
index 0000000..86c224e
--- /dev/null
+++ b/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
+ *
+ * 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 DeviceOrientationProviderQt_h
+#define DeviceOrientationProviderQt_h
+
+#include "DeviceOrientation.h"
+#include "RefPtr.h"
+
+#include <QObject>
+#include <QRotationFilter>
+
+QTM_USE_NAMESPACE
+
+namespace WebCore {
+
+class DeviceOrientationClientQt;
+
+class DeviceOrientationProviderQt : public QObject, public QRotationFilter {
+ Q_OBJECT
+public:
+ DeviceOrientationProviderQt();
+ ~DeviceOrientationProviderQt();
+
+ bool filter(QRotationReading*);
+ void start();
+ void stop();
+ bool isActive() const { return m_rotation.isActive(); }
+ DeviceOrientation* orientation() const { return m_orientation.get(); }
+ bool hasAlpha() const { return m_rotation.property("hasZ").toBool(); }
+
+Q_SIGNALS:
+ void deviceOrientationChanged(DeviceOrientation*);
+
+private:
+ RefPtr<DeviceOrientation> m_orientation;
+ QRotationSensor m_rotation;
+};
+
+}
+
+#endif // DeviceOrientationProviderQt_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list