Diff
Modified: trunk/LayoutTests/ChangeLog (284286 => 284287)
--- trunk/LayoutTests/ChangeLog 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/LayoutTests/ChangeLog 2021-10-15 23:35:39 UTC (rev 284287)
@@ -1,3 +1,23 @@
+2021-10-15 Aditya Keerthi <akeer...@apple.com>
+
+ [iOS] Support accent-color for button-like controls
+ https://bugs.webkit.org/show_bug.cgi?id=231764
+ rdar://84261821
+
+ Reviewed by Tim Horton.
+
+ Add new tests for iOS and mark newly passing test.
+
+ * TestExpectations:
+ * fast/css/accent-color/button-expected-mismatch.html: Added.
+ * fast/css/accent-color/button.html: Added.
+ * fast/css/accent-color/date-expected-mismatch.html: Added.
+ * fast/css/accent-color/date.html: Added.
+ * fast/css/accent-color/submit-expected-mismatch.html: Added.
+ * fast/css/accent-color/submit.html: Added.
+ * platform/ios/TestExpectations:
+ * platform/mac/TestExpectations:
+
2021-10-15 Arcady Goldmints-Orlov <agoldmi...@igalia.com>
[GLIB] Update test expectations for known failures. Unreviewed test gardening.
Modified: trunk/LayoutTests/TestExpectations (284286 => 284287)
--- trunk/LayoutTests/TestExpectations 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/LayoutTests/TestExpectations 2021-10-15 23:35:39 UTC (rev 284287)
@@ -1123,12 +1123,15 @@
media/video-with-alpha.html [ Skip ]
# accent-color is currently only supported on Cocoa platforms
+fast/css/accent-color/button.html [ ImageOnlyFailure ]
fast/css/accent-color/checkbox.html [ ImageOnlyFailure ]
fast/css/accent-color/datalist.html [ ImageOnlyFailure ]
+fast/css/accent-color/date.html [ ImageOnlyFailure ]
fast/css/accent-color/progress.html [ ImageOnlyFailure ]
fast/css/accent-color/radio.html [ ImageOnlyFailure ]
fast/css/accent-color/range.html [ ImageOnlyFailure ]
fast/css/accent-color/select.html [ ImageOnlyFailure ]
+fast/css/accent-color/submit.html [ ImageOnlyFailure ]
fast/css/accent-color/text.html [ ImageOnlyFailure ]
imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative.html [ ImageOnlyFailure ]
Added: trunk/LayoutTests/fast/css/accent-color/button-expected-mismatch.html (0 => 284287)
--- trunk/LayoutTests/fast/css/accent-color/button-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/button-expected-mismatch.html 2021-10-15 23:35:39 UTC (rev 284287)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of buttons.</p>
+ <button style="accent-color: blue;">Button</button>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/button.html (0 => 284287)
--- trunk/LayoutTests/fast/css/accent-color/button.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/button.html 2021-10-15 23:35:39 UTC (rev 284287)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of buttons.</p>
+ <button style="accent-color: red;">Button</button>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/date-expected-mismatch.html (0 => 284287)
--- trunk/LayoutTests/fast/css/accent-color/date-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/date-expected-mismatch.html 2021-10-15 23:35:39 UTC (rev 284287)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of date inputs.</p>
+ <input type="date" value="2021-10-14" style="accent-color: blue;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/date.html (0 => 284287)
--- trunk/LayoutTests/fast/css/accent-color/date.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/date.html 2021-10-15 23:35:39 UTC (rev 284287)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of date inputs.</p>
+ <input type="date" value="2021-10-14" style="accent-color: red;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/submit-expected-mismatch.html (0 => 284287)
--- trunk/LayoutTests/fast/css/accent-color/submit-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/submit-expected-mismatch.html 2021-10-15 23:35:39 UTC (rev 284287)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of submit buttons.</p>
+ <input type="submit" style="accent-color: blue;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/submit.html (0 => 284287)
--- trunk/LayoutTests/fast/css/accent-color/submit.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/submit.html 2021-10-15 23:35:39 UTC (rev 284287)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of submit buttons.</p>
+ <input type="submit" style="accent-color: red;">
+</body>
+</html>
Modified: trunk/LayoutTests/platform/ios/TestExpectations (284286 => 284287)
--- trunk/LayoutTests/platform/ios/TestExpectations 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2021-10-15 23:35:39 UTC (rev 284287)
@@ -44,16 +44,9 @@
fast/css/getComputedStyle/computed-style-apple-pay-button.html [ Pass ]
# accent-color is currently only supported on Cocoa platforms
-fast/css/accent-color/checkbox.html [ Pass ]
-fast/css/accent-color/datalist.html [ Pass ]
-fast/css/accent-color/progress.html [ Pass ]
-fast/css/accent-color/radio.html [ Pass ]
-fast/css/accent-color/range.html [ Pass ]
-fast/css/accent-color/text.html [ Pass ]
+fast/css/accent-color [ Pass ]
imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative.html [ Pass ]
-webkit.org/b/231764 fast/css/accent-color/select.html [ ImageOnlyFailure ]
-
fast/css/ios [ Pass ]
fast/media/ios [ Pass ]
Modified: trunk/LayoutTests/platform/mac/TestExpectations (284286 => 284287)
--- trunk/LayoutTests/platform/mac/TestExpectations 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2021-10-15 23:35:39 UTC (rev 284287)
@@ -2347,6 +2347,11 @@
fast/css/accent-color/text.html [ Pass ]
imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative.html [ Pass ]
+# The following controls are not tintable on macOS
+fast/css/accent-color/button.html [ Skip ]
+fast/css/accent-color/date.html [ Skip ]
+fast/css/accent-color/submit.html [ Skip ]
+
webkit.org/b/199350 fast/css/accent-color/datalist.html [ ImageOnlyFailure ]
webkit.org/b/231463 fast/css/accent-color/range.html [ ImageOnlyFailure ]
Modified: trunk/Source/WebCore/ChangeLog (284286 => 284287)
--- trunk/Source/WebCore/ChangeLog 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/Source/WebCore/ChangeLog 2021-10-15 23:35:39 UTC (rev 284287)
@@ -1,3 +1,33 @@
+2021-10-15 Aditya Keerthi <akeer...@apple.com>
+
+ [iOS] Support accent-color for button-like controls
+ https://bugs.webkit.org/show_bug.cgi?id=231764
+ rdar://84261821
+
+ Reviewed by Tim Horton.
+
+ Apply accent-color to buttons, date inputs, and <select> elements.
+
+ Tests: fast/css/accent-color/button.html
+ fast/css/accent-color/date.html
+ fast/css/accent-color/submit.html
+
+ * html/HTMLButtonElement.cpp:
+ (WebCore::HTMLButtonElement::isExplicitlySetSubmitButton const):
+
+ Return true if the author has explicitly made the <button> a
+ submit button. This is necessary, as submit buttons have an appearance
+ that is different from a standard button on iOS.
+
+ * html/HTMLButtonElement.h:
+ * rendering/RenderThemeIOS.h:
+ * rendering/RenderThemeIOS.mm:
+ (WebCore::RenderThemeIOS::adjustMenuListButtonStyle const):
+ (WebCore::RenderThemeIOS::isSubmitStyleButton const):
+ (WebCore::RenderThemeIOS::adjustButtonLikeControlStyle const):
+ (WebCore::RenderThemeIOS::adjustButtonStyle const):
+ (WebCore::RenderThemeIOS::adjustPressedStyle const): Deleted.
+
2021-10-15 Antti Koivisto <an...@apple.com>
[LFC][Integration] Factor line logical order traversal out of iterator
Modified: trunk/Source/WebCore/html/HTMLButtonElement.cpp (284286 => 284287)
--- trunk/Source/WebCore/html/HTMLButtonElement.cpp 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/Source/WebCore/html/HTMLButtonElement.cpp 2021-10-15 23:35:39 UTC (rev 284287)
@@ -243,4 +243,9 @@
return m_type == SUBMIT;
}
+bool HTMLButtonElement::isExplicitlySetSubmitButton() const
+{
+ return isSubmitButton() && hasAttributeWithoutSynchronization(HTMLNames::typeAttr);
+}
+
} // namespace
Modified: trunk/Source/WebCore/html/HTMLButtonElement.h (284286 => 284287)
--- trunk/Source/WebCore/html/HTMLButtonElement.h 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/Source/WebCore/html/HTMLButtonElement.h 2021-10-15 23:35:39 UTC (rev 284287)
@@ -42,6 +42,8 @@
RenderButton* renderer() const;
+ bool isExplicitlySetSubmitButton() const;
+
private:
HTMLButtonElement(const QualifiedName& tagName, Document&, HTMLFormElement*);
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (284286 => 284287)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.h 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h 2021-10-15 23:35:39 UTC (rev 284287)
@@ -199,8 +199,10 @@
void paintMenuListButtonDecorationsWithFormControlRefresh(const RenderBox&, const PaintInfo&, const FloatRect&);
#endif
- void adjustPressedStyle(RenderStyle&, const Element&) const;
+ bool isSubmitStyleButton(const Element&) const;
+ void adjustButtonLikeControlStyle(RenderStyle&, const Element&) const;
+
FloatRect addRoundedBorderClip(const RenderObject& box, GraphicsContext&, const IntRect&);
Color systemColor(CSSValueID, OptionSet<StyleColorOptions>) const override;
Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.mm (284286 => 284287)
--- trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2021-10-15 23:35:26 UTC (rev 284286)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.mm 2021-10-15 23:35:39 UTC (rev 284287)
@@ -50,6 +50,7 @@
#import "GraphicsContext.h"
#import "GraphicsContextCG.h"
#import "HTMLAttachmentElement.h"
+#import "HTMLButtonElement.h"
#import "HTMLInputElement.h"
#import "HTMLMeterElement.h"
#import "HTMLNames.h"
@@ -817,7 +818,7 @@
if (!element)
return;
- adjustPressedStyle(style, *element);
+ adjustButtonLikeControlStyle(style, *element);
// Enforce some default styles in the case that this is a non-multiple <select> element,
// or a date input. We don't force these if this is just an element with
@@ -1210,18 +1211,48 @@
// This value matches the opacity applied to UIKit controls.
constexpr auto pressedStateOpacity = 0.75f;
-void RenderThemeIOS::adjustPressedStyle(RenderStyle& style, const Element& element) const
+bool RenderThemeIOS::isSubmitStyleButton(const Element& element) const
{
+ if (is<HTMLInputElement>(element) && downcast<HTMLInputElement>(element).isSubmitButton())
+ return true;
+
+ if (is<HTMLButtonElement>(element) && downcast<HTMLButtonElement>(element).isExplicitlySetSubmitButton())
+ return true;
+
+ return false;
+}
+
+void RenderThemeIOS::adjustButtonLikeControlStyle(RenderStyle& style, const Element& element) const
+{
#if ENABLE(IOS_FORM_CONTROL_REFRESH)
- if (element.document().settings().iOSFormControlRefreshEnabled() && element.active() && !element.isDisabledFormControl()) {
- auto textColor = style.color();
- if (textColor.isValid())
- style.setColor(textColor.colorWithAlphaMultipliedBy(pressedStateOpacity));
+ if (!element.document().settings().iOSFormControlRefreshEnabled())
+ return;
- auto backgroundColor = style.backgroundColor();
- if (backgroundColor.isValid())
- style.setBackgroundColor(backgroundColor.colorWithAlphaMultipliedBy(pressedStateOpacity));
+ // FIXME: Implement button-like control adjustments for the alternate design.
+ if (element.document().settings().alternateFormControlDesignEnabled())
+ return;
+
+ if (element.isDisabledFormControl())
+ return;
+
+ auto tintColor = style.effectiveAccentColor();
+ if (tintColor.isValid()) {
+ if (isSubmitStyleButton(element))
+ style.setBackgroundColor(tintColor);
+ else
+ style.setColor(tintColor);
}
+
+ if (!element.active())
+ return;
+
+ auto textColor = style.color();
+ if (textColor.isValid())
+ style.setColor(textColor.colorWithAlphaMultipliedBy(pressedStateOpacity));
+
+ auto backgroundColor = style.backgroundColor();
+ if (backgroundColor.isValid())
+ style.setBackgroundColor(backgroundColor.colorWithAlphaMultipliedBy(pressedStateOpacity));
#endif
}
@@ -1251,7 +1282,7 @@
if (!element)
return;
- adjustPressedStyle(style, *element);
+ adjustButtonLikeControlStyle(style, *element);
RenderBox* box = element->renderBox();
if (!box)