[GTK] fast/css/pseudo-visited-background-color-on-input.html is failing since r237425
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Oct 2018 20:02:49 +0000 (20:02 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Oct 2018 20:02:49 +0000 (20:02 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237262 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/RuntimeEnabledFeatures.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderTheme.h
Source/WebCore/rendering/RenderThemeIOS.h
Source/WebCore/rendering/RenderThemeMac.h
Source/WebCore/rendering/RenderThemeMac.mm

index 3ae9f8b..7ea810d 100644 (file)
@@ -1,3 +1,30 @@
+2018-10-18  Wenson Hsieh  <wenson_hsieh@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  <youenn@apple.com>
 
         Handle MDNS resolution of candidates through libwebrtc directly
index 4be436c..159a92a 100644 (file)
@@ -46,6 +46,9 @@ RuntimeEnabledFeatures::RuntimeEnabledFeatures()
 #if PLATFORM(WATCHOS)
     m_isWebSocketEnabled = false;
 #endif
+#if PLATFORM(GTK) && ENABLE(INPUT_TYPE_COLOR)
+    m_isInputTypeColorEnabled = true;
+#endif
 }
 
 RuntimeEnabledFeatures& RuntimeEnabledFeatures::sharedFeatures()
index 7707b34..26d9dab 100644 (file)
@@ -1039,7 +1039,10 @@ bool RenderTheme::paintAttachment(const RenderObject&, const PaintInfo&, const I
 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)
index 86fd211..6d52498 100644 (file)
@@ -350,7 +350,7 @@ protected:
 #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;
index 0d886bb..ce38799 100644 (file)
@@ -145,6 +145,14 @@ private:
     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&);
 
index cb2cc99..df4d951 100644 (file)
@@ -119,10 +119,6 @@ private:
     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;
 
index 8d3886c..6b8dbcd 100644 (file)
@@ -340,11 +340,6 @@ void RenderThemeMac::purgeCaches()
     RenderTheme::purgeCaches();
 }
 
-String RenderThemeMac::platformColorInputStyleSheet() const
-{
-    return "input[type=\"color\"] { -webkit-appearance: color-well; }"_s;
-}
-
 String RenderThemeMac::mediaControlsScript()
 {
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)