Changeset 63750 in webkit


Ignore:
Timestamp:
Jul 20, 2010 10:08:31 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-20 Hans Wennborg <hans@chromium.org>

Reviewed by Steve Block.

Runtime feature switch for device orientation
https://bugs.webkit.org/show_bug.cgi?id=42265

Add a runtime feature switch that decides whether device orientation
events are available or not. Defaults to true.

  • bindings/generic/RuntimeEnabledFeatures.cpp:
  • bindings/generic/RuntimeEnabledFeatures.h: (WebCore::RuntimeEnabledFeatures::setDeviceOrientationEnabled): (WebCore::RuntimeEnabledFeatures::deviceOrientationEnabled): (WebCore::RuntimeEnabledFeatures::deviceOrientationEventEnabled): (WebCore::RuntimeEnabledFeatures::ondeviceorientationEnabled):
  • page/DOMWindow.cpp: (WebCore::DOMWindow::addEventListener): (WebCore::DOMWindow::removeEventListener): (WebCore::DOMWindow::removeAllEventListeners):
  • page/DOMWindow.idl:
  • page/Page.cpp: (WebCore::Page::Page):

2010-07-20 Hans Wennborg <hans@chromium.org>

Reviewed by Steve Block.

Runtime feature switch for device orientation
https://bugs.webkit.org/show_bug.cgi?id=42265

