Diff
Modified: trunk/LayoutTests/ChangeLog (270677 => 270678)
--- trunk/LayoutTests/ChangeLog 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/LayoutTests/ChangeLog 2020-12-11 16:42:17 UTC (rev 270678)
@@ -1,3 +1,22 @@
+2020-12-11 Aditya Keerthi <[email protected]>
+
+ [iOS][FCR] Add new look for color inputs
+ https://bugs.webkit.org/show_bug.cgi?id=219654
+ <rdar://problem/72107493>
+
+ Reviewed by Wenson Hsieh.
+
+ Added tests to verify the stylability of color inputs with the new appearance.
+
+ * fast/forms/ios/form-control-refresh/color/background-color-expected-mismatch.html: Added.
+ * fast/forms/ios/form-control-refresh/color/background-color.html: Added.
+ * fast/forms/ios/form-control-refresh/color/border-expected-mismatch.html: Added.
+ * fast/forms/ios/form-control-refresh/color/border-radius-expected-mismatch.html: Added.
+ * fast/forms/ios/form-control-refresh/color/border-radius.html: Added.
+ * fast/forms/ios/form-control-refresh/color/border.html: Added.
+ * fast/forms/ios/form-control-refresh/color/width-height-expected-mismatch.html: Added.
+ * fast/forms/ios/form-control-refresh/color/width-height.html: Added.
+
2020-12-10 John Wilander <[email protected]>
PCM: Turn feature on by default
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/background-color-expected-mismatch.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/background-color-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/background-color-expected-mismatch.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/background-color.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/background-color.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/background-color.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,16 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+
+input {
+ background-color: red;
+}
+
+</style>
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-expected-mismatch.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-expected-mismatch.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-radius-expected-mismatch.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-radius-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-radius-expected-mismatch.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-radius.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-radius.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border-radius.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,16 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+
+input {
+ border-radius: 5px;
+}
+
+</style>
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/border.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,16 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+
+input {
+ border: 2px solid red;
+}
+
+</style>
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/width-height-expected-mismatch.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/width-height-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/width-height-expected-mismatch.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,9 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Added: trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/width-height.html (0 => 270678)
--- trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/width-height.html (rev 0)
+++ trunk/LayoutTests/fast/forms/ios/form-control-refresh/color/width-height.html 2020-12-11 16:42:17 UTC (rev 270678)
@@ -0,0 +1,17 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ IOSFormControlRefreshEnabled=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<style>
+
+input {
+ width: 50px;
+ height: 50px;
+}
+
+</style>
+</head>
+<body>
+<input type="color">
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (270677 => 270678)
--- trunk/Source/WebCore/ChangeLog 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/Source/WebCore/ChangeLog 2020-12-11 16:42:17 UTC (rev 270678)
@@ -1,3 +1,68 @@
+2020-12-11 Aditya Keerthi <[email protected]>
+
+ [iOS][FCR] Add new look for color inputs
+ https://bugs.webkit.org/show_bug.cgi?id=219654
+ <rdar://problem/72107493>
+
+ Reviewed by Wenson Hsieh.
+
+ The new appearance matches the appearance of UIKit's UIColorWell.
+
+ Tests: fast/forms/ios/form-control-refresh/color/background-color.html
+ fast/forms/ios/form-control-refresh/color/border-radius.html
+ fast/forms/ios/form-control-refresh/color/border.html
+ fast/forms/ios/form-control-refresh/color/width-height.html
+
+ * css/formControlsIOS.css:
+ (input[type="color"]::-webkit-color-swatch-wrapper, input[type="color"]::-webkit-color-swatch):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::adjustStyle):
+ (WebCore::RenderTheme::paint):
+ (WebCore::RenderTheme::paintDecorations):
+ (WebCore::RenderTheme::adjustColorWellStyle const):
+
+ Call adjustButtonStyle to preserve existing behavior in cases where
+ the form control refresh does not apply (setting disabled,
+ non-iOS ports).
+
+ (WebCore::RenderTheme::paintColorWell):
+
+ Call paintButton to preserve existing behavior in cases where
+ the form control refresh does not apply (setting disabled,
+ non-iOS ports).
+
+ (WebCore::RenderTheme::paintColorWellDecorations):
+
+ Call paintButtonDecorations to preserve existing behavior in
+ cases where the form control refresh does not apply (setting
+ disabled, non-iOS ports).
+
+ (WebCore::RenderTheme::colorInputStyleSheet const):
+ * rendering/RenderTheme.h:
+
+ Previously, color inputs always had the same appearance as buttons.
+ However, with the new appearance on iOS this is no longer always
+ the case. Consequently, it is necessary to introduce adjustColorWellStyle,
+ paintColorWell and paintColorWellDecorations.
+
+ Updated colorInputStyleSheet to take an additional parameter, so that
+ the style can change depending on whether or not the form control refresh
+ setting is enabled. It is not possible to simply add the new style to
+ formControlsiOS.css, since <input type=color> is another runtime
+ enabled feature.
+
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::colorInputStyleSheet const):
+ (WebCore::RenderThemeIOS::adjustColorWellStyle const):
+ (WebCore::RenderThemeIOS::paintColorWell):
+ (WebCore::RenderThemeIOS::paintColorWellDecorations):
+
+ Use a conic gradient to achieve the new appearance.
+
+ * style/UserAgentStyle.cpp:
+ (WebCore::Style::UserAgentStyle::ensureDefaultStyleSheetsForElement):
+
2020-12-10 Wenson Hsieh <[email protected]>
REGRESSION (r270458): Canvas painting is broken when enabling GPU process for DOM
Modified: trunk/Source/WebCore/css/formControlsIOS.css (270677 => 270678)
--- trunk/Source/WebCore/css/formControlsIOS.css 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/Source/WebCore/css/formControlsIOS.css 2020-12-11 16:42:17 UTC (rev 270678)
@@ -83,4 +83,9 @@
box-shadow: 0px 6px 13px rgba(0, 0, 0, 0.2), 0px 0.5px 4px rgba(0, 0, 0, 0.2);
}
+input[type="color"]::-webkit-color-swatch-wrapper,
+input[type="color"]::-webkit-color-swatch {
+ border-radius: inherit;
+}
+
#endif
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (270677 => 270678)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2020-12-11 16:42:17 UTC (rev 270678)
@@ -200,11 +200,12 @@
return adjustCheckboxStyle(style, element);
case RadioPart:
return adjustRadioStyle(style, element);
- case PushButtonPart:
- case SquareButtonPart:
#if ENABLE(INPUT_TYPE_COLOR)
case ColorWellPart:
+ return adjustColorWellStyle(style, element);
#endif
+ case PushButtonPart:
+ case SquareButtonPart:
case DefaultButtonPart:
case ButtonPart:
return adjustButtonStyle(style, element);
@@ -330,11 +331,12 @@
return paintCheckbox(box, paintInfo, integralSnappedRect);
case RadioPart:
return paintRadio(box, paintInfo, integralSnappedRect);
- case PushButtonPart:
- case SquareButtonPart:
#if ENABLE(INPUT_TYPE_COLOR)
case ColorWellPart:
+ return paintColorWell(box, paintInfo, integralSnappedRect);
#endif
+ case PushButtonPart:
+ case SquareButtonPart:
case DefaultButtonPart:
case ButtonPart:
return paintButton(box, paintInfo, integralSnappedRect);
@@ -523,6 +525,8 @@
break;
#if ENABLE(INPUT_TYPE_COLOR)
case ColorWellPart:
+ paintColorWellDecorations(box, paintInfo, integralSnappedRect);
+ break;
#endif
case ButtonPart:
paintButtonDecorations(box, paintInfo, integralSnappedRect);
@@ -963,8 +967,23 @@
void RenderTheme::adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const
{
}
+
+#if ENABLE(INPUT_TYPE_COLOR)
+
+void RenderTheme::adjustColorWellStyle(RenderStyle& style, const Element* element) const
+{
+ adjustButtonStyle(style, element);
+}
+
+bool RenderTheme::paintColorWell(const RenderObject& box, const PaintInfo& paintInfo, const IntRect& rect)
+{
+ return paintButton(box, paintInfo, rect);
+}
+
#endif
+#endif
+
void RenderTheme::adjustTextFieldStyle(RenderStyle&, const Element*) const
{
}
@@ -997,6 +1016,13 @@
return true;
}
+#if ENABLE(INPUT_TYPE_COLOR)
+void RenderTheme::paintColorWellDecorations(const RenderObject& box, const PaintInfo& paintInfo, const IntRect& rect)
+{
+ paintButtonDecorations(box, paintInfo, rect);
+}
+#endif
+
void RenderTheme::adjustCapsLockIndicatorStyle(RenderStyle&, const Element*) const
{
}
@@ -1021,7 +1047,7 @@
#if ENABLE(INPUT_TYPE_COLOR)
-String RenderTheme::colorInputStyleSheet() const
+String RenderTheme::colorInputStyleSheet(const Settings&) const
{
return "input[type=\"color\"] { -webkit-appearance: color-well; width: 44px; height: 23px; outline: none; } "_s;
}
Modified: trunk/Source/WebCore/rendering/RenderTheme.h (270677 => 270678)
--- trunk/Source/WebCore/rendering/RenderTheme.h 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/Source/WebCore/rendering/RenderTheme.h 2020-12-11 16:42:17 UTC (rev 270678)
@@ -101,7 +101,7 @@
String dataListStyleSheet() const;
#endif
#if ENABLE(INPUT_TYPE_COLOR)
- String colorInputStyleSheet() const;
+ virtual String colorInputStyleSheet(const Settings&) const;
#endif
// A method to obtain the baseline position for a "leaf" control. This will only be used if a baseline
@@ -303,11 +303,19 @@
virtual void adjustInnerSpinButtonStyle(RenderStyle&, const Element*) const;
virtual bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) { return true; }
+
+#if ENABLE(INPUT_TYPE_COLOR)
+ virtual void adjustColorWellStyle(RenderStyle&, const Element*) const;
+ virtual bool paintColorWell(const RenderObject&, const PaintInfo&, const IntRect&);
#endif
+#endif
virtual void paintCheckboxDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { }
virtual void paintRadioDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { }
virtual void paintButtonDecorations(const RenderObject&, const PaintInfo&, const IntRect&) { }
+#if ENABLE(INPUT_TYPE_COLOR)
+ virtual void paintColorWellDecorations(const RenderObject&, const PaintInfo&, const IntRect&);
+#endif
virtual void adjustTextFieldStyle(RenderStyle&, const Element*) const;
virtual bool paintTextField(const RenderObject&, const PaintInfo&, const FloatRect&) { return true; }
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (270677 => 270678)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2020-12-11 16:42:17 UTC (rev 270678)
@@ -119,7 +119,15 @@
bool supportsMeter(ControlPart, const HTMLMeterElement&) const final;
bool paintMeter(const RenderObject&, const PaintInfo&, const IntRect&) final;
+
+#if ENABLE(INPUT_TYPE_COLOR)
+ String colorInputStyleSheet(const Settings&) const final;
+
+ void adjustColorWellStyle(RenderStyle&, const Element*) const final;
+ bool paintColorWell(const RenderObject&, const PaintInfo&, const IntRect&) final;
+ void paintColorWellDecorations(const RenderObject&, const PaintInfo&, const IntRect&) final;
#endif
+#endif
bool supportsFocusRing(const RenderStyle&) const final;
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (270677 => 270678)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2020-12-11 16:42:17 UTC (rev 270678)
@@ -2295,6 +2295,68 @@
return false;
}
+#if ENABLE(INPUT_TYPE_COLOR)
+
+String RenderThemeIOS::colorInputStyleSheet(const Settings& settings) const
+{
+ if (!settings.iOSFormControlRefreshEnabled())
+ return RenderTheme::colorInputStyleSheet(settings);
+
+ return "input[type=\"color\"] { -webkit-appearance: color-well; width: 23px; height: 23px; outline: none; border: initial; border-radius: 50%; } "_s;
+}
+
+void RenderThemeIOS::adjustColorWellStyle(RenderStyle& style, const Element* element) const
+{
+ if (!element || element->document().settings().iOSFormControlRefreshEnabled())
+ return;
+
+ RenderTheme::adjustColorWellStyle(style, element);
+}
+
+bool RenderThemeIOS::paintColorWell(const RenderObject& box, const PaintInfo& paintInfo, const IntRect& rect)
+{
+ if (!box.settings().iOSFormControlRefreshEnabled())
+ return RenderTheme::paintColorWell(box, paintInfo, rect);
+
+ return true;
+}
+
+void RenderThemeIOS::paintColorWellDecorations(const RenderObject& box, const PaintInfo& paintInfo, const IntRect& rect)
+{
+ if (!box.settings().iOSFormControlRefreshEnabled()) {
+ RenderTheme::paintColorWellDecorations(box, paintInfo, rect);
+ return;
+ }
+
+ constexpr int strokeThickness = 2;
+ constexpr int numColorStops = 9;
+ constexpr DisplayP3<float> colorStops[] = {
+ { 1, 1, 0, 1 },
+ { 1, 0.5, 0, 1 },
+ { 1, 0, 0, 1 },
+ { 1, 0, 1, 1},
+ { 0, 0, 1, 1 },
+ { 0, 1, 1, 1 },
+ { 0, 1, 0, 1},
+ { 0.63, 0.88, 0.03, 1 },
+ { 1, 1, 0, 1 }
+ };
+
+ auto gradient = Gradient::create(Gradient::ConicData { rect.center(), 0 });
+ for (int i = 0; i < numColorStops; ++i)
+ gradient->addColorStop({ i * 1.0f / (numColorStops - 1), colorStops[i] });
+
+ auto& context = paintInfo.context();
+ GraphicsContextStateSaver stateSaver(context);
+
+ context.setStrokeThickness(strokeThickness);
+ context.setStrokeStyle(SolidStroke);
+ context.setStrokeGradient(WTFMove(gradient));
+ context.strokeEllipse(rect);
+}
+
+#endif // ENABLE(INPUT_TYPE_COLOR)
+
#endif // ENABLE(IOS_FORM_CONTROL_REFRESH)
} // namespace WebCore
Modified: trunk/Source/WebCore/style/UserAgentStyle.cpp (270677 => 270678)
--- trunk/Source/WebCore/style/UserAgentStyle.cpp 2020-12-11 16:38:16 UTC (rev 270677)
+++ trunk/Source/WebCore/style/UserAgentStyle.cpp 2020-12-11 16:42:17 UTC (rev 270678)
@@ -266,7 +266,7 @@
#endif // ENABLE(DATALIST_ELEMENT)
#if ENABLE(INPUT_TYPE_COLOR)
else if (!colorInputStyleSheet && is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element).isColorControl()) {
- colorInputStyleSheet = parseUASheet(RenderTheme::singleton().colorInputStyleSheet());
+ colorInputStyleSheet = parseUASheet(RenderTheme::singleton().colorInputStyleSheet(element.document().settings()));
addToDefaultStyle(*colorInputStyleSheet);
}
#endif // ENABLE(INPUT_TYPE_COLOR)