2010-04-27 Garret Kelly <gdk@chromium.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Apr 2010 01:09:40 +0000 (01:09 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 28 Apr 2010 01:09:40 +0000 (01:09 +0000)
        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: https://svn.webkit.org/repository/webkit/trunk@58363 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
WebCore/bindings/generic/RuntimeEnabledFeatures.h
WebCore/dom/Document.cpp
WebCore/dom/Document.idl
WebCore/dom/Element.idl
WebCore/page/DOMWindow.idl

index 77f709e..d77b535 100644 (file)
@@ -1,3 +1,26 @@
+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.
index 6ba85da..2044a20 100644 (file)
@@ -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)
 
index 37dceff..1534353 100644 (file)
@@ -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
index 06758d6..89a005e 100644 (file)
 #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)
index 88bd639..cd877b3 100644 (file)
@@ -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
     };
 
index 1368503..977d15a 100644 (file)
@@ -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
     };
 
index 146add7..7dcc7be 100644 (file)
@@ -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,