Changeset 63810 in webkit


Ignore:
Timestamp:
Jul 21, 2010 3:42:35 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-07-21 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.

  • WebCore.vcproj/WebCoreCommon.vsprops: Add bindings/generic to include path.
  • 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-21 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:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r63809 r63810  
     12010-07-21  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        * WebCore.vcproj/WebCoreCommon.vsprops: Add bindings/generic to include path.
     12        * bindings/generic/RuntimeEnabledFeatures.cpp:
     13        * bindings/generic/RuntimeEnabledFeatures.h:
     14        (WebCore::RuntimeEnabledFeatures::setDeviceOrientationEnabled):
     15        (WebCore::RuntimeEnabledFeatures::deviceOrientationEnabled):
     16        (WebCore::RuntimeEnabledFeatures::deviceOrientationEventEnabled):
     17        (WebCore::RuntimeEnabledFeatures::ondeviceorientationEnabled):
     18        * page/DOMWindow.cpp:
     19        (WebCore::DOMWindow::addEventListener):
     20        (WebCore::DOMWindow::removeEventListener):
     21        (WebCore::DOMWindow::removeAllEventListeners):
     22        * page/DOMWindow.idl:
     23        * page/Page.cpp:
     24        (WebCore::Page::Page):
     25
    1262010-07-21  Zoltan Herczeg  <zherczeg@webkit.org>
    227
  • trunk/WebCore/WebCore.vcproj/WebCoreCommon.vsprops

    r63802 r63810  
    88        <Tool
    99                Name="VCCLCompilerTool"
    10                 AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;"
     10                AdditionalIncludeDirectories="&quot;$(ProjectDir)..&quot;;&quot;$(ProjectDir)..\accessibility&quot;;&quot;$(ProjectDir)..\accessibility\win&quot;;&quot;$(ProjectDir)..\bridge&quot;;&quot;$(ProjectDir)..\bridge\c&quot;;&quot;$(ProjectDir)..\bridge\jsc&quot;;&quot;$(ProjectDir)..\css&quot;;&quot;$(ProjectDir)..\editing&quot;;&quot;$(ProjectDir)..\rendering&quot;;&quot;$(ProjectDir)..\rendering\style&quot;;&quot;$(ProjectDir)..\bindings&quot;;&quot;$(ProjectDir)..\bindings\generic&quot;;&quot;$(ProjectDir)..\bindings\js&quot;;&quot;$(ProjectDir)..\dom&quot;;&quot;$(ProjectDir)..\dom\default&quot;;&quot;$(ProjectDir)..\history&quot;;&quot;$(ProjectDir)..\html&quot;;&quot;$(ProjectDir)..\html\canvas&quot;;&quot;$(ProjectDir)..\inspector&quot;;&quot;$(ProjectDir)..\loader&quot;;&quot;$(ProjectDir)..\loader\appcache&quot;;&quot;$(ProjectDir)..\loader\archive&quot;;&quot;$(ProjectDir)..\loader\archive\cf&quot;;&quot;$(ProjectDir)..\loader\icon&quot;;&quot;$(ProjectDir)..\notifications&quot;;&quot;$(ProjectDir)..\page&quot;;&quot;$(ProjectDir)..\page\animation&quot;;&quot;$(ProjectDir)..\page\win&quot;;&quot;$(ProjectDir)..\platform&quot;;&quot;$(ProjectDir)..\platform\animation&quot;;&quot;$(ProjectDir)..\platform\mock&quot;;&quot;$(ProjectDir)..\platform\sql&quot;;&quot;$(ProjectDir)..\platform\win&quot;;&quot;$(ProjectDir)..\platform\network&quot;;&quot;$(ProjectDir)..\platform\network\win&quot;;&quot;$(ProjectDir)..\platform\cf&quot;;&quot;$(ProjectDir)..\platform\graphics&quot;;&quot;$(ProjectDir)..\platform\graphics\filters&quot;;&quot;$(ProjectDir)..\platform\graphics\opentype&quot;;&quot;$(ProjectDir)..\platform\graphics\transforms&quot;;&quot;$(ProjectDir)..\platform\text&quot;;&quot;$(ProjectDir)..\platform\text\transcoder&quot;;&quot;$(ProjectDir)..\platform\graphics\win&quot;;&quot;$(ProjectDir)..\xml&quot;;&quot;$(WebKitOutputDir)\obj\WebCore\DerivedSources&quot;;&quot;$(ProjectDir)..\plugins&quot;;&quot;$(ProjectDir)..\plugins\win&quot;;&quot;$(ProjectDir)..\svg\animation&quot;;&quot;$(ProjectDir)..\svg\graphics&quot;;&quot;$(ProjectDir)..\svg\graphics\filters&quot;;&quot;$(ProjectDir)..\svg&quot;;&quot;$(ProjectDir)..\wml&quot;;&quot;$(ProjectDir)..\storage&quot;;&quot;$(ProjectDir)..\websockets&quot;;&quot;$(ProjectDir)..\workers&quot;;&quot;$(WebKitOutputDir)\include&quot;;&quot;$(WebKitOutputDir)\include\private&quot;;&quot;$(WebKitOutputDir)\include\JavaScriptCore&quot;;&quot;$(WebKitOutputDir)\include\private\JavaScriptCore&quot;;&quot;$(ProjectDir)..\ForwardingHeaders&quot;;&quot;$(WebKitLibrariesDir)\include&quot;;&quot;$(WebKitLibrariesDir)\include\private&quot;;&quot;$(WebKitLibrariesDir)\include\private\JavaScriptCore&quot;;&quot;$(WebKitLibrariesDir)\include\pthreads&quot;;&quot;$(WebKitLibrariesDir)\include\sqlite&quot;;&quot;$(WebKitLibrariesDir)\include\JavaScriptCore&quot;"
    1111                PreprocessorDefinitions="__WIN32__;DISABLE_3D_RENDERING;WEBCORE_CONTEXT_MENUS"
    1212                UsePrecompiledHeader="2"
  • trunk/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp

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

    r63759 r63810  
    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

    r63759 r63810  
    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

    r63759 r63810  
    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

    r63759 r63810  
    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

    r63806 r63810  
     12010-07-21  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-21  Yury Semikhatsky  <yurys@chromium.org>
    217
  • trunk/WebKit/chromium/public/WebRuntimeFeatures.h

    r63759 r63810  
    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

    r63759 r63810  
    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.