Changeset 133016 in webkit


Ignore:
Timestamp:
Oct 31, 2012 5:55:54 AM (11 years ago)
Author:
kihong.kwon@samsung.com
Message:

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):

Location:
trunk/Source
Files:
3 added
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/CMakeLists.txt

    r132960 r133016  
    17111711    page/ContextMenuController.cpp
    17121712    page/Crypto.cpp
     1713    page/DeviceController.cpp
    17131714    page/DiagnosticLoggingKeys.cpp
    17141715    page/DOMSecurityPolicy.cpp
  • trunk/Source/WebCore/ChangeLog

    r133015 r133016  
     12012-10-31  Kihong Kwon  <kihong.kwon@samsung.com>
     2
     3        Add DeviceController base-class to remove duplication of DeviceXXXControler
     4        https://bugs.webkit.org/show_bug.cgi?id=96894
     5
     6        Reviewed by Hajime Morita.
     7
     8        Add DeviceController which is extracted from DeviceOrientationController to remove duplication.
     9        And soon-to-be-added DeviceMotionController and ProximityController.
     10
     11        Covered by existing tests.
     12
     13        * CMakeLists.txt:
     14        * GNUmakefile.list.am:
     15        * Target.pri:
     16        * WebCore.gypi:
     17        * WebCore.vcproj/WebCore.vcproj:
     18        * WebCore.xcodeproj/project.pbxproj:
     19        * dom/DeviceOrientationClient.h:
     20        * dom/DeviceOrientationController.cpp:
     21        Remove member functions to move to DeviceController.
     22        - addListener(), removeListener(), removeAllListeners(), isActive()
     23        (WebCore::DeviceOrientationController::DeviceOrientationController):
     24        (WebCore::DeviceOrientationController::didChangeDeviceOrientation):
     25        (WebCore::DeviceOrientationController::client):
     26        (WebCore::DeviceOrientationController::hasLastData):
     27        (WebCore::DeviceOrientationController::getLastEvent):
     28        (WebCore::DeviceOrientationController::from):
     29        (WebCore):
     30        * dom/DeviceOrientationController.h:
     31        (WebCore):
     32        (WebCore::DeviceOrientationController::~DeviceOrientationController):
     33        (DeviceOrientationController):
     34        * dom/Document.cpp:
     35        Remove suspendEventsForAllListeners() and resumeEventsForAllListeners() function calls.
     36        These calls can be made by checking activeDOMObjectsAreSuspended() and activeDOMObjectsAreStopped() before dispatchEvent.
     37        (WebCore::Document::suspendActiveDOMObjects):
     38        (WebCore::Document::resumeActiveDOMObjects):
     39        * loader/EmptyClients.h:
     40        (EmptyDeviceClient):
     41        (WebCore::EmptyDeviceClient::startUpdating):
     42        (WebCore::EmptyDeviceClient::stopUpdating):
     43        (WebCore):
     44        * page/DOMWindow.cpp:
     45        (WebCore::DOMWindow::addEventListener):
     46        (WebCore::DOMWindow::removeEventListener):
     47        (WebCore::DOMWindow::removeAllEventListeners):
     48        * page/DeviceClient.h: Added.
     49        (WebCore):
     50        (DeviceClient):
     51        (WebCore::DeviceClient::~DeviceClient):
     52        * page/DeviceController.cpp: Added.
     53        DeviceController has extracted functions from DeviceOrientationController and DeviceMotionController.
     54        - addDeviceEventListener(), removeDeviceEventlistener(), removeAllDeviceEventListeners(), dispatchDeviceEvent()
     55        All kind of device event controller which has DeviceClient can be inherited from DeviceController.
     56        (WebCore):
     57        (WebCore::DeviceController::DeviceController):
     58        (WebCore::DeviceController::addDeviceEventListener):
     59        (WebCore::DeviceController::removeDeviceEventListener):
     60        (WebCore::DeviceController::removeAllDeviceEventListeners):
     61        (WebCore::DeviceController::dispatchDeviceEvent):
     62        (WebCore::DeviceController::fireDeviceEvent):
     63        * page/DeviceController.h: Added.
     64        (WebCore):
     65        (DeviceController):
     66        (WebCore::DeviceController::~DeviceController):
     67        (WebCore::DeviceController::isActive):
     68        (WebCore::DeviceController::client):
     69        (WebCore::DeviceController::hasLastData):
     70        (WebCore::DeviceController::getLastEvent):
     71
    1722012-10-31  Pavel Feldman  <pfeldman@chromium.org>
    273
  • trunk/Source/WebCore/GNUmakefile.list.am

    r132960 r133016  
    40084008        Source/WebCore/page/Crypto.cpp \
    40094009        Source/WebCore/page/Crypto.h \
     4010        Source/WebCore/page/DeviceClient.h \
     4011        Source/WebCore/page/DeviceController.cpp \
     4012        Source/WebCore/page/DeviceController.h \
    40104013        Source/WebCore/page/DiagnosticLoggingKeys.cpp \
    40114014        Source/WebCore/page/DiagnosticLoggingKeys.h \
  • trunk/Source/WebCore/Target.pri

    r132960 r133016  
    872872    page/ContextMenuController.cpp \
    873873    page/Crypto.cpp \
     874    page/DeviceController.cpp \
    874875    page/DiagnosticLoggingKeys.cpp \
    875876    page/DOMSelection.cpp \
     
    19981999    page/ContextMenuProvider.h \
    19992000    page/Coordinates.h \
     2001    page/DeviceClient.h \
     2002    page/DeviceController.h \
    20002003    page/DiagnosticLoggingKeys.h \
    20012004    page/DOMSelection.h \
  • trunk/Source/WebCore/WebCore.gypi

    r132960 r133016  
    31143114            'page/Crypto.cpp',
    31153115            'page/Crypto.h',
     3116            'page/DeviceClient.h',
     3117            'page/DeviceController.cpp',
     3118            'page/DeviceController.h',
    31163119            'page/DiagnosticLoggingKeys.cpp',
    31173120            'page/DiagnosticLoggingKeys.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r132960 r133016  
    2696426964                        </File>
    2696526965                        <File
     26966                                RelativePath="..\page\DeviceClient.h"
     26967                                >
     26968                        </File>
     26969                        <File
     26970                                RelativePath="..\page\DeviceController.cpp"
     26971                                >
     26972                        </File>
     26973                        <File
     26974                                RelativePath="..\page\DeviceController.h"
     26975                                >
     26976                        </File>
     26977                        <File
    2696626978                                RelativePath="..\page\DiagnosticLoggingKeys.cpp"
    2696726979                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r132992 r133016  
    58925892                CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */; };
    58935893                CAE9F910146441F000C245B1 /* CSSVariableValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B1 /* CSSVariableValue.h */; };
     5894                CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51015F613060048CDD6 /* DeviceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
     5895                CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CCC2B51115F613060048CDD6 /* DeviceController.cpp */; };
     5896                CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51215F613060048CDD6 /* DeviceController.h */; settings = {ATTRIBUTES = (Private, ); }; };
    58945897                CD127DED14F3097D00E84779 /* WebCoreFullScreenWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */; };
    58955898                CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1326713270                CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAspectRatioValue.h; sourceTree = "<group>"; };
    1326813271                CAE9F90E146441F000C245B1 /* CSSVariableValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableValue.h; sourceTree = "<group>"; };
     13272                CCC2B51015F613060048CDD6 /* DeviceClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceClient.h; sourceTree = "<group>"; };
     13273                CCC2B51115F613060048CDD6 /* DeviceController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceController.cpp; sourceTree = "<group>"; };
     13274                CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = "<group>"; };
    1326913275                CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWindow.h; sourceTree = "<group>"; };
    1327013276                CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWindow.mm; sourceTree = "<group>"; };
     
    1585515861                                975CA288130365F800E99AD9 /* Crypto.h */,
    1585615862                                975CA289130365F800E99AD9 /* Crypto.idl */,
     15863                                CCC2B51015F613060048CDD6 /* DeviceClient.h */,
     15864                                CCC2B51115F613060048CDD6 /* DeviceController.cpp */,
     15865                                CCC2B51215F613060048CDD6 /* DeviceController.h */,
    1585715866                                CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */,
    1585815867                                CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */,
     
    2277822787                                FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */,
    2277922788                                A7C9ABF91357A3BF00F5503F /* DetailsMarkerControl.h in Headers */,
     22789                                CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */,
     22790                                CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */,
    2278022791                                31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */,
    2278122792                                31FB1A59120A5D0600DC02A0 /* DeviceMotionController.h in Headers */,
     
    2633626347                                93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */,
    2633726348                                A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */,
     26349                                CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */,
    2633826350                                31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */,
    2633926351                                31FB1A5A120A5D0600DC02A0 /* DeviceMotionData.cpp in Sources */,
  • trunk/Source/WebCore/dom/DeviceOrientationClient.h

    r121016 r133016  
    11/*
    22 * Copyright 2010, The Android Open Source Project
     3 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2728#define DeviceOrientationClient_h
    2829
     30#include "DeviceClient.h"
     31
    2932namespace WebCore {
    3033
     
    3336class Page;
    3437
    35 class DeviceOrientationClient {
     38class DeviceOrientationClient : public DeviceClient {
    3639public:
    3740    virtual ~DeviceOrientationClient() {}
    3841    virtual void setController(DeviceOrientationController*) = 0;
    39     virtual void startUpdating() = 0;
    40     virtual void stopUpdating() = 0;
    4142    virtual DeviceOrientationData* lastOrientation() const = 0;
    4243    virtual void deviceOrientationControllerDestroyed() = 0;
  • trunk/Source/WebCore/dom/DeviceOrientationController.cpp

    r124484 r133016  
    11/*
    22 * Copyright 2010, The Android Open Source Project
     3 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3536
    3637DeviceOrientationController::DeviceOrientationController(Page* page, DeviceOrientationClient* client)
    37     : m_client(client)
     38    : DeviceController(client)
    3839    , m_page(page)
    39     , m_timer(this, &DeviceOrientationController::timerFired)
    4040{
    4141    ASSERT(m_client);
    42     m_client->setController(this);
    43 }
    44 
    45 DeviceOrientationController::~DeviceOrientationController()
    46 {
    47     m_client->deviceOrientationControllerDestroyed();
     42    deviceOrientationClient()->setController(this);
    4843}
    4944
     
    5348}
    5449
    55 void DeviceOrientationController::timerFired(Timer<DeviceOrientationController>* timer)
     50void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
    5651{
    57     ASSERT_UNUSED(timer, timer == &m_timer);
    58     ASSERT(m_client->lastOrientation());
    59 
    60     RefPtr<DeviceOrientationData> orientation = m_client->lastOrientation();
    61     RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation.get());
    62 
    63     Vector<RefPtr<DOMWindow> > listenersVector;
    64     copyToVector(m_newListeners, listenersVector);
    65     m_newListeners.clear();
    66     for (size_t i = 0; i < listenersVector.size(); ++i)
    67         listenersVector[i]->dispatchEvent(event);
     52    dispatchDeviceEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation));
    6853}
    6954
    70 void DeviceOrientationController::addListener(DOMWindow* window)
     55DeviceOrientationClient* DeviceOrientationController::deviceOrientationClient()
    7156{
    72     // If the client already has an orientation, we should fire an event with that
    73     // orientation. The event is fired asynchronously, but without
    74     // waiting for the client to get a new orientation.
    75     if (m_client->lastOrientation()) {
    76         m_newListeners.add(window);
    77         if (!m_timer.isActive())
    78             m_timer.startOneShot(0);
    79     }
    80 
    81     // The client must not call back synchronously.
    82     bool wasEmpty = m_listeners.isEmpty();
    83     m_listeners.add(window);
    84     if (wasEmpty)
    85         m_client->startUpdating();
     57    return static_cast<DeviceOrientationClient*>(m_client);
    8658}
    8759
    88 void DeviceOrientationController::removeListener(DOMWindow* window)
     60bool DeviceOrientationController::hasLastData()
    8961{
    90     m_listeners.remove(window);
    91     m_suspendedListeners.remove(window);
    92     m_newListeners.remove(window);
    93     if (m_listeners.isEmpty())
    94         m_client->stopUpdating();
     62    return deviceOrientationClient()->lastOrientation();
    9563}
    9664
    97 void DeviceOrientationController::removeAllListeners(DOMWindow* window)
     65PassRefPtr<Event> DeviceOrientationController::getLastEvent()
    9866{
    99     // May be called with a DOMWindow that's not a listener.
    100     if (!m_listeners.contains(window))
    101         return;
    102 
    103     m_listeners.removeAll(window);
    104     m_suspendedListeners.removeAll(window);
    105     m_newListeners.remove(window);
    106     if (m_listeners.isEmpty())
    107         m_client->stopUpdating();
    108 }
    109 
    110 void DeviceOrientationController::suspendEventsForAllListeners(DOMWindow* window)
    111 {
    112     if (!m_listeners.contains(window))
    113         return;
    114 
    115     int count = m_listeners.count(window);
    116     removeAllListeners(window);
    117     while (count--)
    118         m_suspendedListeners.add(window);
    119 }
    120 
    121 void DeviceOrientationController::resumeEventsForAllListeners(DOMWindow* window)
    122 {
    123     if (!m_suspendedListeners.contains(window))
    124         return;
    125 
    126     int count = m_suspendedListeners.count(window);
    127     m_suspendedListeners.removeAll(window);
    128     while (count--)
    129         addListener(window);
    130 }
    131 
    132 void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
    133 {
    134     orientation = InspectorInstrumentation::overrideDeviceOrientation(m_page, orientation);
    135     RefPtr<DeviceOrientationEvent> event = DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation);
    136     Vector<RefPtr<DOMWindow> > listenersVector;
    137     copyToVector(m_listeners, listenersVector);
    138     for (size_t i = 0; i < listenersVector.size(); ++i)
    139         listenersVector[i]->dispatchEvent(event);
     67    return DeviceOrientationEvent::create(eventNames().deviceorientationEvent, deviceOrientationClient()->lastOrientation());
    14068}
    14169
     
    14472    DEFINE_STATIC_LOCAL(AtomicString, name, ("DeviceOrientationController"));
    14573    return name;
     74}
     75
     76DeviceOrientationController* DeviceOrientationController::from(Page* page)
     77{
     78    return static_cast<DeviceOrientationController*>(Supplement<Page>::from(page, supplementName()));
    14679}
    14780
  • trunk/Source/WebCore/dom/DeviceOrientationController.h

    r124484 r133016  
    11/*
    22 * Copyright 2010, The Android Open Source Project
     3 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    2728#define DeviceOrientationController_h
    2829
    29 #include "DOMWindow.h"
    30 #include "Page.h"
    31 #include "Timer.h"
    32 
     30#include "DeviceController.h"
    3331#include <wtf/HashCountedSet.h>
    3432
    3533namespace WebCore {
    3634
     35class DeviceOrientationClient;
    3736class DeviceOrientationData;
    38 class DeviceOrientationClient;
    3937
    40 class DeviceOrientationController : public Supplement<Page> {
     38class DeviceOrientationController : public DeviceController {
    4139public:
    42     ~DeviceOrientationController();
     40    ~DeviceOrientationController() { };
    4341
    4442    static PassOwnPtr<DeviceOrientationController> create(Page*, DeviceOrientationClient*);
    4543
    46     void addListener(DOMWindow*);
    47     void removeListener(DOMWindow*);
    48     void removeAllListeners(DOMWindow*);
     44    void didChangeDeviceOrientation(DeviceOrientationData*);
     45    DeviceOrientationClient* deviceOrientationClient();
    4946
    50     void suspendEventsForAllListeners(DOMWindow*);
    51     void resumeEventsForAllListeners(DOMWindow*);
    52 
    53     void didChangeDeviceOrientation(DeviceOrientationData*);
    54 
    55     bool isActive() { return !m_listeners.isEmpty(); }
    56 
    57     DeviceOrientationClient* client() const { return m_client; }
     47    virtual bool hasLastData() OVERRIDE;
     48    virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
    5849
    5950    static const AtomicString& supplementName();
    60     static DeviceOrientationController* from(Page* page) { return static_cast<DeviceOrientationController*>(Supplement<Page>::from(page, supplementName())); }
     51    static DeviceOrientationController* from(Page*);
    6152    static bool isActiveAt(Page*);
    6253
    6354private:
    64     explicit DeviceOrientationController(Page*, DeviceOrientationClient*);
     55    DeviceOrientationController(Page*, DeviceOrientationClient*);
    6556
    66     void timerFired(Timer<DeviceOrientationController>*);
    67 
    68     DeviceOrientationClient* m_client;
    6957    Page* m_page;
    70     typedef HashCountedSet<RefPtr<DOMWindow> > ListenersCountedSet;
    71     ListenersCountedSet m_listeners;
    72     ListenersCountedSet m_suspendedListeners;
    73     typedef HashSet<RefPtr<DOMWindow> > ListenersSet;
    74     ListenersSet m_newListeners;
    75     Timer<DeviceOrientationController> m_timer;
    7658};
    7759
  • trunk/Source/WebCore/dom/Document.cpp

    r132918 r133016  
    21822182    if (DeviceMotionController* controller = DeviceMotionController::from(page()))
    21832183        controller->suspendEventsForAllListeners(domWindow());
    2184     if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    2185         controller->suspendEventsForAllListeners(domWindow());
    2186 
    21872184#endif
    21882185}
     
    21972194
    21982195    if (DeviceMotionController* controller = DeviceMotionController::from(page()))
    2199         controller->resumeEventsForAllListeners(domWindow());
    2200     if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    22012196        controller->resumeEventsForAllListeners(domWindow());
    22022197#endif
  • trunk/Source/WebCore/loader/EmptyClients.h

    r132915 r133016  
    574574};
    575575
     576class EmptyDeviceClient : public DeviceClient {
     577public:
     578    virtual void startUpdating() OVERRIDE { }
     579    virtual void stopUpdating() OVERRIDE { }
     580};
     581
    576582class EmptyDeviceMotionClient : public DeviceMotionClient {
    577583public:
     
    586592public:
    587593    virtual void setController(DeviceOrientationController*) { }
    588     virtual void startUpdating() { }
    589     virtual void stopUpdating() { }
    590594    virtual DeviceOrientationData* lastOrientation() const { return 0; }
    591595    virtual void deviceOrientationControllerDestroyed() { }
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r132183 r133016  
    16021602    } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
    16031603        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    1604             controller->addListener(this);
     1604            controller->addDeviceEventListener(this);
    16051605    }
    16061606#endif
     
    16311631    } else if (eventType == eventNames().deviceorientationEvent) {
    16321632        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    1633             controller->removeListener(this);
     1633            controller->removeDeviceEventListener(this);
    16341634    }
    16351635#endif
     
    16881688        controller->removeAllListeners(this);
    16891689    if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    1690         controller->removeAllListeners(this);
     1690        controller->removeAllDeviceEventListeners(this);
    16911691#endif
    16921692
  • trunk/Source/WebKit/qt/ChangeLog

    r132900 r133016  
     12012-10-31  Kihong Kwon  <kihong.kwon@samsung.com>
     2
     3        Add DeviceController base-class to remove duplication of DeviceXXXControler
     4        https://bugs.webkit.org/show_bug.cgi?id=96894
     5
     6        Reviewed by Hajime Morita.
     7
     8        Change client() to deviceOrientationClient() to get DeviceOrientationClient*.
     9
     10        * WebCoreSupport/DumpRenderTreeSupportQt.cpp:
     11        (DumpRenderTreeSupportQt::setMockDeviceOrientation):
     12
    1132012-10-30  Mikhail Pozdnyakov  <mikhail.pozdnyakov@intel.com>
    214
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r132900 r133016  
    714714#if ENABLE(DEVICE_ORIENTATION)
    715715    Page* corePage = QWebPagePrivate::core(page);
    716     DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->client());
     716    DeviceOrientationClientMock* mockClient = toDeviceOrientationClientMock(DeviceOrientationController::from(corePage)->deviceOrientationClient());
    717717    mockClient->setOrientation(DeviceOrientationData::create(canProvideAlpha, alpha, canProvideBeta, beta, canProvideGamma, gamma));
    718718#endif
Note: See TracChangeset for help on using the changeset viewer.