Commit fb485b06 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2010-04-27 Garret Kelly <gdk@chromium.org>

        Reviewed by Darin Fisher.

        Turn all of the touch event handlers into RuntimeEnabledFeatures, and
        modify the createEvent methond on Document so that it won't create a
        TouchEvent if the feature is disabled.
        https://bugs.webkit.org/show_bug.cgi?id=37485

        * bindings/generic/RuntimeEnabledFeatures.cpp:
        * bindings/generic/RuntimeEnabledFeatures.h:
        (WebCore::RuntimeEnabledFeatures::touchEnabled):
        (WebCore::RuntimeEnabledFeatures::setTouchEnabled):
        (WebCore::RuntimeEnabledFeatures::ontouchstartEnabled):
        (WebCore::RuntimeEnabledFeatures::ontouchmoveEnabled):
        (WebCore::RuntimeEnabledFeatures::ontouchendEnabled):
        (WebCore::RuntimeEnabledFeatures::ontouchcancelEnabled):
        * dom/Document.cpp:
        (WebCore::Document::createEvent):
        * dom/Document.idl:
        * dom/Element.idl:
        * page/DOMWindow.idl:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58363 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 811b43c4
2010-04-27 Garret Kelly <gdk@chromium.org>
Reviewed by Darin Fisher.
Turn all of the touch event handlers into RuntimeEnabledFeatures, and
modify the createEvent methond on Document so that it won't create a
TouchEvent if the feature is disabled.
https://bugs.webkit.org/show_bug.cgi?id=37485
* bindings/generic/RuntimeEnabledFeatures.cpp:
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::touchEnabled):
(WebCore::RuntimeEnabledFeatures::setTouchEnabled):
(WebCore::RuntimeEnabledFeatures::ontouchstartEnabled):
(WebCore::RuntimeEnabledFeatures::ontouchmoveEnabled):
(WebCore::RuntimeEnabledFeatures::ontouchendEnabled):
(WebCore::RuntimeEnabledFeatures::ontouchcancelEnabled):
* dom/Document.cpp:
(WebCore::Document::createEvent):
* dom/Document.idl:
* dom/Element.idl:
* page/DOMWindow.idl:
2010-04-27 Jens Alfke <snej@chromium.org>
 
Reviewed by Darin Fisher.
......@@ -46,6 +46,7 @@ bool RuntimeEnabledFeatures::isGeolocationEnabled = true;
bool RuntimeEnabledFeatures::isIndexedDBEnabled = false;
bool RuntimeEnabledFeatures::isWebGLEnabled = false;
bool RuntimeEnabledFeatures::isPushStateEnabled = false;
bool RuntimeEnabledFeatures::isTouchEnabled = true;
#if ENABLE(VIDEO)
......
......@@ -94,6 +94,15 @@ public:
static bool pushStateEnabled() { return isPushStateEnabled; }
static bool replaceStateEnabled() { return isPushStateEnabled; }
#if ENABLE(TOUCH_EVENTS)
static bool touchEnabled() { return isTouchEnabled; }
static void setTouchEnabled(bool isEnabled) { isTouchEnabled = isEnabled; }
static bool ontouchstartEnabled() { return isTouchEnabled; }
static bool ontouchmoveEnabled() { return isTouchEnabled; }
static bool ontouchendEnabled() { return isTouchEnabled; }
static bool ontouchcancelEnabled() { return isTouchEnabled; }
#endif
private:
// Never instantiate.
RuntimeEnabledFeatures() { }
......@@ -106,6 +115,7 @@ private:
static bool isIndexedDBEnabled;
static bool isWebGLEnabled;
static bool isPushStateEnabled;
static bool isTouchEnabled;
};
} // namespace WebCore
......
......@@ -173,6 +173,9 @@
#endif
#if ENABLE(TOUCH_EVENTS)
#if USE(V8)
#include "RuntimeEnabledFeatures.h"
#endif
#include "TouchEvent.h"
#endif
......@@ -3153,7 +3156,11 @@ PassRefPtr<Event> Document::createEvent(const String& eventType, ExceptionCode&
event = SVGZoomEvent::create();
#endif
#if ENABLE(TOUCH_EVENTS)
#if USE(V8)
else if (eventType == "TouchEvent" && RuntimeEnabledFeatures::touchEnabled())
#else
else if (eventType == "TouchEvent")
#endif
event = TouchEvent::create();
#endif
if (event)
......
......@@ -306,10 +306,10 @@ module core {
attribute [DontEnum] EventListener onreset;
attribute [DontEnum] EventListener onsearch;
attribute [DontEnum] EventListener onselectstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchmove;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchend;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchcancel;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
#endif
};
......
......@@ -195,10 +195,10 @@ module core {
attribute [DontEnum] EventListener onreset;
attribute [DontEnum] EventListener onsearch;
attribute [DontEnum] EventListener onselectstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchmove;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchend;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchcancel;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
#endif
};
......
......@@ -293,10 +293,10 @@ module window {
#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
attribute EventListener onorientationchange;
#endif
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchmove;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchend;
attribute [DontEnum,Conditional=TOUCH_EVENTS] EventListener ontouchcancel;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
// EventTarget interface
[Custom] void addEventListener(in DOMString type,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment