Title: [265157] trunk
Revision
265157
Author
[email protected]
Date
2020-07-31 13:19:02 -0700 (Fri, 31 Jul 2020)

Log Message

[macOS] Date/time input types should have a textfield appearance
https://bugs.webkit.org/show_bug.cgi?id=214978

Reviewed by Wenson Hsieh.

Source/WebCore:

On iOS, date/time input types have a menulist-button appearance. However, this appearance
does not match the style of native date controls on macOS. The textfield appearance
with no focus ring brings us closer to a natively styled control.

* rendering/RenderTheme.h:
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::dateInputStyleSheet const):
(WebCore::RenderThemeMac::dateTimeLocalInputStyleSheet const):
(WebCore::RenderThemeMac::monthInputStyleSheet const):
(WebCore::RenderThemeMac::timeInputStyleSheet const):
(WebCore::RenderThemeMac::weekInputStyleSheet const):

LayoutTests:

Rebaselined tests for updated appearance.

* platform/mac-wk2/fast/forms/date/date-input-rendering-basic-expected.txt:
* platform/mac-wk2/fast/forms/time/time-input-rendering-basic-expected.txt:
* platform/mac-wk2/imported/w3c/web-platform-tests/html/rendering/widgets/appearance/default-styles-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265156 => 265157)


--- trunk/LayoutTests/ChangeLog	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/LayoutTests/ChangeLog	2020-07-31 20:19:02 UTC (rev 265157)
@@ -1,3 +1,16 @@
+2020-07-31  Aditya Keerthi  <[email protected]>
+
+        [macOS] Date/time input types should have a textfield appearance
+        https://bugs.webkit.org/show_bug.cgi?id=214978
+
+        Reviewed by Wenson Hsieh.
+
+        Rebaselined tests for updated appearance.
+
+        * platform/mac-wk2/fast/forms/date/date-input-rendering-basic-expected.txt:
+        * platform/mac-wk2/fast/forms/time/time-input-rendering-basic-expected.txt:
+        * platform/mac-wk2/imported/w3c/web-platform-tests/html/rendering/widgets/appearance/default-styles-expected.txt:
+
 2020-07-31  Hector Lopez  <[email protected]>
 
         REGRESSION: [ iOS wk2 Debug ] imported/w3c/web-platform-tests/webrtc/RTCSctpTransport-maxChannels.html is a constant crash

Modified: trunk/LayoutTests/platform/mac-wk2/fast/forms/date/date-input-rendering-basic-expected.txt (265156 => 265157)


