Changeset 102755 in webkit
- Timestamp:
- Dec 14, 2011 1:57:26 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r102750 r102755 1 2011-12-14 Alexander Færøy <alexander.faeroy@nokia.com> 2 3 [Qt] DeviceOrientationClientMockQt should be removed in favor of DeviceOrientationClientMock 4 https://bugs.webkit.org/show_bug.cgi?id=74417 5 6 Reviewed by Simon Hausmann. 7 8 Based on original patch by Kenneth Christiansen. 9 10 * Source/api.pri: 11 1 12 2011-12-14 Jacky Jiang <zhajiang@rim.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r102750 r102755 1 2011-12-14 Alexander Færøy <alexander.faeroy@nokia.com> 2 3 [Qt] DeviceOrientationClientMockQt should be removed in favor of DeviceOrientationClientMock 4 https://bugs.webkit.org/show_bug.cgi?id=74417 5 6 Reviewed by Simon Hausmann. 7 8 Based on original patch by Kenneth Christiansen. 9 10 Already covered by current tests. 11 12 * dom/DeviceOrientationController.h: 13 (WebCore::DeviceOrientationController::client): 14 1 15 2011-12-14 Jacky Jiang <zhajiang@rim.com> 2 16 -
trunk/Source/WebCore/dom/DeviceOrientationController.h
r98481 r102755 54 54 bool isActive() { return !m_listeners.isEmpty(); } 55 55 56 DeviceOrientationClient* client() const { return m_client; } 57 56 58 private: 57 59 void timerFired(Timer<DeviceOrientationController>*); -
trunk/Source/WebKit/qt/Api/qwebpage.cpp
r101477 r102755 47 47 #include "ContextMenuController.h" 48 48 #include "DeviceMotionClientQt.h" 49 #include "DeviceOrientationClientMock.h" 49 50 #include "DeviceOrientationClientQt.h" 50 51 #include "DocumentLoader.h" … … 311 312 , m_lastDropAction(Qt::IgnoreAction) 312 313 { 314 bool useMock = QWebPagePrivate::drtRun; 315 313 316 WebCore::initializeWebCoreQt(); 314 317 … … 320 323 pageClients.inspectorClient = new InspectorClientQt(q); 321 324 #if ENABLE(DEVICE_ORIENTATION) 322 pageClients.deviceOrientationClient = new DeviceOrientationClientQt(q); 325 if (useMock) 326 pageClients.deviceOrientationClient = new DeviceOrientationClientMock; 327 else 328 pageClients.deviceOrientationClient = new DeviceOrientationClientQt; 329 323 330 pageClients.deviceMotionClient = new DeviceMotionClientQt(q); 324 331 #endif 325 332 #if ENABLE(CLIENT_BASED_GEOLOCATION) 326 if ( QWebPagePrivate::drtRun)327 pageClients.geolocationClient = new GeolocationClientMock ();333 if (useMock) 334 pageClients.geolocationClient = new GeolocationClientMock; 328 335 else 329 336 pageClients.geolocationClient = new GeolocationClientQt(q); -
trunk/Source/WebKit/qt/ChangeLog
r102592 r102755 1 2011-12-14 Alexander Færøy <alexander.faeroy@nokia.com> 2 3 [Qt] DeviceOrientationClientMockQt should be removed in favor of DeviceOrientationClientMock 4 https://bugs.webkit.org/show_bug.cgi?id=74417 5 6 Reviewed by Simon Hausmann. 7 8 Based on original patch by Kenneth Christiansen. 9 10 Already covered by current tests. 11 12 * Api/qwebpage.cpp: 13 (QWebPagePrivate::QWebPagePrivate): 14 * WebCoreSupport/DeviceMotionProviderQt.cpp: 15 (WebCore::DeviceMotionProviderQt::DeviceMotionProviderQt): 16 (WebCore::DeviceMotionProviderQt::filter): 17 * WebCoreSupport/DeviceMotionProviderQt.h: 18 * WebCoreSupport/DeviceOrientationClientMockQt.cpp: Removed. 19 * WebCoreSupport/DeviceOrientationClientMockQt.h: Removed. 20 * WebCoreSupport/DeviceOrientationClientQt.cpp: 21 (WebCore::DeviceOrientationClientQt::DeviceOrientationClientQt): 22 (WebCore::DeviceOrientationClientQt::~DeviceOrientationClientQt): 23 (WebCore::DeviceOrientationClientQt::lastOrientation): 24 * WebCoreSupport/DeviceOrientationClientQt.h: 25 * WebCoreSupport/DeviceOrientationProviderQt.cpp: 26 (WebCore::DeviceOrientationProviderQt::DeviceOrientationProviderQt): 27 (WebCore::DeviceOrientationProviderQt::setController): 28 (WebCore::DeviceOrientationProviderQt::start): 29 (WebCore::DeviceOrientationProviderQt::stop): 30 (WebCore::DeviceOrientationProviderQt::filter): 31 * WebCoreSupport/DeviceOrientationProviderQt.h: 32 (WebCore::DeviceOrientationProviderQt::isActive): 33 (WebCore::DeviceOrientationProviderQt::lastOrientation): 34 (WebCore::DeviceOrientationProviderQt::hasAlpha): 35 * WebCoreSupport/DumpRenderTreeSupportQt.cpp: 36 (toDeviceOrientationClientMock): 37 (DumpRenderTreeSupportQt::setMockDeviceOrientation): 38 * WebCoreSupport/DumpRenderTreeSupportQt.h: 39 1 40 2011-12-12 Nándor Huszka <huszka.nandor@stud.u-szeged.hu> 2 41 -
trunk/Source/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp
r95901 r102755 29 29 m_acceleration.addFilter(this); 30 30 m_motion = DeviceMotionData::create(); 31 m_deviceOrientation = new DeviceOrientationProviderQt ();31 m_deviceOrientation = new DeviceOrientationProviderQt; 32 32 } 33 33 … … 57 57 58 58 RefPtr<DeviceMotionData::RotationRate> rotation = DeviceMotionData::RotationRate::create( 59 m_deviceOrientation->hasAlpha(), m_deviceOrientation-> orientation()->alpha(),60 /* beta available */ true, m_deviceOrientation-> orientation()->beta(),61 /* gamma available */ true, m_deviceOrientation-> orientation()->gamma());59 m_deviceOrientation->hasAlpha(), m_deviceOrientation->lastOrientation()->alpha(), 60 /* beta available */ true, m_deviceOrientation->lastOrientation()->beta(), 61 /* gamma available */ true, m_deviceOrientation->lastOrientation()->gamma()); 62 62 63 63 m_motion = DeviceMotionData::create(accel, -
trunk/Source/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h
r95901 r102755 27 27 #include <QObject> 28 28 29 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 29 30 QTM_USE_NAMESPACE 31 #endif 30 32 31 33 namespace WebCore { -
trunk/Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp
r95901 r102755 21 21 #include "DeviceOrientationClientQt.h" 22 22 23 #include "DeviceOrientationClientMockQt.h"24 23 #include "DeviceOrientationController.h" 25 24 #include "DeviceOrientationProviderQt.h" 26 #include "qwebpage.h"27 25 28 26 namespace WebCore { 29 27 30 DeviceOrientationClientQt::DeviceOrientationClientQt(QWebPage* page) 31 : m_page(page) 32 , m_controller(0) 28 DeviceOrientationClientQt::DeviceOrientationClientQt() 29 : m_controller(0) 33 30 , m_provider(new DeviceOrientationProviderQt()) 34 31 { 35 connect(m_provider, SIGNAL(deviceOrientationChanged(DeviceOrientation*)), SLOT(changeDeviceOrientation(DeviceOrientation*)));36 32 } 37 33 38 34 DeviceOrientationClientQt::~DeviceOrientationClientQt() 39 35 { 40 disconnect();41 36 delete m_provider; 42 37 } … … 59 54 DeviceOrientation* DeviceOrientationClientQt::lastOrientation() const 60 55 { 61 return m_provider-> orientation();56 return m_provider->lastOrientation(); 62 57 } 63 58 … … 76 71 77 72 } // namespace WebCore 78 79 #include "moc_DeviceOrientationClientQt.cpp" -
trunk/Source/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h
r95901 r102755 24 24 #include "DeviceOrientationClient.h" 25 25 26 #include <QObject>27 28 class QWebPage;29 30 26 namespace WebCore { 31 27 32 28 class DeviceOrientationProviderQt; 33 29 34 class DeviceOrientationClientQt : public QObject, public DeviceOrientationClient { 35 Q_OBJECT 30 class DeviceOrientationClientQt : public DeviceOrientationClient { 36 31 public: 37 DeviceOrientationClientQt( QWebPage*);32 DeviceOrientationClientQt(); 38 33 virtual ~DeviceOrientationClientQt(); 39 34 … … 43 38 virtual DeviceOrientation* lastOrientation() const; 44 39 virtual void deviceOrientationControllerDestroyed(); 45 46 public Q_SLOTS: 47 void changeDeviceOrientation(DeviceOrientation*); 40 virtual void changeDeviceOrientation(DeviceOrientation*); 48 41 49 42 private: 50 QWebPage* m_page;51 43 DeviceOrientationController* m_controller; 52 44 DeviceOrientationProviderQt* m_provider; -
trunk/Source/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp
r95901 r102755 21 21 #include "DeviceOrientationProviderQt.h" 22 22 23 #include "DeviceOrientationClientMockQt.h"24 25 23 namespace WebCore { 26 24 27 25 DeviceOrientationProviderQt::DeviceOrientationProviderQt() 28 26 { 29 m_rotation.addFilter(this); 30 m_orientation = DeviceOrientation::create(); 31 32 if (DeviceOrientationClientMockQt::mockIsActive) 33 activeClientMock(); 27 m_sensor.addFilter(this); 28 m_lastOrientation = DeviceOrientation::create(); 34 29 } 35 30 36 DeviceOrientationProviderQt::~DeviceOrientationProviderQt()31 void DeviceOrientationProviderQt::setController(DeviceOrientationController* controller) 37 32 { 38 disconnect(); 33 if (!controller) 34 stop(); 35 36 m_controller = controller; 39 37 } 40 38 41 39 void DeviceOrientationProviderQt::start() 42 40 { 43 m_ rotation.start();41 m_sensor.start(); 44 42 } 45 43 46 44 void DeviceOrientationProviderQt::stop() 47 45 { 48 m_ rotation.stop();46 m_sensor.stop(); 49 47 } 50 48 51 49 bool DeviceOrientationProviderQt::filter(QRotationReading* reading) 52 50 { 53 // Provide device orientation data according W3C spec: 54 // http://dev.w3.org/geo/api/spec-source-orientation.html 55 // Qt mobility provide these data via QRotationSensor using the 56 // QRotationReading class: 57 // - the rotation around z axis (alpha) is given as z in QRotationReading; 58 // - the rotation around x axis (beta) is given as x in QRotationReading; 59 // - the rotation around y axis (gamma) is given as y in QRotationReading; 60 // See: http://doc.qt.nokia.com/qtmobility-1.0/qrotationreading.html 61 // The Z (alpha) rotation angle is checked via hasAlpha() private method, 62 // depending if the device is able do detect the alpha rotation. X (beta) and 63 // Y (gamma) axis are availble in this context. 64 m_orientation = DeviceOrientation::create(hasAlpha(), reading->z(), 65 /* x available */ true, reading->x(), 66 /* y available */ true, reading->y()); 67 emit deviceOrientationChanged(m_orientation.get()); 51 if (m_controller) { 52 // Provide device orientation data according W3C spec: 53 // http://dev.w3.org/geo/api/spec-source-orientation.html 54 // Qt mobility provide these data via QRotationSensor using the 55 // QRotationReading class: 56 // - the rotation around z axis (alpha) is given as z in QRotationReading; 57 // - the rotation around x axis (beta) is given as x in QRotationReading; 58 // - the rotation around y axis (gamma) is given as y in QRotationReading; 59 // See: http://doc.qt.nokia.com/qtmobility-1.0/qrotationreading.html 60 // The Z (alpha) rotation angle is checked via hasAlpha() private method, 61 // depending if the device is able do detect the alpha rotation. X (beta) and 62 // Y (gamma) axis are availble in this context. 63 m_lastOrientation = DeviceOrientation::create(hasAlpha(), reading->z(), 64 /* x available */ true, reading->x(), 65 /* y available */ true, reading->y()); 66 m_controller->didChangeDeviceOrientation(m_lastOrientation.get()); 67 } 68 68 69 // We are the only filter, so no need to propagate. 69 70 return false; 70 71 } 71 72 72 void DeviceOrientationProviderQt::changeDeviceOrientation(DeviceOrientation* orientation)73 {74 m_orientation = orientation;75 73 } 76 77 void DeviceOrientationProviderQt::activeClientMock()78 {79 connect(DeviceOrientationClientMockQt::client(), SIGNAL(mockOrientationChanged(DeviceOrientation*)), SLOT(changeDeviceOrientation(DeviceOrientation*)));80 }81 82 }83 84 #include "moc_DeviceOrientationProviderQt.cpp" -
trunk/Source/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h
r95901 r102755 22 22 23 23 #include "DeviceOrientation.h" 24 #include "RefPtr.h" 24 #include "DeviceOrientationController.h" 25 #include <wtf/RefPtr.h> 25 26 26 #include <QObject>27 27 #include <QRotationFilter> 28 28 29 #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) 29 30 QTM_USE_NAMESPACE 31 #endif 30 32 31 33 namespace WebCore { 32 34 33 class DeviceOrientationClientQt; 34 35 class DeviceOrientationProviderQt : public QObject, public QRotationFilter { 36 Q_OBJECT 35 class DeviceOrientationProviderQt : public QRotationFilter { 37 36 public: 38 37 DeviceOrientationProviderQt(); 39 ~DeviceOrientationProviderQt();40 38 39 void setController(DeviceOrientationController*); 41 40 bool filter(QRotationReading*); 42 41 void start(); 43 42 void stop(); 44 bool isActive() const { return m_rotation.isActive(); } 45 DeviceOrientation* orientation() const { return m_orientation.get(); } 46 bool hasAlpha() const { return m_rotation.property("hasZ").toBool(); } 47 48 Q_SIGNALS: 49 void deviceOrientationChanged(DeviceOrientation*); 50 51 public Q_SLOTS: 52 void changeDeviceOrientation(DeviceOrientation*); 43 bool isActive() const { return m_sensor.isActive(); } 44 DeviceOrientation* lastOrientation() const { return m_lastOrientation.get(); } 45 bool hasAlpha() const { return m_sensor.property("hasZ").toBool(); } 53 46 54 47 private: 55 void activeClientMock(); 56 57 RefPtr<DeviceOrientation> m_orientation; 58 QRotationSensor m_rotation; 48 RefPtr<DeviceOrientation> m_lastOrientation; 49 DeviceOrientationController* m_controller; 50 QRotationSensor m_sensor; 59 51 }; 60 52 -
trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp
r102592 r102755 35 35 #include "ContextMenuController.h" 36 36 #include "DeviceOrientation.h" 37 #include "DeviceOrientationClientMockQt.h" 37 #include "DeviceOrientationClientMock.h" 38 #include "DeviceOrientationController.h" 38 39 #include "DocumentLoader.h" 39 40 #include "Editor.h" … … 113 114 #endif 114 115 116 #if ENABLE(DEVICE_ORIENTATION) 117 DeviceOrientationClientMock* toDeviceOrientationClientMock(DeviceOrientationClient* client) 118 { 119 ASSERT(QWebPagePrivate::drtRun); 120 return static_cast<DeviceOrientationClientMock*>(client); 121 } 122 #endif 123 115 124 QDRTNode::QDRTNode() 116 125 : m_node(0) … … 839 848 } 840 849 841 void DumpRenderTreeSupportQt:: activeMockDeviceOrientationClient(bool b)850 void DumpRenderTreeSupportQt::setMockDeviceOrientation(QWebPage* page, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) 842 851 { 843 852 #if ENABLE(DEVICE_ORIENTATION) 844 DeviceOrientationClientMockQt::mockIsActive = b; 845 #endif 846 } 847 848 void DumpRenderTreeSupportQt::removeMockDeviceOrientation() 849 { 850 #if ENABLE(DEVICE_ORIENTATION) 851 DeviceOrientationClientMockQt* client = DeviceOrientationClientMockQt::client(); 852 delete client; 853 #endif 854 } 855 856 void DumpRenderTreeSupportQt::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) 857 { 858 #if ENABLE(DEVICE_ORIENTATION) 859 DeviceOrientationClientMockQt::client()->setOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); 853 Page* corePage = QWebPagePrivate::core(page); 854 DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(corePage->deviceOrientationController()->client()); 855 mockClient->setOrientation(DeviceOrientation::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma)); 860 856 #endif 861 857 } -
trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h
r102592 r102755 157 157 static void resetOriginAccessWhiteLists(); 158 158 159 static void activeMockDeviceOrientationClient(bool b); 160 static void removeMockDeviceOrientation(); 161 static void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); 159 static void setMockDeviceOrientation(QWebPage*, bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma); 162 160 163 161 static void resetGeolocationMock(QWebPage*); -
trunk/Source/api.pri
r102679 r102755 138 138 139 139 contains(DEFINES, ENABLE_DEVICE_ORIENTATION=1) { 140 haveQt(5): QT += sensors 141 140 142 HEADERS += \ 141 143 $$PWD/WebKit/qt/WebCoreSupport/DeviceMotionClientQt.h \ 142 144 $$PWD/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.h \ 143 145 $$PWD/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.h \ 144 $$PWD/WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.h \145 146 $$PWD/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.h 146 147 … … 149 150 $$PWD/WebKit/qt/WebCoreSupport/DeviceMotionProviderQt.cpp \ 150 151 $$PWD/WebKit/qt/WebCoreSupport/DeviceOrientationClientQt.cpp \ 151 $$PWD/WebKit/qt/WebCoreSupport/DeviceOrientationClientMockQt.cpp \152 152 $$PWD/WebKit/qt/WebCoreSupport/DeviceOrientationProviderQt.cpp 153 153 } -
trunk/Tools/ChangeLog
r102748 r102755 1 2011-12-14 Alexander Færøy <alexander.faeroy@nokia.com> 2 3 [Qt] DeviceOrientationClientMockQt should be removed in favor of DeviceOrientationClientMock 4 https://bugs.webkit.org/show_bug.cgi?id=74417 5 6 Reviewed by Simon Hausmann. 7 8 Based on original patch by Kenneth Christiansen. 9 10 Already covered by current tests. 11 12 * DumpRenderTree/qt/DumpRenderTreeQt.cpp: 13 (WebCore::DumpRenderTree::DumpRenderTree): 14 (WebCore::DumpRenderTree::~DumpRenderTree): 15 * DumpRenderTree/qt/LayoutTestControllerQt.cpp: 16 (LayoutTestController::setMockDeviceOrientation): 17 1 18 2011-12-03 Philippe Normand <pnormand@igalia.com> 2 19 -
trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp
r100763 r102755 405 405 DumpRenderTreeSupportQt::setDumpRenderTreeModeEnabled(true); 406 406 DumpRenderTreeSupportQt::overwritePluginDirectories(); 407 DumpRenderTreeSupportQt::activeMockDeviceOrientationClient(true);408 407 QWebSettings::enablePersistentStorage(m_persistentStoragePath); 409 408 … … 486 485 delete m_mainView; 487 486 delete m_stdin; 488 DumpRenderTreeSupportQt::removeMockDeviceOrientation();489 487 } 490 488 -
trunk/Tools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
r102592 r102755 849 849 void LayoutTestController::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) 850 850 { 851 DumpRenderTreeSupportQt::setMockDeviceOrientation(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); 851 QList<WebCore::WebPage*> pages = m_drt->getAllPages(); 852 foreach (WebCore::WebPage* page, pages) 853 DumpRenderTreeSupportQt::setMockDeviceOrientation(page, canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma); 852 854 } 853 855
Note: See TracChangeset
for help on using the changeset viewer.