Add DeviceController base-class to remove duplication of DeviceXXXControler
authorkihong.kwon@samsung.com <kihong.kwon@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2012 10:38:04 +0000 (10:38 +0000)
committerkihong.kwon@samsung.com <kihong.kwon@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 Nov 2012 10:38:04 +0000 (10:38 +0000)
commit0b121fc8dc75d9a32cf779b21d024d4d4e8e1a48
treed044194d8378daa0768be8854a460a6bf9b22012
parent45454b3d12ff3cbfd1aee970f19c134fc7aad8bc
Add DeviceController base-class to remove duplication of DeviceXXXControler
https://bugs.webkit.org/show_bug.cgi?id=96894

Reviewed by Hajime Morita.

Source/WebCore:

Add DeviceController which is extracted from DeviceOrientationController to remove duplication.
And soon-to-be-added DeviceMotionController and ProximityController.

Covered by existing tests.

* CMakeLists.txt:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* dom/DeviceOrientationClient.h:
* dom/DeviceOrientationController.cpp:
Remove member functions to move to DeviceController.
- addListener(), removeListener(), removeAllListeners(), isActive()
(WebCore::DeviceOrientationController::DeviceOrientationController):
(WebCore::DeviceOrientationController::didChangeDeviceOrientation):
(WebCore::DeviceOrientationController::client):
(WebCore::DeviceOrientationController::hasLastData):
(WebCore::DeviceOrientationController::getLastEvent):
(WebCore::DeviceOrientationController::from):
(WebCore):
* dom/DeviceOrientationController.h:
(WebCore):
(WebCore::DeviceOrientationController::~DeviceOrientationController):
(DeviceOrientationController):
* dom/Document.cpp:
Remove suspendEventsForAllListeners() and resumeEventsForAllListeners() function calls.
These calls can be made by checking activeDOMObjectsAreSuspended() and activeDOMObjectsAreStopped() before dispatchEvent.
(WebCore::Document::suspendActiveDOMObjects):
(WebCore::Document::resumeActiveDOMObjects):
* loader/EmptyClients.h:
(EmptyDeviceClient):
(WebCore::EmptyDeviceClient::startUpdating):
(WebCore::EmptyDeviceClient::stopUpdating):
(WebCore):
* page/DOMWindow.cpp:
(WebCore::DOMWindow::addEventListener):
(WebCore::DOMWindow::removeEventListener):
(WebCore::DOMWindow::removeAllEventListeners):
* page/DeviceClient.h: Added.
(WebCore):
(DeviceClient):
(WebCore::DeviceClient::~DeviceClient):
* page/DeviceController.cpp: Added.
DeviceController has extracted functions from DeviceOrientationController and DeviceMotionController.
- addDeviceEventListener(), removeDeviceEventlistener(), removeAllDeviceEventListeners(), dispatchDeviceEvent()
All kind of device event controller which has DeviceClient can be inherited from DeviceController.
(WebCore):
(WebCore::DeviceController::DeviceController):
(WebCore::DeviceController::addDeviceEventListener):
(WebCore::DeviceController::removeDeviceEventListener):
(WebCore::DeviceController::removeAllDeviceEventListeners):
(WebCore::DeviceController::dispatchDeviceEvent):
(WebCore::DeviceController::fireDeviceEvent):
* page/DeviceController.h: Added.
(WebCore):
(DeviceController):
(WebCore::DeviceController::~DeviceController):
(WebCore::DeviceController::isActive):
(WebCore::DeviceController::client):
(WebCore::DeviceController::hasLastData):
(WebCore::DeviceController::getLastEvent):

Source/WebKit/qt:

Change client() to deviceOrientationClient() to get DeviceOrientationClient*.

* WebCoreSupport/DumpRenderTreeSupportQt.cpp:
(DumpRenderTreeSupportQt::setMockDeviceOrientation):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@133143 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Target.pri
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/dom/DeviceOrientationClient.h
Source/WebCore/dom/DeviceOrientationController.cpp
Source/WebCore/dom/DeviceOrientationController.h
Source/WebCore/dom/Document.cpp
Source/WebCore/loader/EmptyClients.h
Source/WebCore/page/DOMWindow.cpp
Source/WebCore/page/DeviceClient.h [new file with mode: 0644]
Source/WebCore/page/DeviceController.cpp [new file with mode: 0644]
Source/WebCore/page/DeviceController.h [new file with mode: 0644]
Source/WebKit/qt/ChangeLog
Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp