Граф коммитов

260 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez b8f1a27f5a Bug 1761923 - Make some shadow colors react to dark mode in GTK/Cocoa. r=mstange
This matches Windows' behavior.

Differential Revision: https://phabricator.services.mozilla.com/D142319
2022-04-06 17:16:41 +00:00
Emilio Cobos Álvarez a18fdda05d Bug 1762298 - GCC build bustage and reftest fixes.
MANUAL PUSH: Orange fix CLOSED TREE
2022-04-04 22:14:24 +02:00
Emilio Cobos Álvarez cae6641413 Bug 1761923 - Add generic Buttonshadow support.
MANUAL PUSH: Fixes orange CLOSED TREE
2022-04-04 22:00:28 +02:00
Emilio Cobos Álvarez e47024038c Bug 1762018 - Derive a color scheme when forcing preference colors. r=morgan
This patch is a bit bigger than I'd like, but it's mostly moving code
around to centralize the color/color-scheme decisions we make when
forcing colors.

In practice, the only behavior change should be that when "use system
colors" is false and we force colors, we force a color-scheme that
matches the user-chosen background (via the LookAndFeel::IsDarkColor
check).

That should make sure that text from system colors is light and matches
the user expectations.

Before this patch, we used to force the color-scheme to light, but that
was just so that we ended up looking at mLightColors. Instead, we
achieve that via a separate bit (mForcedLightColorSet, naming up for
debate, not a fan), so that we can use the right system colors
otherwise.

Another alternative I considered is making all non-link system colors
return mDefaultBackground / mDefault depending on whether they are
background / foreground colors. That seemed a lot more work and
potentially a regression in various ways. I think this should be
strictly an improvement instead.

Differential Revision: https://phabricator.services.mozilla.com/D142423
2022-04-01 01:21:22 +00:00
Cristian Tuns da85cd4a66 Backed out changeset 5d97c7b1b9b5 (bug 1762018) for causing mochitest failures in test_bug232227.html CLOSED TREE 2022-03-31 19:12:48 -04:00
Emilio Cobos Álvarez 0555de1ae2 Bug 1762018 - Derive a color scheme when forcing preference colors. r=morgan
This patch is a bit bigger than I'd like, but it's mostly moving code
around to centralize the color/color-scheme decisions we make when
forcing colors.

In practice, the only behavior change should be that when "use system
colors" is false and we force colors, we force a color-scheme that
matches the user-chosen background (via the LookAndFeel::IsDarkColor
check).

That should make sure that text from system colors is light and matches
the user expectations.

Before this patch, we used to force the color-scheme to light, but that
was just so that we ended up looking at mLightColors. Instead, we
achieve that via a separate bit (mForcedLightColorSet, naming up for
debate, not a fan), so that we can use the right system colors
otherwise.

Another alternative I considered is making all non-link system colors
return mDefaultBackground / mDefault depending on whether they are
background / foreground colors. That seemed a lot more work and
potentially a regression in various ways. I think this should be
strictly an improvement instead.

Differential Revision: https://phabricator.services.mozilla.com/D142423
2022-03-31 22:03:09 +00:00
Brad Werth ac55f07b1b Bug 1751217 Part 4: Make macOS declare video-dynamic-range: high with new-enough OS. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D141056
2022-03-24 18:19:50 +00:00
Butkovits Atila fbd6ad4819 Backed out 5 changesets (bug 1751217) for causing failures at dynamic-range.html. CLOSED TREE
Backed out changeset f0a4879c9709 (bug 1751217)
Backed out changeset 50b6310935d4 (bug 1751217)
Backed out changeset bfa455b8bb1a (bug 1751217)
Backed out changeset 277064a1facb (bug 1751217)
Backed out changeset 21e1650b12db (bug 1751217)
2022-03-23 22:22:54 +02:00
Brad Werth c2a8cb2d17 Bug 1751217 Part 4: Make macOS declare video-dynamic-range: high with new-enough OS. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D141056
2022-03-23 18:23:01 +00:00
Marian-Vasile Laza 77029463ac Backed out 5 changesets (bug 1751217) for causing wpt(Screen-pixelDepth-Screen-colorDepth001.html) and mochitest(test_media_queries.html) failures. CLOSED TREE
Backed out changeset 60a4497fd1f5 (bug 1751217)
Backed out changeset 785f4c5f719d (bug 1751217)
Backed out changeset 81e41f7a1ee4 (bug 1751217)
Backed out changeset d35c5648c936 (bug 1751217)
Backed out changeset f16305c6ec83 (bug 1751217)
2022-03-23 10:11:53 -07:00
Brad Werth e2d894d2e2 Bug 1751217 Part 4: Make macOS declare video-dynamic-range: high with new-enough OS. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D141056
2022-03-23 15:24:39 +00:00
Emilio Cobos Álvarez 5950d7b598 Bug 1736218 - Stop using heuristics to determine content color-scheme. r=dao
Use system color-scheme for content for anything that isn't explicitly
opted into.

Differential Revision: https://phabricator.services.mozilla.com/D140376
2022-03-17 14:44:04 +00:00
Emilio Cobos Álvarez 3d2bf29691 Bug 1750932 - Add color_scheme / content_color_scheme properties to theme API. r=robwu,dao
This allows themes to override our light / dark theme heuristics if they
choose to, so that we don't have to complicate the heuristics too much.

This is specially useful for themes with images, where the image might
be "light", but still have enough contrast with light text. A good
example is the theme mentioned in bug 1749837 comment 0.

The semantics are:

 * color_scheme: If set, overrides the general "toolbar theme" (so
   window and context menu appearance and so on), otherwise we fall back
   to heuristics.

 * content_color_scheme: If set, overrides the color scheme for the
   content area. Otherwise we fall back to color_scheme if present, or
   heuristics otherwise.

One thing that I didn't include was a sort of "system" option, which
might be useful to say "this theme is neutral, and works both for light
and dark themes". Let me know if you think that's a must-have, otherwise
I think it's probably worth deferring to a follow-up if it's needed at
all.

Differential Revision: https://phabricator.services.mozilla.com/D136354
2022-03-17 14:44:03 +00:00
Emilio Cobos Álvarez e7bfa879da Bug 1736218 - Expose theme-derived color-scheme to privileged code. r=Gijs
This will be needed to determine whether following the Firefox theme
would produce light or dark colors.

Differential Revision: https://phabricator.services.mozilla.com/D140221
2022-03-04 13:08:30 +00:00
Emilio Cobos Álvarez 96533d3817 Bug 1756082 - Properly support ui.systemUsesDarkMode switching on Linux. r=karlt
So the issue here is that GTK's nsLookAndFeel doesn't know about the
effective value of the pref, and thus ends up potentially choosing the
wrong GTK theme (and thus choosing light system colors, but thinking
that we can paint the textfield background natively with GTK, which
would have a dark background, for example).

The right fix here is treating the pref as a stronger hint than the
ColorSchemePreference that we compute from DBUS for the same purpose.
This makes us follow the same code-path as if the system had specified
dark mode itself, fixing the contrast issue.

While at it, fix dynamic changes to this pref, which need to update
system colors.

Differential Revision: https://phabricator.services.mozilla.com/D139093
2022-02-21 10:04:57 +00:00
Emilio Cobos Álvarez c7de191b45 Bug 1147847 - Allow users to enable overlay scrollbars on Linux from about:preferences. r=Gijs,fluent-reviewers,preferences-reviewers
We might want to do this on Windows 11 as well, but Windows 11 has a
system-wide preference with UI so let's not do that just yet at least,
UI-exposed preference.

Differential Revision: https://phabricator.services.mozilla.com/D138502
2022-02-14 07:43:42 +00:00
Emilio Cobos Álvarez 5fed8de04b Bug 1754547 - Generalize moz-os-version into moz-platform. r=dao,preferences-reviewers,Gijs
Allow differentiating non-windows platforms on it.

Differential Revision: https://phabricator.services.mozilla.com/D138431
2022-02-10 15:50:31 +00:00
Emilio Cobos Álvarez 7346b0b19c Bug 1750483 - Add a generic dark color for ThreeDFace. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D136405
2022-01-19 19:33:34 +00:00
Emilio Cobos Álvarez 9db1237953 Bug 1750330 - Move global LookAndFeel changes to mozilla::LookAndFeel. r=mstange
So that the changes don't get lost when there's no PresShell in the
process.

Differential Revision: https://phabricator.services.mozilla.com/D136155
2022-01-17 16:34:11 +00:00
Emilio Cobos Álvarez de7b391af7 Bug 1749645 - Rename nsNativeBasicTheme{,Cocoa} to Theme{,Cocoa}. r=mstange
We have this situation right now where all the themes are inheriting from
nsNativeBasicTheme. Rename it to a nicer name, and clean up some code while at
it.

In the future I'd like to simplify the inheritance chain to remove
nsNativeTheme altogether (so that all nsITheme implementations use
mozilla::widget::Theme).

That's not hard to do mechanically, but rather than dumping all of
nsNativeTheme into Theme I'd like to do it a bit more carefully, to hopefully
remove a lot of the helpers that nsNativeTheme has to deal with XUL and so on
and use something nicer. Eventually the inheritance chain will be something
like:

 * nsITheme : public nsISupports
 * Theme : public nsITheme, public nsITimerCallback, public nsINamed
 * ThemeCocoa : public Theme
 * nsNativeThemeCocoa : public ThemeCocoa
 * nsNativeThemeWin : public Theme
 * nsNativeThemeGtk : public Theme

Differential Revision: https://phabricator.services.mozilla.com/D135668
2022-01-12 16:33:31 +00:00
Xidorn Quan 855814f769 Bug 1748190 - Convert findbar.modalHighlight from static pref to dynamic one. r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D134937
2022-01-03 06:27:03 +00:00
Emilio Cobos Álvarez b4eb3f9643 Bug 1745894 - Don't draw window decorations when painting headerbar on wayland. r=stransky
This is a better fix for the double decorations than clipping them using
CSS.

Differential Revision: https://phabricator.services.mozilla.com/D133871
2021-12-15 13:12:01 +00:00
Andi-Bogdan Postelnicu 359e82a664 Bug 1519636 - Reformat recent changes to the Google coding style. r=sylvestre
Updated with clang-format version 13.0.0 (taskcluster-cMIjs2JaRe6fqM2zK7ZACQ)

Differential Revision: https://phabricator.services.mozilla.com/D132868
2021-12-05 19:04:18 +00:00
Emilio Cobos Álvarez 2abc89c41e Bug 1509931 - Use titlebar radius on Linux and make titlebar set-up work for lightweight themes. r=stransky,dao
To do this, we always draw the native titlebar behind the toolbox, and
then make the toolbox adapt to it by using the titlebar radius. This
makes us preserve the shadow properly.

On Wayland we'd double-draw the shadow (see bug 1509931 comment 4) so
this fixes it by trimming it as well using border-radius.

Differential Revision: https://phabricator.services.mozilla.com/D128681
2021-12-01 18:15:12 +00:00
Emilio Cobos Álvarez f869c28593 Bug 1740518 - Remove allow-gtk-dark-theme special-case in color-scheme computation. r=mstange
See the comments as for why. If as a user you want to get this behavior
you could put something like:

  :root { color-scheme: light dark }

in a user stylesheet, but that could cause the same contrast issues the
allow-gtk-dark-theme pref has now.

Differential Revision: https://phabricator.services.mozilla.com/D132361
2021-11-29 21:49:42 +00:00
Emilio Cobos Alvarez 8416a9e79d Bug 1742796 - Use a more transparent color for dark mode / Android selection. r=geckoview-reviewers,owlish
This prevents contrast issues with colors that are very similar to the
selection background.

See before / after screenshots. Selection on higher-contrasting
foregrounds still looks good.

This is the alpha channel that e.g., Bugzilla uses on dark mode
(so I didn't just mint it).

Differential Revision: https://phabricator.services.mozilla.com/D132022
2021-11-25 20:09:25 +00:00
Emilio Cobos Álvarez 8c9d1b38e8 Bug 1741900 - Ensure color-scheme is initialized in a couple callers which might not have initialized LookAndFeel yet. r=mhowell
The previous patch would be a better fix, but it causes some xpcshell
crashes on Linux which I haven't figured out yet (because initializing
LookAndFeel initializes gfxPlatform).

This should be less risky and still fix the bug.

Differential Revision: https://phabricator.services.mozilla.com/D132011
2021-11-24 16:50:38 +00:00
lamoure6 3478e8ae47 Bug 1719938 - Removed remaining (non-negated) -moz-proton media queries. r=mhowell,mtigley,emilio
Differential Revision: https://phabricator.services.mozilla.com/D125328
2021-11-22 22:10:33 +00:00
Emilio Cobos Álvarez 6d41085b0e Bug 1741499 - Cleanup a bit HeadlessLookAndFeelGTK too. r=spohl
The colors that I didn't move to nsXPLookAndFeel are always set via
prefs.

Differential Revision: https://phabricator.services.mozilla.com/D131286
2021-11-17 01:24:20 +00:00
Emilio Cobos Álvarez 2d8ab09b73 Bug 1739699 - Use preferred color scheme when forcing colors with system colors (except windows HCM). r=morgan
This causes (among other things) pages to be dark when using regular
windows system colors and forcing colors to "always", which is nice.

Differential Revision: https://phabricator.services.mozilla.com/D131165
2021-11-16 22:30:26 +00:00
Emilio Cobos Álvarez 4d6ee249dc Bug 1739925 - Add a foreground color to attention selection. r=jfkthame
In some platforms (like macOS, windows dark mode, android, and some gtk
themes) the foreground selection color might be `currentcolor`, and that
doesn't generally guarantee enough contrast with the attention
background.

Remove HeadlessLookAndFeelGTK's handling of this color since it's
useless (always overridden by prefs in all.js)

Differential Revision: https://phabricator.services.mozilla.com/D130617
2021-11-11 11:14:13 +00:00
Emilio Cobos Álvarez e97b882edc Bug 1739539 - Rename titlebar pref and add migration from old pref. r=mconley
Something like this ought to do?

Differential Revision: https://phabricator.services.mozilla.com/D130858
2021-11-10 21:17:32 +00:00
Emilio Cobos Álvarez 4ad52902c3 Bug 1738156 - Tweak default dark hyperlink colors. r=morgan
Note that this is on top of D129993.

Differential Revision: https://phabricator.services.mozilla.com/D129999
2021-11-09 14:33:53 +00:00
Emilio Cobos Álvarez c308704902 Bug 1738614 - Remove other Widget* colors. r=mstange
These are only used for frameset painting and the non-e10s <select>
dropdown focus codepath. We have other more appropriate standard
colors for this.

Differential Revision: https://phabricator.services.mozilla.com/D129992
2021-11-02 18:08:07 +00:00
Emilio Cobos Álvarez 923cf5df84 Bug 1738614 - Remove TextForeground/Background system colors. r=mstange
Same thing, there's nor reason these should be different from other
CSS-exposed colors.

Differential Revision: https://phabricator.services.mozilla.com/D129991
2021-11-02 18:08:07 +00:00
Emilio Cobos Álvarez ac14d7e42d Bug 1738614 - Remove WindowBackground/Foreground system colors. r=mstange
There's no reason for these to be different to the CSS-exposed
Window/WindowText.

Differential Revision: https://phabricator.services.mozilla.com/D129990
2021-11-02 18:08:07 +00:00
Emilio Cobos Álvarez 88397b3a00 Bug 1738613 - Provide generic dark hyperlink system colors. r=dholbert
This will make sure they're used on Windows for the dark color scheme.

Differential Revision: https://phabricator.services.mozilla.com/D129993
2021-11-02 10:45:04 +00:00
Emilio Cobos Álvarez 71e6f9ec23 Bug 1738616 - Enable color-scheme for nightly and early beta. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D129995
2021-11-01 10:53:36 +00:00
Emilio Cobos Álvarez e09c109ab2 Bug 1738608 - Allow customizing dark system colors by pref as well. r=mstange
Just noticed we don't quite have that capability, but it seems useful.

