Bug 1431041: Make placeholder apply to <input type="number">. r?smaug draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Wed, 17 Jan 2018 14:52:01 +0100
changeset 721788 8e2fa96de3dd25373c624d26ccf26f8ac084ef7b
parent 721787 50a5f0a088995c5e5fce91aab24306148491bec9
child 721789 d22e3b436114f2d0c1c7af4b1157881cba6e42c0
push id95947
push userbmo:emilio@crisal.io
push dateWed, 17 Jan 2018 21:20:18 +0000
reviewerssmaug
bugs1431041
milestone59.0a1
Bug 1431041: Make placeholder apply to <input type="number">. r?smaug MozReview-Commit-ID: GLbdLxHLiH4
dom/html/HTMLInputElement.cpp
layout/reftests/css-placeholder/input/placeholdershown-ref.html
layout/reftests/css-placeholder/input/placeholdershown.html
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -7021,17 +7021,17 @@ HTMLInputElement::DoesRequiredApply() co
 
 bool
 HTMLInputElement::PlaceholderApplies() const
 {
   if (IsDateTimeInputType(mType)) {
     return false;
   }
 
-  return IsSingleLineTextControl(false);
+  return IsSingleLineTextOrNumberControl(false);
 }
 
 bool
 HTMLInputElement::DoesMinMaxApply() const
 {
   switch (mType)
   {
     case NS_FORM_INPUT_NUMBER:
--- a/layout/reftests/css-placeholder/input/placeholdershown-ref.html
+++ b/layout/reftests/css-placeholder/input/placeholdershown-ref.html
@@ -1,7 +1,11 @@
 <!DOCTYPE html>
-<html>
-  <link rel='stylesheet' type='text/css' href='style-shown.css'>
-  <body>
-    <input class='shown-ref' value='foo'>
-  </body>
-</html>
+<link rel='stylesheet' href='style-shown.css'>
+<input class='shown-ref' value='foo'>
+<input type="number" class='shown-ref' placeholder='foo'>
+<input type="email" class='shown-ref' placeholder='foo'>
+<input type="search" class='shown-ref' placeholder='foo'>
+<input type="tel" class='shown-ref' placeholder='foo'>
+<input type="url" class='shown-ref' placeholder='foo'>
+<input type="month" class='shown-ref' placeholder='foo'>
+<input type="week" class='shown-ref' placeholder='foo'>
+<input type="datetime-local" class='shown-ref' placeholder='foo'>
--- a/layout/reftests/css-placeholder/input/placeholdershown.html
+++ b/layout/reftests/css-placeholder/input/placeholdershown.html
@@ -1,7 +1,11 @@
 <!DOCTYPE html>
-<html>
-  <link rel='stylesheet' type='text/css' href='style-shown.css'>
-  <body>
-    <input class='shown' placeholder='foo'>
-  </body>
-</html>
+<link rel='stylesheet' href='style-shown.css'>
+<input class='shown' placeholder='foo'>
+<input type="number" class='shown' placeholder='foo'>
+<input type="email" class='shown' placeholder='foo'>
+<input type="search" class='shown' placeholder='foo'>
+<input type="tel" class='shown' placeholder='foo'>
+<input type="url" class='shown' placeholder='foo'>
+<input type="month" class='shown' placeholder='foo'>
+<input type="week" class='shown' placeholder='foo'>
+<input type="datetime-local" class='shown' placeholder='foo'>