Diff
Modified: trunk/LayoutTests/ChangeLog (284114 => 284115)
--- trunk/LayoutTests/ChangeLog 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/LayoutTests/ChangeLog 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1,3 +1,31 @@
+2021-10-13 Aditya Keerthi <[email protected]>
+
+ [macOS] Add support for accent-color
+ https://bugs.webkit.org/show_bug.cgi?id=231464
+ rdar://84049511
+
+ Reviewed by Tim Horton.
+
+ Added ref tests for accent-color. These are not WPT, since the spec does
+ not specify which controls accent-color applies to.
+
+ * TestExpectations:
+ * fast/css/accent-color/checkbox-expected-mismatch.html: Added.
+ * fast/css/accent-color/checkbox.html: Added.
+ * fast/css/accent-color/datalist-expected-mismatch.html: Added.
+ * fast/css/accent-color/datalist.html: Added.
+ * fast/css/accent-color/progress-expected-mismatch.html: Added.
+ * fast/css/accent-color/progress.html: Added.
+ * fast/css/accent-color/radio-expected-mismatch.html: Added.
+ * fast/css/accent-color/radio.html: Added.
+ * fast/css/accent-color/range-expected-mismatch.html: Added.
+ * fast/css/accent-color/range.html: Added.
+ * fast/css/accent-color/select-expected-mismatch.html: Added.
+ * fast/css/accent-color/select.html: Added.
+ * fast/css/accent-color/text-expected.html: Added.
+ * fast/css/accent-color/text.html: Added.
+ * platform/mac/TestExpectations:
+
2021-10-13 Eric Hutchison <[email protected]>
[ iOS15 Catalina Debug ] requestidlecallback/requestidlecallback-document-gc.html is a flaky crash.
Modified: trunk/LayoutTests/TestExpectations (284114 => 284115)
--- trunk/LayoutTests/TestExpectations 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/LayoutTests/TestExpectations 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1124,6 +1124,16 @@
# Support for VP9 encoded videos with transparency is only available on ports that use GStreamer.
media/video-with-alpha.html [ Skip ]
+# accent-color is currently only supported on macOS
+fast/css/accent-color/checkbox.html [ ImageOnlyFailure ]
+fast/css/accent-color/datalist.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/text.html [ ImageOnlyFailure ]
+imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative.html [ ImageOnlyFailure ]
+
#//////////////////////////////////////////////////////////////////////////////////////////
# End platform-specific tests.
#//////////////////////////////////////////////////////////////////////////////////////////
Added: trunk/LayoutTests/fast/css/accent-color/checkbox-expected-mismatch.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/checkbox-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/checkbox-expected-mismatch.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of checkboxes.</p>
+ <input type="checkbox" style="accent-color: blue;" checked>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/checkbox.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/checkbox.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/checkbox.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of checkboxes.</p>
+ <input type="checkbox" style="accent-color: red;" checked>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/datalist-expected-mismatch.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/datalist-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/datalist-expected-mismatch.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of text inputs with an associated datalist element.</p>
+ <datalist id="list">
+ <option>A</option>
+ <option>B</option>
+ <option>C</option>
+ </datalist>
+ <input list="list" style="accent-color: blue;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/datalist.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/datalist.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/datalist.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of text inputs with an associated datalist element.</p>
+ <datalist id="list">
+ <option>A</option>
+ <option>B</option>
+ <option>C</option>
+ </datalist>
+ <input list="list" style="accent-color: red;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/progress-expected-mismatch.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/progress-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/progress-expected-mismatch.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of progress elements.</p>
+ <progress value="0.5" style="accent-color: blue;"></progress>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/progress.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/progress.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/progress.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of progress elements.</p>
+ <progress value="0.5" style="accent-color: red;"></progress>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/radio-expected-mismatch.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/radio-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/radio-expected-mismatch.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of radio buttons.</p>
+ <input type="radio" style="accent-color: blue;" checked>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/radio.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/radio.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/radio.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of radio buttons.</p>
+ <input type="radio" style="accent-color: red;" checked>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/range-expected-mismatch.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/range-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/range-expected-mismatch.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of range inputs.</p>
+ <input type="range" value="50" style="accent-color: blue;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/range.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/range.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/range.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of range inputs.</p>
+ <input type="range" value="50" style="accent-color: red;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/select-expected-mismatch.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/select-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/select-expected-mismatch.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of select elements.</p>
+ <select style="accent-color: blue;"></select>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/select.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/select.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/select.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color customizes the appearance of select elements.</p>
+ <select style="accent-color: red;"></select>
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/text-expected.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/text-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/text-expected.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color does not customize the appearance of text inputs.</p>
+ <input style="accent-color: blue;">
+</body>
+</html>
Added: trunk/LayoutTests/fast/css/accent-color/text.html (0 => 284115)
--- trunk/LayoutTests/fast/css/accent-color/text.html (rev 0)
+++ trunk/LayoutTests/fast/css/accent-color/text.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test that accent-color does not customize the appearance of text inputs.</p>
+ <input style="accent-color: red;">
+</body>
+</html>
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (284114 => 284115)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1,5 +1,19 @@
2021-10-13 Aditya Keerthi <[email protected]>
+ [macOS] Add support for accent-color
+ https://bugs.webkit.org/show_bug.cgi?id=231464
+ rdar://84049511
+
+ Reviewed by Tim Horton.
+
+ Renamed 'not-ref' to 'expected-mismatch' so that the test is run as
+ expected.
+
+ * web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected-mismatch.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001-notref.html.
+ * web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected.html: Removed.
+
+2021-10-13 Aditya Keerthi <[email protected]>
+
Unprefix -webkit-appearance
https://bugs.webkit.org/show_bug.cgi?id=231534
rdar://84112934
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001-notref.html (284114 => 284115)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001-notref.html 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001-notref.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1,2 +0,0 @@
-<!doctype html>
-<input type=checkbox checked style="accent-color: blue">
Copied: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected-mismatch.html (from rev 284114, trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001-notref.html) (0 => 284115)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected-mismatch.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected-mismatch.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -0,0 +1,2 @@
+<!doctype html>
+<input type=checkbox checked style="accent-color: blue">
Deleted: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected.html (284114 => 284115)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected.html 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative-expected.html 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1,2 +0,0 @@
-<!doctype html>
-<input type=checkbox checked style="accent-color: blue">
Modified: trunk/LayoutTests/platform/mac/TestExpectations (284114 => 284115)
--- trunk/LayoutTests/platform/mac/TestExpectations 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2021-10-13 18:05:21 UTC (rev 284115)
@@ -2345,6 +2345,17 @@
webkit.org/b/230116 imported/w3c/web-platform-tests/webrtc-extensions/transfer-datachannel.html [ Pass Failure ]
+# accent-color is currently only supported on macOS
+fast/css/accent-color/checkbox.html [ Pass ]
+fast/css/accent-color/progress.html [ Pass ]
+fast/css/accent-color/radio.html [ Pass ]
+fast/css/accent-color/select.html [ Pass ]
+fast/css/accent-color/text.html [ Pass ]
+imported/w3c/web-platform-tests/css/css-ui/accent-color-checkbox-checked-001.tentative.html [ Pass ]
+
+webkit.org/b/199350 fast/css/accent-color/datalist.html [ ImageOnlyFailure ]
+webkit.org/b/231463 fast/css/accent-color/range.html [ ImageOnlyFailure ]
+
# display-p3 canvas and ImageData are Cocoa only for now.
[ Monterey+ ] fast/canvas/canvas-color-space-display-p3-ImageData.html [ Pass ]
[ Monterey+ ] fast/canvas/canvas-color-space-display-p3.html [ Pass ]
Modified: trunk/Source/WebCore/ChangeLog (284114 => 284115)
--- trunk/Source/WebCore/ChangeLog 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/ChangeLog 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1,3 +1,74 @@
+2021-10-13 Aditya Keerthi <[email protected]>
+
+ [macOS] Add support for accent-color
+ https://bugs.webkit.org/show_bug.cgi?id=231464
+ rdar://84049511
+
+ Reviewed by Tim Horton.
+
+ Enable customizing the tint color of checkboxes, radio buttons, select
+ elements and progress elements using the 'accent-color' property.
+
+ accent-color support on macOS is implemented by setting the tintColor
+ of the current NSAppearance prior to painting controls. This approach
+ is already used to support dark mode, and is now extended to support
+ accent-color.
+
+ Note that <input type=range> does not support accent-color as the
+ current style is non-native. In order to support accent-color, the
+ design of the control must first be updated. Similarly, the <datalist>
+ indicator is not painted using native API, and does not currently
+ support accent-color.
+
+ Tests: fast/css/accent-color/checkbox.html
+ fast/css/accent-color/datalist.html
+ fast/css/accent-color/progress.html
+ fast/css/accent-color/radio.html
+ fast/css/accent-color/range.html
+ fast/css/accent-color/select.html
+ fast/css/accent-color/text.html
+
+ * platform/Theme.cpp:
+ (WebCore::Theme::paint):
+ * platform/Theme.h:
+ * platform/adwaita/ThemeAdwaita.cpp:
+ (WebCore::ThemeAdwaita::paint):
+ * platform/adwaita/ThemeAdwaita.h:
+ * platform/mac/LocalDefaultSystemAppearance.h:
+ (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
+
+ Add a tintColor (optional) parameter to tint the appearance.
+
+ * platform/mac/LocalDefaultSystemAppearance.mm:
+ (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance):
+
+ Use NSAppearance SPI to set the tint color of the current appearance.
+
+ If the tint color is invalid (accent-color: auto) no tint color is set,
+ resulting in the system/app default color being used.
+
+ * platform/mac/ThemeMac.h:
+ * platform/mac/ThemeMac.mm:
+ (WebCore::ThemeMac::paint):
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::paint):
+ * rendering/RenderThemeAdwaita.cpp:
+ (WebCore::RenderThemeAdwaita::paintMenuList):
+ * rendering/RenderThemeMac.mm:
+ (WebCore::RenderThemeMac::paintProgressBar):
+ (WebCore::RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::effectiveAccentColor const):
+
+ Resolve the specified accent-color to one that is usable by the theme.
+ 'auto' resolves to an invalid color so that the system (or app) default
+ may be used.
+
+ * rendering/style/RenderStyle.h:
+ (WebCore::RenderStyle::effectiveAccentColor const):
+ (WebCore::RenderStyle::accentColor const):
+ (WebCore::RenderStyle::hasAutoAccentColor const):
+
2021-10-13 Antti Koivisto <[email protected]>
[LFC][Integration] Move text box logical order cache to the caller
Modified: trunk/Source/WebCore/PAL/ChangeLog (284114 => 284115)
--- trunk/Source/WebCore/PAL/ChangeLog 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/PAL/ChangeLog 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1,3 +1,13 @@
+2021-10-13 Aditya Keerthi <[email protected]>
+
+ [macOS] Add support for accent-color
+ https://bugs.webkit.org/show_bug.cgi?id=231464
+ rdar://84049511
+
+ Reviewed by Tim Horton.
+
+ * pal/spi/mac/NSAppearanceSPI.h:
+
2021-10-12 Wenson Hsieh <[email protected]>
Move some staged VisionKitCore SPI into VisionKitCoreSPI.h
Modified: trunk/Source/WebCore/PAL/pal/spi/mac/NSAppearanceSPI.h (284114 => 284115)
--- trunk/Source/WebCore/PAL/pal/spi/mac/NSAppearanceSPI.h 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/PAL/pal/spi/mac/NSAppearanceSPI.h 2021-10-13 18:05:21 UTC (rev 284115)
@@ -38,6 +38,8 @@
- (BOOL)_usesMetricsAppearance;
#endif
+- (NSAppearance *)appearanceByApplyingTintColor:(NSColor *)tintColor;
+
@end
#endif // USE(APPKIT)
Modified: trunk/Source/WebCore/platform/Theme.cpp (284114 => 284115)
--- trunk/Source/WebCore/platform/Theme.cpp 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/Theme.cpp 2021-10-13 18:05:21 UTC (rev 284115)
@@ -26,6 +26,7 @@
#include "config.h"
#include "Theme.h"
+#include "Color.h"
#include "GraphicsContext.h"
#include "LengthBox.h"
#include "LengthSize.h"
@@ -69,7 +70,7 @@
return false;
}
-void Theme::paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool, bool)
+void Theme::paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool, bool, const Color&)
{
}
Modified: trunk/Source/WebCore/platform/Theme.h (284114 => 284115)
--- trunk/Source/WebCore/platform/Theme.h 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/Theme.h 2021-10-13 18:05:21 UTC (rev 284115)
@@ -31,6 +31,7 @@
namespace WebCore {
+class Color;
class ControlStates;
class FloatRect;
class FontCascade;
@@ -68,7 +69,8 @@
virtual bool controlRequiresPreWhiteSpace(ControlPart) const;
// Method for painting a control. The rect is in zoomed coordinates.
- virtual void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance);
+ // FIXME: <https://webkit.org/b/231637> Move parameters to a struct.
+ virtual void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect& zoomedRect, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance, const Color& tintColor);
// Some controls may spill out of their containers (e.g., the check on an OS X checkbox). When these controls repaint,
// the theme needs to communicate this inflated rect to the engine so that it can invalidate the whole control.
Modified: trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp (284114 => 284115)
--- trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.cpp 2021-10-13 18:05:21 UTC (rev 284115)
@@ -228,7 +228,7 @@
return Theme::controlBorder(part, font, zoomedBox, zoomFactor);
}
-void ThemeAdwaita::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float, ScrollView*, float, float, bool, bool useDarkAppearance)
+void ThemeAdwaita::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float, ScrollView*, float, float, bool, bool useDarkAppearance, const Color&)
{
switch (part) {
case CheckboxPart:
Modified: trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.h (284114 => 284115)
--- trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.h 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/adwaita/ThemeAdwaita.h 2021-10-13 18:05:21 UTC (rev 284115)
@@ -52,7 +52,7 @@
LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float) const final;
LengthSize minimumControlSize(ControlPart, const FontCascade&, const LengthSize&, float) const final;
LengthBox controlBorder(ControlPart, const FontCascade&, const LengthBox&, float) const final;
- void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool, bool) final;
+ void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float, ScrollView*, float, float, bool, bool, const Color&) final;
void paintCheckbox(ControlStates&, GraphicsContext&, const FloatRect&, bool);
void paintRadio(ControlStates&, GraphicsContext&, const FloatRect&, bool);
Modified: trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.h (284114 => 284115)
--- trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.h 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.h 2021-10-13 18:05:21 UTC (rev 284115)
@@ -33,6 +33,8 @@
OBJC_CLASS NSAppearance;
namespace WebCore {
+
+class Color;
// This class automatically saves and restores the current NSAppearance for
// functions which call out into AppKit and rely on the current NSAppearance being set
@@ -40,7 +42,7 @@
WTF_MAKE_NONCOPYABLE(LocalDefaultSystemAppearance);
public:
- WEBCORE_EXPORT LocalDefaultSystemAppearance(bool useDarkAppearance);
+ WEBCORE_EXPORT LocalDefaultSystemAppearance(bool useDarkAppearance, const Color& tintColor = { });
WEBCORE_EXPORT ~LocalDefaultSystemAppearance();
bool usingDarkAppearance() const
Modified: trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm (284114 => 284115)
--- trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm 2021-10-13 18:05:21 UTC (rev 284115)
@@ -27,11 +27,14 @@
#if USE(APPKIT)
+#import "ColorMac.h"
+
#import <AppKit/NSAppearance.h>
+#import <pal/spi/mac/NSAppearanceSPI.h>
namespace WebCore {
-LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useDarkAppearance)
+LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useDarkAppearance, const Color& tintColor)
{
#if HAVE(OS_DARK_MODE_SUPPORT)
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
@@ -40,10 +43,16 @@
m_usingDarkAppearance = useDarkAppearance;
ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- [NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:m_usingDarkAppearance ? NSAppearanceNameDarkAqua : NSAppearanceNameAqua]];
+ NSAppearance *appearance = [NSAppearance appearanceNamed:m_usingDarkAppearance ? NSAppearanceNameDarkAqua : NSAppearanceNameAqua];
+
+ if (tintColor.isValid())
+ appearance = [appearance appearanceByApplyingTintColor:nsColor(tintColor)];
+
+ [NSAppearance setCurrentAppearance:appearance];
ALLOW_DEPRECATED_DECLARATIONS_END
#else
UNUSED_PARAM(useDarkAppearance);
+ UNUSED_PARAM(tintColor);
#endif
}
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.h (284114 => 284115)
--- trunk/Source/WebCore/platform/mac/ThemeMac.h 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.h 2021-10-13 18:05:21 UTC (rev 284115)
@@ -57,7 +57,7 @@
bool controlRequiresPreWhiteSpace(ControlPart part) const final { return part == PushButtonPart; }
- void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance) final;
+ void paint(ControlPart, ControlStates&, GraphicsContext&, const FloatRect&, float zoomFactor, ScrollView*, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance, const Color& tintColor) final;
void inflateControlPaintRect(ControlPart, const ControlStates&, FloatRect&, float zoomFactor) const final;
bool userPrefersReducedMotion() const final;
Modified: trunk/Source/WebCore/platform/mac/ThemeMac.mm (284114 => 284115)
--- trunk/Source/WebCore/platform/mac/ThemeMac.mm 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/platform/mac/ThemeMac.mm 2021-10-13 18:05:21 UTC (rev 284115)
@@ -936,12 +936,12 @@
END_BLOCK_OBJC_EXCEPTIONS
}
-void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance)
+void ThemeMac::paint(ControlPart part, ControlStates& states, GraphicsContext& context, const FloatRect& zoomedRect, float zoomFactor, ScrollView* scrollView, float deviceScaleFactor, float pageScaleFactor, bool useSystemAppearance, bool useDarkAppearance, const Color& tintColor)
{
UNUSED_PARAM(useSystemAppearance);
UNUSED_PARAM(pageScaleFactor);
- LocalDefaultSystemAppearance localAppearance(useDarkAppearance);
+ LocalDefaultSystemAppearance localAppearance(useDarkAppearance, tintColor);
switch (part) {
case CheckboxPart:
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (284114 => 284115)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2021-10-13 18:05:21 UTC (rev 284115)
@@ -445,7 +445,7 @@
case ButtonPart:
case InnerSpinButtonPart:
updateControlStatesForRenderer(box, controlStates);
- Theme::singleton().paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor, box.document().useSystemAppearance(), box.useDarkAppearance());
+ Theme::singleton().paint(part, controlStates, paintInfo.context(), devicePixelSnappedRect, box.style().effectiveZoom(), &box.view().frameView(), deviceScaleFactor, pageScaleFactor, box.document().useSystemAppearance(), box.useDarkAppearance(), box.style().effectiveAccentColor());
return false;
default:
break;
Modified: trunk/Source/WebCore/rendering/RenderThemeAdwaita.cpp (284114 => 284115)
--- trunk/Source/WebCore/rendering/RenderThemeAdwaita.cpp 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/rendering/RenderThemeAdwaita.cpp 2021-10-13 18:05:21 UTC (rev 284115)
@@ -382,7 +382,7 @@
if (isHovered(renderObject))
states.add(ControlStates::States::Hovered);
ControlStates controlStates(states);
- Theme::singleton().paint(ButtonPart, controlStates, graphicsContext, rect, 1., nullptr, 1., 1., false, renderObject.useDarkAppearance());
+ Theme::singleton().paint(ButtonPart, controlStates, graphicsContext, rect, 1., nullptr, 1., 1., false, renderObject.useDarkAppearance(), renderObject.style().effectiveAccentColor());
FloatRect fieldRect = rect;
fieldRect.inflate(menuListButtonBorderSize);
Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (284114 => 284115)
--- trunk/Source/WebCore/rendering/RenderThemeMac.mm 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1310,6 +1310,8 @@
if (!is<RenderProgress>(renderObject))
return true;
+ LocalDefaultSystemAppearance localAppearance(renderObject.useDarkAppearance(), renderObject.style().effectiveAccentColor());
+
IntRect inflatedRect = progressBarRectForBounds(renderObject, rect);
NSControlSize controlSize = controlSizeForFont(renderObject.style());
const auto& renderProgress = downcast<RenderProgress>(renderObject);
@@ -1662,7 +1664,7 @@
void RenderThemeMac::paintCellAndSetFocusedElementNeedsRepaintIfNecessary(NSCell* cell, const RenderObject& renderer, const PaintInfo& paintInfo, const FloatRect& rect)
{
- LocalDefaultSystemAppearance localAppearance(renderer.useDarkAppearance());
+ LocalDefaultSystemAppearance localAppearance(renderer.useDarkAppearance(), renderer.style().effectiveAccentColor());
bool shouldDrawFocusRing = isFocused(renderer) && renderer.style().outlineStyleIsAuto() == OutlineIsAuto::On;
bool shouldDrawCell = true;
if (ThemeMac::drawCellOrFocusRingWithViewIntoContext(cell, paintInfo.context(), rect, documentViewFor(renderer), shouldDrawCell, shouldDrawFocusRing, renderer.page().deviceScaleFactor()))
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (284114 => 284115)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2021-10-13 18:05:21 UTC (rev 284115)
@@ -2173,6 +2173,17 @@
return transformedColor;
}
+Color RenderStyle::effectiveAccentColor() const
+{
+ if (hasAutoAccentColor())
+ return { };
+
+ if (hasAppleColorFilter())
+ return colorByApplyingColorFilter(colorResolvingCurrentColor(accentColor()));
+
+ return colorResolvingCurrentColor(accentColor());
+}
+
const BorderValue& RenderStyle::borderBefore() const
{
switch (writingMode()) {
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (284114 => 284115)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-10-13 18:04:32 UTC (rev 284114)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2021-10-13 18:05:21 UTC (rev 284115)
@@ -1859,8 +1859,6 @@
const Color& textStrokeColor() const { return m_rareInheritedData->textStrokeColor; }
const Color& caretColor() const { return m_rareInheritedData->caretColor; }
bool hasAutoCaretColor() const { return m_rareInheritedData->hasAutoCaretColor; }
- const Color& accentColor() const { return m_rareInheritedData->accentColor; }
- bool hasAutoAccentColor() const { return m_rareInheritedData->hasAutoAccentColor; }
const Color& visitedLinkColor() const;
const Color& visitedLinkBackgroundColor() const { return m_rareNonInheritedData->visitedLinkBackgroundColor; }
const Color& visitedLinkBorderLeftColor() const { return m_rareNonInheritedData->visitedLinkBorderLeftColor; }
@@ -1881,6 +1879,10 @@
const Color& floodColor() const { return svgStyle().floodColor(); }
const Color& lightingColor() const { return svgStyle().lightingColor(); }
+ Color effectiveAccentColor() const;
+ const Color& accentColor() const { return m_rareInheritedData->accentColor; }
+ bool hasAutoAccentColor() const { return m_rareInheritedData->hasAutoAccentColor; }
+
private:
struct NonInheritedFlags {
bool operator==(const NonInheritedFlags&) const;