WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
234199
Allow override of system's preferred color scheme
https://bugs.webkit.org/show_bug.cgi?id=234199
Summary
Allow override of system's preferred color scheme
Dean Jackson
Reported
2021-12-11 09:05:31 PST
Allow override of system's preferred color scheme
Attachments
Patch
(22.90 KB, patch)
2021-12-11 09:17 PST
,
Dean Jackson
no flags
Details
Formatted Diff
Diff
Patch
(23.20 KB, patch)
2021-12-13 11:08 PST
,
Dean Jackson
no flags
Details
Formatted Diff
Diff
Patch
(22.90 KB, patch)
2021-12-13 13:44 PST
,
Dean Jackson
thorton
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2021-12-11 09:07:46 PST
<
rdar://problem/86366044
>
Dean Jackson
Comment 2
2021-12-11 09:17:55 PST
Created
attachment 446891
[details]
Patch
Anders Carlsson
Comment 3
2021-12-11 13:36:38 PST
Looks like all the EWS bots are red.
Dean Jackson
Comment 4
2021-12-12 08:45:05 PST
(In reply to Anders Carlsson from
comment #3
)
> Looks like all the EWS bots are red.
Very impressive. Do I win a prize?
Dean Jackson
Comment 5
2021-12-13 11:08:47 PST
Created
attachment 447028
[details]
Patch
Dean Jackson
Comment 6
2021-12-13 11:09:50 PST
Would appreciate feedback on the SPI naming - I put the word "explicitly" in there to make it clear that this isn't the preference coming from the system.
Tim Horton
Comment 7
2021-12-13 11:22:26 PST
Comment on
attachment 447028
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447028&action=review
> Source/WebKit/UIProcess/API/APIWebsitePolicies.h:135 > + WebCore::ColorSchemePreference userExplicitlyPrefersColorScheme() const { return m_userExplicitlyPrefersColorScheme; }
This getter name feels slightly odd (it sounds like it would return a boolean that the "user explicitly prefers (a) color scheme").
Dean Jackson
Comment 8
2021-12-13 11:24:58 PST
Comment on
attachment 447028
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447028&action=review
>> Source/WebKit/UIProcess/API/APIWebsitePolicies.h:135 >> + WebCore::ColorSchemePreference userExplicitlyPrefersColorScheme() const { return m_userExplicitlyPrefersColorScheme; } > > This getter name feels slightly odd (it sounds like it would return a boolean that the "user explicitly prefers (a) color scheme").
Do you think I should call it colorSchemePreference?
Tim Horton
Comment 9
2021-12-13 12:39:29 PST
(In reply to Dean Jackson from
comment #8
)
> Comment on
attachment 447028
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=447028&action=review
> > >> Source/WebKit/UIProcess/API/APIWebsitePolicies.h:135 > >> + WebCore::ColorSchemePreference userExplicitlyPrefersColorScheme() const { return m_userExplicitlyPrefersColorScheme; } > > > > This getter name feels slightly odd (it sounds like it would return a boolean that the "user explicitly prefers (a) color scheme"). > > Do you think I should call it colorSchemePreference?
or preferredColorScheme? Or maybe shove the word "override" in there somewhere because it overrides the system preference?
Dean Jackson
Comment 10
2021-12-13 13:44:42 PST
Created
attachment 447056
[details]
Patch
Tim Horton
Comment 11
2021-12-13 17:16:03 PST
Comment on
attachment 447056
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=447056&action=review
> Source/WebCore/css/MediaQueryEvaluator.cpp:811 > + bool useDarkAppearance = [&] () -> auto {
Are there other things that read useDarkAppearance that need to change? Should useDarkAppearance itself respect the bit on DocumentLoader?
Antoine Quint
Comment 12
2021-12-14 02:46:11 PST
There is an existing `ColorScheme` enum with holds the `Light` and `Dark` options. Maybe instead of adding a new enum you could use an std::optional<ColorScheme> where std::nullopt would indicate the lack of a preference?
Dean Jackson
Comment 13
2021-12-14 10:21:28 PST
Committed
r287030
(?): <
https://commits.webkit.org/r287030
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug