Changeset 134918 in webkit


Ignore:
Timestamp:
Nov 16, 2012 2:19:41 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

    r134828 r134918  
    17071707    page/ContextMenuController.cpp
    17081708    page/Crypto.cpp
     1709    page/DeviceController.cpp
    17091710    page/DiagnosticLoggingKeys.cpp
    17101711    page/DOMSecurityPolicy.cpp
  • trunk/Source/WebCore/ChangeLog

    r134917 r134918  
     12012-11-16  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-11-16  Alexander Pavlov  <apavlov@chromium.org>
    273
  • trunk/Source/WebCore/GNUmakefile.list.am

    r134886 r134918  
    39873987        Source/WebCore/page/Crypto.cpp \
    39883988        Source/WebCore/page/Crypto.h \
     3989        Source/WebCore/page/DeviceClient.h \
     3990        Source/WebCore/page/DeviceController.cpp \
     3991        Source/WebCore/page/DeviceController.h \
    39893992        Source/WebCore/page/DiagnosticLoggingKeys.cpp \
    39903993        Source/WebCore/page/DiagnosticLoggingKeys.h \
  • trunk/Source/WebCore/Target.pri

    r134886 r134918  
    876876    page/ContextMenuController.cpp \
    877877    page/Crypto.cpp \
     878    page/DeviceController.cpp \
    878879    page/DiagnosticLoggingKeys.cpp \
    879880    page/DOMSelection.cpp \
     
    20042005    page/ContextMenuProvider.h \
    20052006    page/Coordinates.h \
     2007    page/DeviceClient.h \
     2008    page/DeviceController.h \
    20062009    page/DiagnosticLoggingKeys.h \
    20072010    page/DOMSelection.h \
  • trunk/Source/WebCore/WebCore.gypi

    r134911 r134918  
    30843084            'page/Crypto.cpp',
    30853085            'page/Crypto.h',
     3086            'page/DeviceClient.h',
     3087            'page/DeviceController.cpp',
     3088            'page/DeviceController.h',
    30863089            'page/DiagnosticLoggingKeys.cpp',
    30873090            'page/DiagnosticLoggingKeys.h',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r134911 r134918  
    2685126851                        </File>
    2685226852                        <File
     26853                                RelativePath="..\page\DeviceClient.h"
     26854                                >
     26855                        </File>
     26856                        <File
     26857                                RelativePath="..\page\DeviceController.cpp"
     26858                                >
     26859                        </File>
     26860                        <File
     26861                                RelativePath="..\page\DeviceController.h"
     26862                                >
     26863                        </File>
     26864                        <File
    2685326865                                RelativePath="..\page\DiagnosticLoggingKeys.cpp"
    2685426866                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r134886 r134918  
    58885888                CAE9F910146441F000C245B0 /* CSSAspectRatioValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */; };
    58895889                CAE9F910146441F000C245B1 /* CSSVariableValue.h in Headers */ = {isa = PBXBuildFile; fileRef = CAE9F90E146441F000C245B1 /* CSSVariableValue.h */; };
     5890                CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51015F613060048CDD6 /* DeviceClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
     5891                CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CCC2B51115F613060048CDD6 /* DeviceController.cpp */; };
     5892                CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */ = {isa = PBXBuildFile; fileRef = CCC2B51215F613060048CDD6 /* DeviceController.h */; settings = {ATTRIBUTES = (Private, ); }; };
    58905893                CD127DED14F3097D00E84779 /* WebCoreFullScreenWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */; };
    58915894                CD127DEE14F3098400E84779 /* WebCoreFullScreenWindow.h in Headers */ = {isa = PBXBuildFile; fileRef = CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    1327113274                CAE9F90E146441F000C245B0 /* CSSAspectRatioValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSAspectRatioValue.h; sourceTree = "<group>"; };
    1327213275                CAE9F90E146441F000C245B1 /* CSSVariableValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSVariableValue.h; sourceTree = "<group>"; };
     13276                CCC2B51015F613060048CDD6 /* DeviceClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceClient.h; sourceTree = "<group>"; };
     13277                CCC2B51115F613060048CDD6 /* DeviceController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceController.cpp; sourceTree = "<group>"; };
     13278                CCC2B51215F613060048CDD6 /* DeviceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceController.h; sourceTree = "<group>"; };
    1327313279                CD127DEA14F3097900E84779 /* WebCoreFullScreenWindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreFullScreenWindow.h; sourceTree = "<group>"; };
    1327413280                CD127DEB14F3097900E84779 /* WebCoreFullScreenWindow.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreFullScreenWindow.mm; sourceTree = "<group>"; };
     
    1585915865                                975CA288130365F800E99AD9 /* Crypto.h */,
    1586015866                                975CA289130365F800E99AD9 /* Crypto.idl */,
     15867                                CCC2B51015F613060048CDD6 /* DeviceClient.h */,
     15868                                CCC2B51115F613060048CDD6 /* DeviceController.cpp */,
     15869                                CCC2B51215F613060048CDD6 /* DeviceController.h */,
    1586115870                                CD37B37415C1A7E1006DC898 /* DiagnosticLoggingKeys.cpp */,
    1586215871                                CD37B37515C1A7E1006DC898 /* DiagnosticLoggingKeys.h */,
     
    2280422813                                FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */,
    2280522814                                A7C9ABF91357A3BF00F5503F /* DetailsMarkerControl.h in Headers */,
     22815                                CCC2B51415F613060048CDD6 /* DeviceClient.h in Headers */,
     22816                                CCC2B51615F613060048CDD6 /* DeviceController.h in Headers */,
    2280622817                                31FB1A57120A5D0600DC02A0 /* DeviceMotionClient.h in Headers */,
    2280722818                                31FB1A59120A5D0600DC02A0 /* DeviceMotionController.h in Headers */,
     
    2636126372                                93309DE0099E64920056E581 /* DeleteSelectionCommand.cpp in Sources */,
    2636226373                                A7C9ABF81357A3BF00F5503F /* DetailsMarkerControl.cpp in Sources */,
     26374                                CCC2B51515F613060048CDD6 /* DeviceController.cpp in Sources */,
    2636326375                                31FB1A58120A5D0600DC02A0 /* DeviceMotionController.cpp in Sources */,
    2636426376                                31FB1A5A120A5D0600DC02A0 /* DeviceMotionData.cpp in Sources */,
  • trunk/Source/WebCore/dom/DeviceOrientationClient.h

    r133167 r134918  
    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

    r133976 r134918  
    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)
    56 {
    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);
    68 }
    69 
    70 void DeviceOrientationController::addListener(DOMWindow* window)
    71 {
    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();
    86 }
    87 
    88 void DeviceOrientationController::removeListener(DOMWindow* window)
    89 {
    90     m_listeners.remove(window);
    91     m_suspendedListeners.remove(window);
    92     m_newListeners.remove(window);
    93     if (m_listeners.isEmpty())
    94         m_client->stopUpdating();
    95 }
    96 
    97 void DeviceOrientationController::removeAllListeners(DOMWindow* window)
    98 {
    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 
    13250void DeviceOrientationController::didChangeDeviceOrientation(DeviceOrientationData* orientation)
    13351{
    13452    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);
     53    dispatchDeviceEvent(DeviceOrientationEvent::create(eventNames().deviceorientationEvent, orientation));
     54}
     55
     56DeviceOrientationClient* DeviceOrientationController::deviceOrientationClient()
     57{
     58    return static_cast<DeviceOrientationClient*>(m_client);
     59}
     60
     61bool DeviceOrientationController::hasLastData()
     62{
     63    return deviceOrientationClient()->lastOrientation();
     64}
     65
     66PassRefPtr<Event> DeviceOrientationController::getLastEvent()
     67{
     68    return DeviceOrientationEvent::create(eventNames().deviceorientationEvent, deviceOrientationClient()->lastOrientation());
    14069}
    14170
     
    14473    DEFINE_STATIC_LOCAL(AtomicString, name, ("DeviceOrientationController", AtomicString::ConstructFromLiteral));
    14574    return name;
     75}
     76
     77DeviceOrientationController* DeviceOrientationController::from(Page* page)
     78{
     79    return static_cast<DeviceOrientationController*>(Supplement<Page>::from(page, supplementName()));
    14680}
    14781
  • trunk/Source/WebCore/dom/DeviceOrientationController.h

    r133167 r134918  
    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

    r134714 r134918  
    21772177    if (DeviceMotionController* controller = DeviceMotionController::from(page()))
    21782178        controller->suspendEventsForAllListeners(domWindow());
    2179     if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    2180         controller->suspendEventsForAllListeners(domWindow());
    2181 
    21822179#endif
    21832180}
     
    21922189
    21932190    if (DeviceMotionController* controller = DeviceMotionController::from(page()))
    2194         controller->resumeEventsForAllListeners(domWindow());
    2195     if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    21962191        controller->resumeEventsForAllListeners(domWindow());
    21972192#endif
  • trunk/Source/WebCore/loader/EmptyClients.h

    r133396 r134918  
    578578};
    579579
     580class EmptyDeviceClient : public DeviceClient {
     581public:
     582    virtual void startUpdating() OVERRIDE { }
     583    virtual void stopUpdating() OVERRIDE { }
     584};
     585
    580586class EmptyDeviceMotionClient : public DeviceMotionClient {
    581587public:
     
    590596public:
    591597    virtual void setController(DeviceOrientationController*) { }
    592     virtual void startUpdating() { }
    593     virtual void stopUpdating() { }
    594598    virtual DeviceOrientationData* lastOrientation() const { return 0; }
    595599    virtual void deviceOrientationControllerDestroyed() { }
  • trunk/Source/WebCore/page/DOMWindow.cpp

    r134586 r134918  
    16001600    } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
    16011601        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    1602             controller->addListener(this);
     1602            controller->addDeviceEventListener(this);
    16031603    }
    16041604#endif
     
    16291629    } else if (eventType == eventNames().deviceorientationEvent) {
    16301630        if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    1631             controller->removeListener(this);
     1631            controller->removeDeviceEventListener(this);
    16321632    }
    16331633#endif
     
    16861686        controller->removeAllListeners(this);
    16871687    if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
    1688         controller->removeAllListeners(this);
     1688        controller->removeAllDeviceEventListeners(this);
    16891689#endif
    16901690
  • trunk/Source/WebKit/qt/ChangeLog

    r134596 r134918  
     12012-11-16  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-11-14  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/Source/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp

    r133167 r134918  
    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.