Modified: trunk/Source/WebCore/ChangeLog (284231 => 284232)
--- trunk/Source/WebCore/ChangeLog 2021-10-15 03:20:18 UTC (rev 284231)
+++ trunk/Source/WebCore/ChangeLog 2021-10-15 04:25:14 UTC (rev 284232)
@@ -1,3 +1,26 @@
+2021-10-14 Aditya Keerthi <akeer...@apple.com>
+
+ [iOS] Support accent-color for controls without text
+ https://bugs.webkit.org/show_bug.cgi?id=231762
+ rdar://84261702
+
+ Reviewed by Tim Horton.
+
+ Add support for 'accent-color' on checkboxes, radio buttons,
+ <input type=range>, <progress> elements, and the <datalist>
+ indicator button.
+
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::controlTintColor):
+ (WebCore::RenderThemeIOS::checkboxRadioBackgroundColor):
+ (WebCore::RenderThemeIOS::paintCheckbox):
+ (WebCore::RenderThemeIOS::paintRadio):
+ (WebCore::RenderThemeIOS::paintProgressBarWithFormControlRefresh):
+ (WebCore::RenderThemeIOS::paintListButton):
+ (WebCore::RenderThemeIOS::paintSliderTicks):
+ (WebCore::RenderThemeIOS::paintSliderTrackWithFormControlRefresh):
+
2021-10-14 Robin Morisset <rmoris...@apple.com>
Allow WASM to use up to 4GB
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (284231 => 284232)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2021-10-15 03:20:18 UTC (rev 284231)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2021-10-15 04:25:14 UTC (rev 284232)
@@ -119,7 +119,7 @@
#if ENABLE(IOS_FORM_CONTROL_REFRESH)
Color checkboxRadioBorderColor(OptionSet<ControlStates::States>, OptionSet<StyleColorOptions>);
- Color checkboxRadioBackgroundColor(bool useAlternateDesign, OptionSet<ControlStates::States>, OptionSet<StyleColorOptions>);
+ Color checkboxRadioBackgroundColor(bool useAlternateDesign, const RenderStyle&, OptionSet<ControlStates::States>, OptionSet<StyleColorOptions>);
RefPtr<Gradient> checkboxRadioBackgroundGradient(const FloatRect&, OptionSet<ControlStates::States>);
Color checkboxRadioIndicatorColor(OptionSet<ControlStates::States>, OptionSet<StyleColorOptions>);
@@ -205,6 +205,8 @@
Color systemColor(CSSValueID, OptionSet<StyleColorOptions>) const override;
+ Color controlTintColor(const RenderStyle&, OptionSet<StyleColorOptions>) const;
+
void adjustStyleForAlternateFormControlDesignTransition(RenderStyle&, const Element*) const;
#if USE(SYSTEM_PREVIEW)
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (284231 => 284232)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2021-10-15 03:20:18 UTC (rev 284231)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2021-10-15 04:25:14 UTC (rev 284232)
@@ -1556,6 +1556,15 @@
}).iterator->value;
}
+Color RenderThemeIOS::controlTintColor(const RenderStyle& style, OptionSet<StyleColorOptions> options) const
+{
+ Color tintColor = style.effectiveAccentColor();
+ if (tintColor.isValid())
+ return tintColor;
+
+ return systemColor(CSSValueAppleSystemBlue, options);
+}
+
#if ENABLE(ATTACHMENT_ELEMENT)
const CGSize attachmentSize = { 160, 119 };
@@ -2161,7 +2170,7 @@
return defaultBorderColor;
}
-Color RenderThemeIOS::checkboxRadioBackgroundColor(bool useAlternateDesign, OptionSet<ControlStates::States> states, OptionSet<StyleColorOptions> styleColorOptions)
+Color RenderThemeIOS::checkboxRadioBackgroundColor(bool useAlternateDesign, const RenderStyle& style, OptionSet<ControlStates::States> states, OptionSet<StyleColorOptions> styleColorOptions)
{
bool isEmpty = !states.containsAny({ ControlStates::States::Checked, ControlStates::States::Indeterminate });
bool isEnabled = states.contains(ControlStates::States::Enabled);
@@ -2181,7 +2190,7 @@
if (!isEnabled)
return systemColor(isEmpty ? CSSValueWebkitControlBackground : CSSValueAppleSystemOpaqueTertiaryFill, styleColorOptions);
- auto enabledBackgroundColor = systemColor(isEmpty ? CSSValueWebkitControlBackground : CSSValueAppleSystemBlue, styleColorOptions);
+ auto enabledBackgroundColor = isEmpty ? systemColor(CSSValueWebkitControlBackground, styleColorOptions) : controlTintColor(style, styleColorOptions);
if (isPressed)
return enabledBackgroundColor.colorWithAlphaMultipliedBy(pressedStateOpacity);
@@ -2271,7 +2280,7 @@
auto controlStates = extractControlStatesForRenderer(box);
auto styleColorOptions = box.styleColorOptions();
- auto backgroundColor = checkboxRadioBackgroundColor(useAlternateDesign, controlStates, styleColorOptions);
+ auto backgroundColor = checkboxRadioBackgroundColor(useAlternateDesign, box.style(), controlStates, styleColorOptions);
bool checked = controlStates.contains(ControlStates::States::Checked);
bool indeterminate = controlStates.contains(ControlStates::States::Indeterminate);
@@ -2354,7 +2363,7 @@
auto controlStates = extractControlStatesForRenderer(box);
auto styleColorOptions = box.styleColorOptions();
- auto backgroundColor = checkboxRadioBackgroundColor(useAlternateDesign, controlStates, styleColorOptions);
+ auto backgroundColor = checkboxRadioBackgroundColor(useAlternateDesign, box.style(), controlStates, styleColorOptions);
FloatRoundedRect radioRect { rect, FloatRoundedRect::Radii(rect.width() / 2, rect.height() / 2) };
@@ -2476,7 +2485,7 @@
}
FloatRect barRect(barLeft, barTop, barWidth, barHeight);
- context.fillRoundedRect(FloatRoundedRect(barRect, barCornerRadii), systemColor(CSSValueAppleSystemBlue, styleColorOptions).colorWithAlphaMultipliedBy(alpha));
+ context.fillRoundedRect(FloatRoundedRect(barRect, barCornerRadii), controlTintColor(renderer.style(), styleColorOptions).colorWithAlphaMultipliedBy(alpha));
return false;
}
@@ -2574,7 +2583,7 @@
transform.scale(scale);
path.transform(transform);
- context.setFillColor(systemColor(CSSValueAppleSystemBlue, box.styleColorOptions()));
+ context.setFillColor(controlTintColor(style, box.styleColorOptions()));
context.fillPath(path);
return false;
@@ -2638,7 +2647,7 @@
tickRect.setY(rect.y() + tickRatio * (rect.height() - tickRect.height()));
FloatRoundedRect roundedTickRect(snapRectToDevicePixels(LayoutRect(tickRect), deviceScaleFactor), tickCornerRadii);
- context.fillRoundedRect(roundedTickRect, systemColor((value >= *optionValue) ? CSSValueAppleSystemBlue : CSSValueAppleSystemOpaqueSeparator, styleColorOptions));
+ context.fillRoundedRect(roundedTickRect, (value >= *optionValue) ? controlTintColor(box.style(), styleColorOptions) : systemColor(CSSValueAppleSystemOpaqueSeparator, styleColorOptions));
}
}
}
@@ -2714,7 +2723,7 @@
}
FloatRoundedRect fillRect(trackClip, cornerRadii);
- context.fillRoundedRect(fillRect, systemColor(CSSValueAppleSystemBlue, styleColorOptions));
+ context.fillRoundedRect(fillRect, controlTintColor(box.style(), styleColorOptions));
return false;
}