Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / forms / InputType.cpp
index db88583..92b6859 100644 (file)
 #include "config.h"
 #include "core/html/forms/InputType.h"
 
-#include "InputTypeNames.h"
-#include "RuntimeEnabledFeatures.h"
-#include "bindings/v8/ExceptionMessages.h"
-#include "bindings/v8/ExceptionState.h"
+#include "bindings/core/v8/ExceptionMessages.h"
+#include "bindings/core/v8/ExceptionState.h"
+#include "core/InputTypeNames.h"
 #include "core/accessibility/AXObjectCache.h"
 #include "core/dom/NodeRenderStyle.h"
 #include "core/events/KeyboardEvent.h"
@@ -43,6 +42,7 @@
 #include "core/html/HTMLShadowElement.h"
 #include "core/html/forms/ButtonInputType.h"
 #include "core/html/forms/CheckboxInputType.h"
+#include "core/html/forms/ColorChooser.h"
 #include "core/html/forms/ColorInputType.h"
 #include "core/html/forms/DateInputType.h"
 #include "core/html/forms/DateTimeLocalInputType.h"
 #include "core/html/forms/WeekInputType.h"
 #include "core/html/parser/HTMLParserIdioms.h"
 #include "core/rendering/RenderTheme.h"
+#include "platform/RuntimeEnabledFeatures.h"
 #include "platform/text/PlatformLocale.h"
 #include "platform/text/TextBreakIterator.h"
 
-namespace WebCore {
+namespace blink {
 
 using blink::WebLocalizedString;
 using namespace HTMLNames;
-using namespace std;
 
 typedef PassRefPtrWillBeRawPtr<InputType> (*InputTypeFactoryFunction)(HTMLInputElement&);
 typedef HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash> InputTypeFactoryMap;
@@ -142,16 +142,6 @@ bool InputType::isTextField() const
     return false;
 }
 
-bool InputType::isTextType() const
-{
-    return false;
-}
-
-bool InputType::isRangeControl() const
-{
-    return false;
-}
-
 bool InputType::shouldSaveAndRestoreFormControlState() const
 {
     return true;
@@ -200,7 +190,7 @@ void InputType::setValueAsDate(double, ExceptionState& exceptionState) const
 
 double InputType::valueAsDouble() const
 {
-    return numeric_limits<double>::quiet_NaN();
+    return std::numeric_limits<double>::quiet_NaN();
 }
 
 void InputType::setValueAsDouble(double doubleValue, TextFieldEventBehavior eventBehavior, ExceptionState& exceptionState) const
@@ -244,6 +234,11 @@ bool InputType::hasBadInput() const
     return false;
 }
 
+bool InputType::tooLong(const String&, HTMLTextFormControlElement::NeedsToCheckDirtyFlag) const
+{
+    return false;
+}
+
 bool InputType::patternMismatch(const String&) const
 {
     return false;
@@ -467,11 +462,6 @@ bool InputType::shouldShowFocusRingOnMouseFocus() const
     return false;
 }
 
-bool InputType::shouldUseInputMethod() const
-{
-    return false;
-}
-
 void InputType::enableSecureTextInput()
 {
 }
@@ -591,6 +581,18 @@ String InputType::sanitizeValue(const String& proposedValue) const
     return proposedValue;
 }
 
+void InputType::warnIfValueIsInvalidAndElementIsVisible(const String& value) const
+{
+    // Don't warn if the value is set in Modernizr.
+    RenderStyle* style = element().renderStyle();
+    if (style && style->visibility() != HIDDEN)
+        warnIfValueIsInvalid(value);
+}
+
+void InputType::warnIfValueIsInvalid(const String&) const
+{
+}
+
 bool InputType::receiveDroppedFiles(const DragData*)
 {
     ASSERT_NOT_REACHED();
@@ -603,10 +605,6 @@ String InputType::droppedFileSystemId()
     return String();
 }
 
-void InputType::copyNonAttributeProperties(const HTMLInputElement&)
-{
-}
-
 bool InputType::shouldRespectListAttribute()
 {
     return false;
@@ -622,91 +620,11 @@ bool InputType::isTextButton() const
     return false;
 }
 
-bool InputType::isRadioButton() const
-{
-    return false;
-}
-
-bool InputType::isSearchField() const
-{
-    return false;
-}
-
-bool InputType::isHiddenType() const
-{
-    return false;
-}
-
-bool InputType::isPasswordField() const
-{
-    return false;
-}
-
-bool InputType::isCheckbox() const
-{
-    return false;
-}
-
-bool InputType::isEmailField() const
-{
-    return false;
-}
-
-bool InputType::isFileUpload() const
-{
-    return false;
-}
-
-bool InputType::isImageButton() const
-{
-    return false;
-}
-
 bool InputType::isInteractiveContent() const
 {
     return true;
 }
 
-bool InputType::isNumberField() const
-{
-    return false;
-}
-
-bool InputType::isTelephoneField() const
-{
-    return false;
-}
-
-bool InputType::isURLField() const
-{
-    return false;
-}
-
-bool InputType::isDateField() const
-{
-    return false;
-}
-
-bool InputType::isDateTimeLocalField() const
-{
-    return false;
-}
-
-bool InputType::isMonthField() const
-{
-    return false;
-}
-
-bool InputType::isTimeField() const
-{
-    return false;
-}
-
-bool InputType::isWeekField() const
-{
-    return false;
-}
-
 bool InputType::isEnumeratable()
 {
     return true;
@@ -722,14 +640,14 @@ bool InputType::isSteppable() const
     return false;
 }
 
-bool InputType::isColorControl() const
+bool InputType::shouldRespectHeightAndWidthAttributes()
 {
     return false;
 }
 
-bool InputType::shouldRespectHeightAndWidthAttributes()
+int InputType::maxLength() const
 {
-    return false;
+    return HTMLInputElement::maximumLength;
 }
 
 bool InputType::supportsPlaceholder() const
@@ -764,10 +682,10 @@ bool InputType::hasLegalLinkAttribute(const QualifiedName&) const
 
 const QualifiedName& InputType::subResourceAttributeName() const
 {
-    return nullQName();
+    return QualifiedName::null();
 }
 
-bool InputType::supportsIndeterminateAppearance() const
+bool InputType::shouldAppearIndeterminate() const
 {
     return false;
 }
@@ -792,6 +710,16 @@ unsigned InputType::width() const
     return 0;
 }
 
+TextDirection InputType::computedTextDirection()
+{
+    return element().computedStyle()->direction();
+}
+
+ColorChooserClient* InputType::colorChooserClient()
+{
+    return 0;
+}
+
 void InputType::applyStep(const Decimal& current, int count, AnyStepHandling anyStepHandling, TextFieldEventBehavior eventBehavior, ExceptionState& exceptionState)
 {
     StepRange stepRange(createStepRange(anyStepHandling));
@@ -974,4 +902,4 @@ StepRange InputType::createStepRange(AnyStepHandling anyStepHandling, const Deci
     return StepRange(stepBase, minimum, maximum, step, stepDescription);
 }
 
-} // namespace WebCore
+} // namespace blink