Title: [89194] trunk/Source/WebCore
Revision
89194
Author
[email protected]
Date
2011-06-18 11:50:53 -0700 (Sat, 18 Jun 2011)

Log Message

REGRESSION (r63854-63958): placeholder not shown for number inputs
https://bugs.webkit.org/show_bug.cgi?id=61095

Reviewed by Darin Adler.

Refactor HTMLInputElement supportsPlaceholder support to delegate to the
InputType. Make BaseTextInputType and NumberInputType return true, matching
the current HTML5 spec.

* html/BaseTextInputType.cpp:
(WebCore::BaseTextInputType::supportsPlaceholder):
* html/BaseTextInputType.h:
Add override implementation of supportsPlaceholder that returns true.

* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::supportsPlaceholder):
Delegate to the InputType.

* html/InputType.cpp:
(WebCore::InputType::supportsPlaceholder):
* html/InputType.h:
Add base implementation of supportsPlaceholder that returns false.

* html/NumberInputType.cpp:
(WebCore::NumberInputType::supportsPlaceholder):
* html/NumberInputType.h:
Add override implementation of supportsPlaceholder that returns true.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89193 => 89194)


--- trunk/Source/WebCore/ChangeLog	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/ChangeLog	2011-06-18 18:50:53 UTC (rev 89194)
@@ -1,3 +1,33 @@
+2011-06-18  Sam Weinig  <[email protected]>
+
+        Reviewed by Darin Adler.
+
+        REGRESSION (r63854-63958): placeholder not shown for number inputs
+        https://bugs.webkit.org/show_bug.cgi?id=61095
+
+        Refactor HTMLInputElement supportsPlaceholder support to delegate to the
+        InputType. Make BaseTextInputType and NumberInputType return true, matching
+        the current HTML5 spec.
+
+        * html/BaseTextInputType.cpp:
+        (WebCore::BaseTextInputType::supportsPlaceholder):
+        * html/BaseTextInputType.h:
+        Add override implementation of supportsPlaceholder that returns true.
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::supportsPlaceholder):
+        Delegate to the InputType.
+
+        * html/InputType.cpp:
+        (WebCore::InputType::supportsPlaceholder):
+        * html/InputType.h:
+        Add base implementation of supportsPlaceholder that returns false.
+
+        * html/NumberInputType.cpp:
+        (WebCore::NumberInputType::supportsPlaceholder):
+        * html/NumberInputType.h:
+        Add override implementation of supportsPlaceholder that returns true.
+
 2011-06-18  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r89154.

Modified: trunk/Source/WebCore/html/BaseTextInputType.cpp (89193 => 89194)


--- trunk/Source/WebCore/html/BaseTextInputType.cpp	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/html/BaseTextInputType.cpp	2011-06-18 18:50:53 UTC (rev 89194)
@@ -50,4 +50,9 @@
     return matchOffset || matchLength != valueLength;
 }
 
+bool BaseTextInputType::supportsPlaceholder() const
+{
+    return true;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/BaseTextInputType.h (89193 => 89194)


--- trunk/Source/WebCore/html/BaseTextInputType.h	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/html/BaseTextInputType.h	2011-06-18 18:50:53 UTC (rev 89194)
@@ -44,6 +44,7 @@
 private:
     virtual bool isTextType() const;
     virtual bool patternMismatch(const String&) const;
+    virtual bool supportsPlaceholder() const;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/HTMLInputElement.cpp (89193 => 89194)


--- trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/html/HTMLInputElement.cpp	2011-06-18 18:50:53 UTC (rev 89194)
@@ -1803,7 +1803,7 @@
 
 bool HTMLInputElement::supportsPlaceholder() const
 {
-    return isTextType();
+    return m_inputType->supportsPlaceholder();
 }
 
 CheckedRadioButtons& HTMLInputElement::checkedRadioButtons() const

Modified: trunk/Source/WebCore/html/InputType.cpp (89193 => 89194)


--- trunk/Source/WebCore/html/InputType.cpp	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/html/InputType.cpp	2011-06-18 18:50:53 UTC (rev 89194)
@@ -649,6 +649,11 @@
     return false;
 }
 
+bool InputType::supportsPlaceholder() const
+{
+    return false;
+}
+
 namespace InputTypeNames {
 
 // The type names must be lowercased because they will be the return values of

Modified: trunk/Source/WebCore/html/InputType.h (89193 => 89194)


--- trunk/Source/WebCore/html/InputType.h	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/html/InputType.h	2011-06-18 18:50:53 UTC (rev 89194)
@@ -222,6 +222,7 @@
     virtual bool isCheckable();
     virtual bool isSteppable() const;
     virtual bool shouldRespectHeightAndWidthAttributes();
+    virtual bool supportsPlaceholder() const;
 
     // Parses the specified string for the type, and return
     // the double value for the parsing result if the parsing

Modified: trunk/Source/WebCore/html/NumberInputType.cpp (89193 => 89194)


--- trunk/Source/WebCore/html/NumberInputType.cpp	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/html/NumberInputType.cpp	2011-06-18 18:50:53 UTC (rev 89194)
@@ -264,6 +264,11 @@
     return true;
 }
 
+bool NumberInputType::supportsPlaceholder() const
+{
+    return true;
+}
+
 bool NumberInputType::isNumberField() const
 {
     return true;

Modified: trunk/Source/WebCore/html/NumberInputType.h (89193 => 89194)


--- trunk/Source/WebCore/html/NumberInputType.h	2011-06-18 09:01:32 UTC (rev 89193)
+++ trunk/Source/WebCore/html/NumberInputType.h	2011-06-18 18:50:53 UTC (rev 89194)
@@ -70,6 +70,7 @@
     virtual String sanitizeValue(const String&);
     virtual bool hasUnacceptableValue();
     virtual bool shouldRespectSpeechAttribute();
+    virtual bool supportsPlaceholder() const;
     virtual bool isNumberField() const;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to