Title: [237262] trunk/Source/WebCore
Revision
237262
Author
wenson_hs...@apple.com
Date
2018-10-18 13:02:49 -0700 (Thu, 18 Oct 2018)

Log Message

[GTK] fast/css/pseudo-visited-background-color-on-input.html is failing since r237425
https://bugs.webkit.org/show_bug.cgi?id=190712

Reviewed by Tim Horton.

Ensure that color inputs are enabled by default on GTK, and that color inputs have a `-webkit-appearance` of
`color-well` by default. Fixes fast/css/pseudo-visited-background-color-on-input.html on GTK.

* page/RuntimeEnabledFeatures.cpp:
(WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::colorInputStyleSheet const):
* rendering/RenderTheme.h:
(WebCore::RenderTheme::platformUsesColorWellAppearance const):
(WebCore::RenderTheme::platformColorInputStyleSheet const): Deleted.

Replace this with a platform hook that determines whether we want to use `-webkit-appearance: color-well;` by
default for inputs of type color. For now, only iOS overrides this to return false; in the future, we should
support `-webkit-appearance: color-well;` on iOS, and remove this platform hook entirely.

* rendering/RenderThemeIOS.h:
* rendering/RenderThemeMac.h:
* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::platformColorInputStyleSheet const): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (237261 => 237262)


--- trunk/Source/WebCore/ChangeLog	2018-10-18 18:15:19 UTC (rev 237261)
+++ trunk/Source/WebCore/ChangeLog	2018-10-18 20:02:49 UTC (rev 237262)
@@ -1,3 +1,30 @@
+2018-10-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        [GTK] fast/css/pseudo-visited-background-color-on-input.html is failing since r237425
+        https://bugs.webkit.org/show_bug.cgi?id=190712
+
+        Reviewed by Tim Horton.
+
+        Ensure that color inputs are enabled by default on GTK, and that color inputs have a `-webkit-appearance` of
+        `color-well` by default. Fixes fast/css/pseudo-visited-background-color-on-input.html on GTK.
+
+        * page/RuntimeEnabledFeatures.cpp:
+        (WebCore::RuntimeEnabledFeatures::RuntimeEnabledFeatures):
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::colorInputStyleSheet const):
+        * rendering/RenderTheme.h:
+        (WebCore::RenderTheme::platformUsesColorWellAppearance const):
+        (WebCore::RenderTheme::platformColorInputStyleSheet const): Deleted.
+
+        Replace this with a platform hook that determines whether we want to use `-webkit-appearance: color-well;` by
+        default for inputs of type color. For now, only iOS overrides this to return false; in the future, we should
+        support `-webkit-appearance: color-well;` on iOS, and remove this platform hook entirely.
+
+        * rendering/RenderThemeIOS.h:
+        * rendering/RenderThemeMac.h:
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::platformColorInputStyleSheet const): Deleted.
+
 2018-10-18  Youenn Fablet  <you...@apple.com>
 
         Handle MDNS resolution of candidates through libwebrtc directly

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp (237261 => 237262)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2018-10-18 18:15:19 UTC (rev 237261)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.cpp	2018-10-18 20:02:49 UTC (rev 237262)
@@ -46,6 +46,9 @@
 #if PLATFORM(WATCHOS)
     m_isWebSocketEnabled = false;
 #endif
+#if PLATFORM(GTK) && ENABLE(INPUT_TYPE_COLOR)
+    m_isInputTypeColorEnabled = true;
+#endif
 }
 
 RuntimeEnabledFeatures& RuntimeEnabledFeatures::sharedFeatures()

Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (237261 => 237262)


--- trunk/Source/WebCore/rendering/RenderTheme.cpp	2018-10-18 18:15:19 UTC (rev 237261)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp	2018-10-18 20:02:49 UTC (rev 237262)
@@ -1039,7 +1039,10 @@
 String RenderTheme::colorInputStyleSheet() const
 {
     ASSERT(RuntimeEnabledFeatures::sharedFeatures().inputTypeColorEnabled());
-    return makeString(platformColorInputStyleSheet(), " input[type=\"color\"] { width: 44px; height: 23px; outline: none; }"_s);
+    auto colorWellAppearanceStyle = emptyString();
+    if (platformUsesColorWellAppearance())
+        colorWellAppearanceStyle = "-webkit-appearance: color-well; "_s;
+    return makeString("input[type=\"color\"] { "_s, WTFMove(colorWellAppearanceStyle), "width: 44px; height: 23px; outline: none; }"_s);
 }
 
 #endif // ENABLE(INPUT_TYPE_COLOR)

Modified: trunk/Source/WebCore/rendering/RenderTheme.h (237261 => 237262)


--- trunk/Source/WebCore/rendering/RenderTheme.h	2018-10-18 18:15:19 UTC (rev 237261)
+++ trunk/Source/WebCore/rendering/RenderTheme.h	2018-10-18 20:02:49 UTC (rev 237262)
@@ -350,7 +350,7 @@
 #endif
 
 #if ENABLE(INPUT_TYPE_COLOR)
-    virtual String platformColorInputStyleSheet() const { return { }; }
+    virtual bool platformUsesColorWellAppearance() const { return true; }
 #endif
 
     virtual void adjustProgressBarStyle(StyleResolver&, RenderStyle&, const Element*) const;

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (237261 => 237262)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.h	2018-10-18 18:15:19 UTC (rev 237261)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h	2018-10-18 20:02:49 UTC (rev 237262)
@@ -145,6 +145,14 @@
     String extraDefaultStyleSheet() final;
 #endif
 
+#if ENABLE(INPUT_TYPE_COLOR)
+    bool platformUsesColorWellAppearance() const final
+    {
+        // FIXME: Support -webkit-appearance: color-well; for drawing color inputs on iOS.
+        return false;
+    }
+#endif
+
     const Color& shadowColor() const;
     FloatRect addRoundedBorderClip(const RenderObject& box, GraphicsContext&, const IntRect&);
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.h (237261 => 237262)


--- trunk/Source/WebCore/rendering/RenderThemeMac.h	2018-10-18 18:15:19 UTC (rev 237261)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.h	2018-10-18 20:02:49 UTC (rev 237262)
@@ -119,10 +119,6 @@
     String imageControlsStyleSheet() const final;
 #endif
 
-#if ENABLE(INPUT_TYPE_COLOR)
-    String platformColorInputStyleSheet() const final;
-#endif
-
     bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) final;
     void adjustTextFieldStyle(StyleResolver&, RenderStyle&, const Element*) const final;
 

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (237261 => 237262)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2018-10-18 18:15:19 UTC (rev 237261)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2018-10-18 20:02:49 UTC (rev 237262)
@@ -340,11 +340,6 @@
     RenderTheme::purgeCaches();
 }
 
-String RenderThemeMac::platformColorInputStyleSheet() const
-{
-    return "input[type=\"color\"] { -webkit-appearance: color-well; }"_s;
-}
-
 String RenderThemeMac::mediaControlsScript()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to