Add a runtime flag for <input type=date>
authortkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 09:15:27 +0000 (09:15 +0000)
committertkent@chromium.org <tkent@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 09:15:27 +0000 (09:15 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83853

Reviewed by Adam Barth.

Source/WebCore:

* bindings/generic/RuntimeEnabledFeatures.cpp:
* bindings/generic/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::inputTypeDateEnabled): Added.
(WebCore::RuntimeEnabledFeatures::setInputTypeDateEnabled): Added.
* html/InputType.cpp:
(WebCore::createInputTypeFactoryMap):
Don't register type=date if !RuntimeEnabledFeatures::inputTypeDateEnabled()

Source/WebKit/chromium:

* public/WebRuntimeFeatures.h:
(WebRuntimeFeatures): Add enableInputTypeDate() and isInputTypeDateEnabled().
* src/WebRuntimeFeatures.cpp:
(WebKit::WebRuntimeFeatures::enableInputTypeDate): Added.
(WebKit::WebRuntimeFeatures::isInputTypeDateEnabled): Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@114101 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.cpp
Source/WebCore/bindings/generic/RuntimeEnabledFeatures.h
Source/WebCore/html/InputType.cpp
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/WebRuntimeFeatures.h
Source/WebKit/chromium/src/WebRuntimeFeatures.cpp

index 09b63c4..53c8aa6 100644 (file)
@@ -1,3 +1,18 @@
+2012-04-13  Kent Tamura  <tkent@chromium.org>
+
+        Add a runtime flag for <input type=date>
+        https://bugs.webkit.org/show_bug.cgi?id=83853
+
+        Reviewed by Adam Barth.
+
+        * bindings/generic/RuntimeEnabledFeatures.cpp:
+        * bindings/generic/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::inputTypeDateEnabled): Added.
+        (WebCore::RuntimeEnabledFeatures::setInputTypeDateEnabled): Added.
+        * html/InputType.cpp:
+        (WebCore::createInputTypeFactoryMap):
+        Don't register type=date if !RuntimeEnabledFeatures::inputTypeDateEnabled()
+
 2012-04-13  Adam Barth  <abarth@webkit.org>
 
         JSDocument::setLocation does too much bare-handed lifting
index e67b67b..3f0ba84 100644 (file)
@@ -197,4 +197,8 @@ bool RuntimeEnabledFeatures::isShadowDOMEnabled = false;
 bool RuntimeEnabledFeatures::isStyleScopedEnabled = false;
 #endif
 
+#if ENABLE(INPUT_TYPE_DATE)
+bool RuntimeEnabledFeatures::isInputTypeDateEnabled = true;
+#endif
+
 } // namespace WebCore
index 1e39274..c2f93ab 100644 (file)
@@ -228,6 +228,11 @@ public:
     static void setStyleScopedEnabled(bool isEnabled) { isStyleScopedEnabled = isEnabled; }
 #endif
 
+#if ENABLE(INPUT_TYPE_DATE)
+    static bool inputTypeDateEnabled() { return isInputTypeDateEnabled; }
+    static void setInputTypeDateEnabled(bool isEnabled) { isInputTypeDateEnabled = isEnabled; }
+#endif
+
 private:
     // Never instantiate.
     RuntimeEnabledFeatures() { }
@@ -300,6 +305,10 @@ private:
 #if ENABLE(STYLE_SCOPED)
     static bool isStyleScopedEnabled;
 #endif
+
+#if ENABLE(INPUT_TYPE_DATE)
+    static bool isInputTypeDateEnabled;
+#endif
 };
 
 } // namespace WebCore
index 7eb3ca2..7a9f1b1 100644 (file)
@@ -55,6 +55,7 @@
 #include "RegularExpression.h"
 #include "RenderObject.h"
 #include "ResetInputType.h"
+#include "RuntimeEnabledFeatures.h"
 #include "SearchInputType.h"
 #include "ShadowRoot.h"
 #include "ShadowTree.h"
@@ -86,7 +87,8 @@ static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap()
     map->add(InputTypeNames::color(), ColorInputType::create);
 #endif
 #if ENABLE(INPUT_TYPE_DATE)
-    map->add(InputTypeNames::date(), DateInputType::create);
+    if (RuntimeEnabledFeatures::inputTypeDateEnabled())
+        map->add(InputTypeNames::date(), DateInputType::create);
 #endif
 #if ENABLE(INPUT_TYPE_DATETIME)
     map->add(InputTypeNames::datetime(), DateTimeInputType::create);
index 94334a7..fc7f649 100644 (file)
@@ -1,3 +1,16 @@
+2012-04-13  Kent Tamura  <tkent@chromium.org>
+
+        Add a runtime flag for <input type=date>
+        https://bugs.webkit.org/show_bug.cgi?id=83853
+
+        Reviewed by Adam Barth.
+
+        * public/WebRuntimeFeatures.h:
+        (WebRuntimeFeatures): Add enableInputTypeDate() and isInputTypeDateEnabled().
+        * src/WebRuntimeFeatures.cpp:
+        (WebKit::WebRuntimeFeatures::enableInputTypeDate): Added.
+        (WebKit::WebRuntimeFeatures::isInputTypeDateEnabled): Added.
+
 2012-04-13  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed.  Rolled DEPS.
index bdc7e04..bc6a50a 100644 (file)
@@ -133,6 +133,9 @@ public:
     WEBKIT_EXPORT static void enableStyleScoped(bool);
     WEBKIT_EXPORT static bool isStyleScopedEnabled();
 
+    WEBKIT_EXPORT static void enableInputTypeDate(bool);
+    WEBKIT_EXPORT static bool isInputTypeDateEnabled();
+
 private:
     WebRuntimeFeatures();
 };
index 1fdf8cd..6a2cf81 100644 (file)
@@ -502,5 +502,22 @@ bool WebRuntimeFeatures::isStyleScopedEnabled()
 #endif
 }
 
+void WebRuntimeFeatures::enableInputTypeDate(bool enable)
+{
+#if ENABLE(INPUT_TYPE_DATE)
+    RuntimeEnabledFeatures::setInputTypeDateEnabled(enable);
+#else
+    UNUSED_PARAM(enable);
+#endif
+}
+
+bool WebRuntimeFeatures::isInputTypeDateEnabled()
+{
+#if ENABLE(INPUT_TYPE_DATE)
+    return RuntimeEnabledFeatures::inputTypeDateEnabled();
+#else
+    return false;
+#endif
+}
 
 } // namespace WebKit