Add a runtime feature switch that decides whether device orientation
events are available or not. Defaults to true.

  • public/WebRuntimeFeatures.h:
  • src/WebRuntimeFeatures.cpp: (WebKit::WebRuntimeFeatures::enableDeviceOrientation): (WebKit::WebRuntimeFeatures::isDeviceOrientationEnabled):
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63747 r63750  
     12010-07-20  Hans Wennborg  <hans@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        Runtime feature switch for device orientation
     6        https://bugs.webkit.org/show_bug.cgi?id=42265
     7
     8        Add a runtime feature switch that decides whether device orientation
     9        events are available or not. Defaults to true.
     10
     11        * bindings/generic/RuntimeEnabledFeatures.cpp:
     12        * bindings/generic/RuntimeEnabledFeatures.h:
     13        (WebCore::RuntimeEnabledFeatures::setDeviceOrientationEnabled):
     14        (WebCore::RuntimeEnabledFeatures::deviceOrientationEnabled):
     15        (WebCore::RuntimeEnabledFeatures::deviceOrientationEventEnabled):
     16        (WebCore::RuntimeEnabledFeatures::ondeviceorientationEnabled):
     17        * page/DOMWindow.cpp:
     18        (WebCore::DOMWindow::addEventListener):
     19        (WebCore::DOMWindow::removeEventListener):
     20        (WebCore::DOMWindow::removeAllEventListeners):
     21        * page/DOMWindow.idl:
     22        * page/Page.cpp:
     23        (WebCore::Page::Page):
     24
    1252010-07-20  Hayato Ito  <hayato@chromium.org>
    226
  • trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp

    r62920 r63750  
    4848bool RuntimeEnabledFeatures::isPushStateEnabled = false;
    4949bool RuntimeEnabledFeatures::isTouchEnabled = true;
     50bool RuntimeEnabledFeatures::isDeviceOrientationEnabled = true;
    5051
    5152#if ENABLE(VIDEO)
  • trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.h

    r62920 r63750  
    114114#endif
    115115
     116    static void setDeviceOrientationEnabled(bool isEnabled) { isDeviceOrientationEnabled = isEnabled; }
     117    static bool deviceOrientationEnabled() { return isDeviceOrientationEnabled; }
     118    static bool deviceOrientationEventEnabled() { return isDeviceOrientationEnabled; }
     119    static bool ondeviceorientationEnabled() { return isDeviceOrientationEnabled; }
     120
    116121private:
    117122    // Never instantiate.
     
    127132    static bool isPushStateEnabled;
    128133    static bool isTouchEnabled;
     134    static bool isDeviceOrientationEnabled;
    129135};
    130136
  • trunk/WebCore/page/DOMWindow.cpp

    r63689 r63750  
    14141414        addBeforeUnloadEventListener(this);
    14151415#if ENABLE(DEVICE_ORIENTATION)
    1416     else if (eventType == eventNames().deviceorientationEvent && frame() && frame()->page())
    1417         frame()->page()->deviceOrientation()->addListener(this);
     1416    else if (eventType == eventNames().deviceorientationEvent && frame() && frame()->page() && frame()->page()->deviceOrientationController())
     1417        frame()->page()->deviceOrientationController()->addListener(this);
    14181418#endif
    14191419
     
    14311431        removeBeforeUnloadEventListener(this);
    14321432#if ENABLE(DEVICE_ORIENTATION)
    1433     else if (eventType == eventNames().deviceorientationEvent && frame() && frame()->page())
    1434         frame()->page()->deviceOrientation()->removeListener(this);
     1433    else if (eventType == eventNames().deviceorientationEvent && frame() && frame()->page() && frame()->page()->deviceOrientationController())
     1434        frame()->page()->deviceOrientationController()->removeListener(this);
    14351435#endif
    14361436
     
    15091509
    15101510#if ENABLE(DEVICE_ORIENTATION)
    1511     if (frame() && frame()->page())
    1512         frame()->page()->deviceOrientation()->removeAllListeners(this);
     1511    if (frame() && frame()->page() && frame()->page()->deviceOrientationController())
     1512        frame()->page()->deviceOrientationController()->removeAllListeners(this);
    15131513#endif
    15141514
  • trunk/WebCore/page/DOMWindow.idl

    r62880 r63750  
    305305        attribute [Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
    306306
    307         attribute [Conditional=DEVICE_ORIENTATION] DeviceOrientationEventConstructor DeviceOrientationEvent;
    308         attribute [Conditional=DEVICE_ORIENTATION] EventListener ondeviceorientation;
     307        attribute [Conditional=DEVICE_ORIENTATION, EnabledAtRuntime] DeviceOrientationEventConstructor DeviceOrientationEvent;
     308        attribute [Conditional=DEVICE_ORIENTATION, EnabledAtRuntime] EventListener ondeviceorientation;
    309309
    310310        // EventTarget interface
  • trunk/WebCore/page/Page.cpp

    r63230 r63750  
    5858#include "RenderTheme.h"
    5959#include "RenderWidget.h"
     60#include "RuntimeEnabledFeatures.h"
    6061#include "ScriptController.h"
    6162#include "SelectionController.h"
     
    140141#endif
    141142#if ENABLE(DEVICE_ORIENTATION)
    142     , m_deviceOrientationController(new DeviceOrientationController(this, deviceOrientationClient))
     143    , m_deviceOrientationController(RuntimeEnabledFeatures::deviceOrientationEnabled() ? new DeviceOrientationController(this, deviceOrientationClient) : 0)
    143144#endif
    144145#if ENABLE(INPUT_SPEECH)
  • trunk/WebKit/chromium/ChangeLog

    r63723 r63750  
     12010-07-20  Hans Wennborg  <hans@chromium.org>
     2
     3        Reviewed by Steve Block.
     4
     5        Runtime feature switch for device orientation
     6        https://bugs.webkit.org/show_bug.cgi?id=42265
     7
     8        Add a runtime feature switch that decides whether device orientation
     9        events are available or not. Defaults to true.
     10
     11        * public/WebRuntimeFeatures.h:
     12        * src/WebRuntimeFeatures.cpp:
     13        (WebKit::WebRuntimeFeatures::enableDeviceOrientation):
     14        (WebKit::WebRuntimeFeatures::isDeviceOrientationEnabled):
     15
    1162010-07-19  Victoria Kirst  <vrk@google.com>
    217
  • trunk/WebKit/chromium/public/WebRuntimeFeatures.h

    r58496 r63750  
    7878    WEBKIT_API static bool isTouchEnabled();
    7979
     80    WEBKIT_API static void enableDeviceOrientation(bool);
     81    WEBKIT_API static bool isDeviceOrientationEnabled();
     82
    8083private:
    8184    WebRuntimeFeatures();
  • trunk/WebKit/chromium/src/WebRuntimeFeatures.cpp

    r61388 r63750  
    227227}
    228228
     229void WebRuntimeFeatures::enableDeviceOrientation(bool enable)
     230{
     231    RuntimeEnabledFeatures::setDeviceOrientationEnabled(enable);
     232}
     233
     234bool WebRuntimeFeatures::isDeviceOrientationEnabled()
     235{
     236    return RuntimeEnabledFeatures::deviceOrientationEnabled();
     237}
     238
    229239} // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.