Differential Revision: https://phabricator.services.mozilla.com/D129989
2021-10-31 21:29:21 +00:00
Emilio Cobos Álvarez 69eeb9cb6c Bug 1738608 - Make autofill background configurable via system color prefs. r=mstange
And remove the autofill.background pref for 95 (or 96, depending on
when this lands) assuming nothing terrible causes us to turn it off on
94.

Differential Revision: https://phabricator.services.mozilla.com/D129988
2021-10-31 21:28:58 +00:00
Jonathan Kew 2a3d097e41 Bug 1737751 - Account for macOS cursor scaling. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129521
2021-10-28 12:25:23 +00:00
Emilio Cobos Álvarez 5b31eea4fd Bug 1737676 - Use GTK menu radius on native context menus and panels. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D129439
2021-10-28 10:52:31 +00:00
Emilio Cobos Álvarez f317384568 Bug 1736518 - Make browser.tabs.drawInTitlebar a tri-state. r=stransky,Gijs
To more properly support Linux having a different default at runtime.

Expose the resolved value in appinfo for convenience, and use it in the
front-end as needed.

Differential Revision: https://phabricator.services.mozilla.com/D129004
2021-10-21 09:07:12 +00:00
stransky aecdcaacb9 Bug 1736795 [Linux] Export titlebar radius as int from LookAndFeel, r=emilio
Titlebar radius is exported as integer from Gtk so there's no need to use floats here.

Differential Revision: https://phabricator.services.mozilla.com/D128993
2021-10-20 18:01:02 +00:00
Emilio Cobos Álvarez 736cd85309 Bug 1736141 - Derive a content theme from newtab page background, and use it for non-chrome docshells. r=mstange,dao
We use "is-in-chrome-docshell" rather than "is a chrome doc" so that about:
pages that are loaded in the content area (like about:addons etc) follow the
general content theme as well.

Cache the relevant color schemes since having that many branches on the default
system theme made me a bit uncomfortable, and this code can be called quite a
lot... Though it probably isn't such a huge deal. This makes us initialize the
theme right away, so make sure subclasses do the right thing. This in practice
was only an issue for GTK, which does cache the "system theme is dark" bit.

Differential Revision: https://phabricator.services.mozilla.com/D128674
2021-10-20 08:25:57 +00:00
Emilio Cobos Álvarez 2cdb78d6a6 Bug 1509931 - Remove -moz-gtk-csd-transparent-background. r=stransky,desktop-theme-reviewers,dao
We always use alpha visual for WebRender, and appearance: none is
unnecessary (root element has no intrinsic appearance).

Differential Revision: https://phabricator.services.mozilla.com/D128682
2021-10-18 18:51:41 +00:00
Emilio Cobos Álvarez b742f680db Bug 1509931 - Expose titlebar radius as a chrome-only CSS environment variable. r=stransky
Mostly plumbing.

Differential Revision: https://phabricator.services.mozilla.com/D128680
2021-10-18 16:22:13 +00:00
Emilio Cobos Álvarez 5122357c49 Bug 1736163 - layout.css.prefers-color-scheme.content-override should trigger a look and feel update.
MANUAL PUSH: Trivial orange fix CLOSED TREE
2021-10-17 15:32:02 +02:00
Emilio Cobos Álvarez fb8e2b5796 Bug 1736038 - Simplify some color-scheme handling in core. r=mstange
Remove the follow-firefox-theme pref as now that's default everywhere,
and document better the behavior of the color-scheme property by
reworking and commenting the logic on it a bit.

Differential Revision: https://phabricator.services.mozilla.com/D128610
2021-10-15 16:53:08 +00:00
Emilio Cobos Álvarez 0b7cfe2afa Bug 1735800 - Undo the workaround from bug 1733413 (and simplify relevant tests). r=mstange
We know how to paint dark stuff now. Change the tests so that we use a
light color-scheme on chrome documents that we compare against content
documents, and simplify some code now that the non-native theme is
everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D128485
2021-10-14 17:13:15 +00:00