--- trunk/LayoutTests/platform/mac-wk2/fast/forms/date/date-input-rendering-basic-expected.txt	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/LayoutTests/platform/mac-wk2/fast/forms/date/date-input-rendering-basic-expected.txt	2020-07-31 20:19:02 UTC (rev 265157)
@@ -3,16 +3,16 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderText {#text} at (110,2) size 4x18
-        text run at (110,2) width 4: " "
+      RenderText {#text} at (110,3) size 4x18
+        text run at (110,3) width 4: " "
       RenderText {#text} at (0,0) size 0x0
-layer at (8,10) size 110x19 clip at (10,12) size 106x15
-  RenderFlexibleBox {INPUT} at (0,2) size 110x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-    RenderBlock {DIV} at (6,3) size 59x13
+layer at (8,10) size 110x21 clip at (10,12) size 106x17
+  RenderFlexibleBox {INPUT} at (0,2) size 110x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+    RenderBlock {DIV} at (7,4) size 59x13
       RenderText {#text} at (0,0) size 59x13
         text run at (0,0) width 59: "Apr 1, 1976"
-layer at (122,10) size 110x19 clip at (124,12) size 106x15
-  RenderFlexibleBox {INPUT} at (114,2) size 110x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-    RenderBlock {DIV} at (25,3) size 59x13
+layer at (122,10) size 110x21 clip at (124,12) size 106x17
+  RenderFlexibleBox {INPUT} at (114,2) size 110x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+    RenderBlock {DIV} at (24,4) size 59x13
       RenderText {#text} at (0,0) size 59x13
         text run at (0,0) width 59: "Apr 1, 1976"

Modified: trunk/LayoutTests/platform/mac-wk2/fast/forms/time/time-input-rendering-basic-expected.txt (265156 => 265157)


--- trunk/LayoutTests/platform/mac-wk2/fast/forms/time/time-input-rendering-basic-expected.txt	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/LayoutTests/platform/mac-wk2/fast/forms/time/time-input-rendering-basic-expected.txt	2020-07-31 20:19:02 UTC (rev 265157)
@@ -3,17 +3,17 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderText {#text} at (110,2) size 4x18
-        text run at (110,2) width 4: " "
+      RenderText {#text} at (110,3) size 4x18
+        text run at (110,3) width 4: " "
       RenderText {#text} at (0,0) size 0x0
-layer at (8,10) size 110x19 clip at (10,12) size 106x15
-  RenderFlexibleBox {INPUT} at (0,2) size 110x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-    RenderBlock {DIV} at (6,3) size 43x13
+layer at (8,10) size 110x21 clip at (10,12) size 106x17
+  RenderFlexibleBox {INPUT} at (0,2) size 110x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+    RenderBlock {DIV} at (7,4) size 43x13
       RenderText {#text} at (0,0) size 43x13
         text run at (0,0) width 43: "9:41 AM"
-layer at (122,10) size 110x19 clip at (124,12) size 106x15
-  RenderFlexibleBox {INPUT} at (114,2) size 110x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-    RenderBlock {DIV} at (41,3) size 43x13
+layer at (122,10) size 110x21 clip at (124,12) size 106x17
+  RenderFlexibleBox {INPUT} at (114,2) size 110x21 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+    RenderBlock {DIV} at (40,4) size 43x13
       RenderText {#text} at (0,0) size 43x13
         text run at (0,0) width 18: "AM"
         text run at (17,0) width 4 RTL: " "

Modified: trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/rendering/widgets/appearance/default-styles-expected.txt (265156 => 265157)


--- trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/rendering/widgets/appearance/default-styles-expected.txt	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/LayoutTests/platform/mac-wk2/imported/w3c/web-platform-tests/html/rendering/widgets/appearance/default-styles-expected.txt	2020-07-31 20:19:02 UTC (rev 265157)
@@ -7,11 +7,11 @@
 FAIL <input type="url"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
 FAIL <input type="email"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
 FAIL <input type="password"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
-FAIL <input type="date"> assert_equals: -webkit-appearance expected "auto" but got "menulist-button"
-FAIL <input type="month"> assert_equals: -webkit-appearance expected "auto" but got "menulist-button"
-FAIL <input type="week"> assert_equals: -webkit-appearance expected "auto" but got "menulist-button"
-FAIL <input type="time"> assert_equals: -webkit-appearance expected "auto" but got "menulist-button"
-FAIL <input type="datetime-local"> assert_equals: -webkit-appearance expected "auto" but got "menulist-button"
+FAIL <input type="date"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
+FAIL <input type="month"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
+FAIL <input type="week"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
+FAIL <input type="time"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
+FAIL <input type="datetime-local"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
 FAIL <input type="number"> assert_equals: -webkit-appearance expected "auto" but got "textfield"
 FAIL <input type="range"> assert_equals: -webkit-appearance expected "auto" but got "slider-horizontal"
 FAIL <input type="color"> assert_equals: -webkit-appearance expected "auto" but got "color-well"

Modified: trunk/Source/WebCore/ChangeLog (265156 => 265157)


--- trunk/Source/WebCore/ChangeLog	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/Source/WebCore/ChangeLog	2020-07-31 20:19:02 UTC (rev 265157)
@@ -1,3 +1,23 @@
+2020-07-31  Aditya Keerthi  <[email protected]>
+
+        [macOS] Date/time input types should have a textfield appearance
+        https://bugs.webkit.org/show_bug.cgi?id=214978
+
+        Reviewed by Wenson Hsieh.
+
+        On iOS, date/time input types have a menulist-button appearance. However, this appearance
+        does not match the style of native date controls on macOS. The textfield appearance
+        with no focus ring brings us closer to a natively styled control.
+
+        * rendering/RenderTheme.h:
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::dateInputStyleSheet const):
+        (WebCore::RenderThemeMac::dateTimeLocalInputStyleSheet const):
+        (WebCore::RenderThemeMac::monthInputStyleSheet const):
+        (WebCore::RenderThemeMac::timeInputStyleSheet const):
+        (WebCore::RenderThemeMac::weekInputStyleSheet const):
+
 2020-07-31  Brady Eidson  <[email protected]>
 
         Special HID mapping for the Dualshock 3 controller

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (265156 => 265157)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2020-07-31 20:19:02 UTC (rev 265157)
@@ -102,19 +102,19 @@
     String colorInputStyleSheet() const;
 #endif
 #if ENABLE(INPUT_TYPE_DATE)
-    String dateInputStyleSheet() const;
+    virtual String dateInputStyleSheet() const;
 #endif
 #if ENABLE(INPUT_TYPE_DATETIMELOCAL)
-    String dateTimeLocalInputStyleSheet() const;
+    virtual String dateTimeLocalInputStyleSheet() const;
 #endif
 #if ENABLE(INPUT_TYPE_MONTH)
-    String monthInputStyleSheet() const;
+    virtual String monthInputStyleSheet() const;
 #endif
 #if ENABLE(INPUT_TYPE_TIME)
-    String timeInputStyleSheet() const;
+    virtual String timeInputStyleSheet() const;
 #endif
 #if ENABLE(INPUT_TYPE_WEEK)
-    String weekInputStyleSheet() const;
+    virtual String weekInputStyleSheet() const;
 #endif
 
     // A method to obtain the baseline position for a "leaf" control.  This will only be used if a baseline

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (265156 => 265157)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2020-07-31 20:19:02 UTC (rev 265157)
@@ -109,6 +109,22 @@
     String mediaControlsBase64StringForIconNameAndType(const String&, const String&) final;
 #endif
 
+#if ENABLE(INPUT_TYPE_DATE)
+    String dateInputStyleSheet() const final;
+#endif
+#if ENABLE(INPUT_TYPE_DATETIMELOCAL)
+    String dateTimeLocalInputStyleSheet() const final;
+#endif
+#if ENABLE(INPUT_TYPE_MONTH)
+    String monthInputStyleSheet() const final;
+#endif
+#if ENABLE(INPUT_TYPE_TIME)
+    String timeInputStyleSheet() const final;
+#endif
+#if ENABLE(INPUT_TYPE_WEEK)
+    String weekInputStyleSheet() const final;
+#endif
+
 #if ENABLE(SERVICE_CONTROLS)
     String imageControlsStyleSheet() const final;
 #endif

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (265156 => 265157)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2020-07-31 19:50:33 UTC (rev 265156)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2020-07-31 20:19:02 UTC (rev 265157)
@@ -359,6 +359,51 @@
     return [[NSData dataWithContentsOfFile:[bundle pathForResource:iconName ofType:iconType inDirectory:directory]] base64EncodedStringWithOptions:0];
 }
 
+#if ENABLE(INPUT_TYPE_DATE)
+
+String RenderThemeMac::dateInputStyleSheet() const
+{
+    return "input[type=\"date\"] { -webkit-appearance: textfield; align-items: center; display: -webkit-inline-flex; overflow: hidden; width: 10em; outline: none; } "_s;
+}
+
+#endif
+
+#if ENABLE(INPUT_TYPE_DATETIMELOCAL)
+
+String RenderThemeMac::dateTimeLocalInputStyleSheet() const
+{
+    return "input[type=\"datetime-local\"] { -webkit-appearance: textfield; align-items: center; display: -webkit-inline-flex; overflow: hidden; width: 10em; outline: none; } "_s;
+}
+
+#endif
+
+#if ENABLE(INPUT_TYPE_MONTH)
+
+String RenderThemeMac::monthInputStyleSheet() const
+{
+    return "input[type=\"month\"] { -webkit-appearance: textfield; align-items: center; display: -webkit-inline-flex; overflow: hidden; width: 10em; outline: none; } "_s;
+}
+
+#endif
+
+#if ENABLE(INPUT_TYPE_TIME)
+
+String RenderThemeMac::timeInputStyleSheet() const
+{
+    return "input[type=\"time\"] { -webkit-appearance: textfield; align-items: center; display: -webkit-inline-flex; overflow: hidden; width: 10em; outline: none; } "_s;
+}
+
+#endif
+
+#if ENABLE(INPUT_TYPE_WEEK)
+
+String RenderThemeMac::weekInputStyleSheet() const
+{
+    return "input[type=\"week\"] { -webkit-appearance: textfield; align-items: center; display: -webkit-inline-flex; overflow: hidden; width: 10em; outline: none; } "_s;
+}
+
+#endif
+
 #if ENABLE(SERVICE_CONTROLS)
 
 String RenderThemeMac::imageControlsStyleSheet() const
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to