Commit Graph

276 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
d37eb95bc7 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
ba2afe8f45 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
c71035c8a0 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
ce76151285 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
95ecf8f7a6 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
34020e09ed 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
b97beebaf8 Bug 1735083 - Clean up GTK titlebar colors. r=desktop-theme-reviewers,dao
Apparently ActiveCaption/CaptionText/InactiveCaption/InactiveCaptionText
are supposed to be used for titlebars, so implement them properly and
remove the GTK-specific colors.

Differential Revision: https://phabricator.services.mozilla.com/D128028
2021-10-11 22:16:58 +00:00
Emilio Cobos Alvarez
6c9a94a6db Bug 1735078 - Clean up some unused LookAndFeel code on Windows. r=mhowell
Differential Revision: https://phabricator.services.mozilla.com/D128025
2021-10-11 17:11:27 +00:00
Emilio Cobos Alvarez
edb138b58f Bug 1734226 - Use a single pref to determine whether system colors follow the Firefox theme. r=desktop-theme-reviewers,dao
Now that windows is going to support dark colors, we want to make it
behave like other platforms in this regard.

Having a single pref for this seems better.

Differential Revision: https://phabricator.services.mozilla.com/D127624
2021-10-06 15:29:59 +00:00
Emilio Cobos Álvarez
bade865adb Bug 1734115 - Add basic support for dark form controls to nsNativeBasicTheme. r=mstange
For that:

 * Tweak the standin system colors to match the non-native theme.

 * Use those system colors for button and field backgrounds.

 * Rename the "should use system colors" bit to "is high contrast",
   which is what it really is (specially now that we use system colors
   also in non-high-contrast).

Border colors and other colors like the <input type=range> and such
might need some extra tweaking perhaps, but this is a decent start and
looks good in https://crisal.io/tmp/form-controls.html afaict (dark mode
toggle needs the color-scheme pref enabled of course).

Differential Revision: https://phabricator.services.mozilla.com/D127533
2021-10-05 14:40:52 +00:00
Emilio Cobos Alvarez
4ef91ac4e9 Bug 1733565 - Clean up button active system colors. r=mstange,desktop-theme-reviewers,dao
This patch does three things:

 * Unifies mac and gtk's buttonactivetext system colors (unships mac's from
   content, but it was never meant to be exposed).

 * Simplifies the forms.css rules, since <input type=color>'s color property
   value doesn't affect its rendering in any meaningful way.

 * Adds a buttonactiveface color, which we'll use to provide dark backgrounds
   for buttons in Windows dark mode (and is good practice, since generally
   every text system color should have a corresponding background).

So as-is it shouldn't change content-exposed behavior (except we stop exposing
the -moz-mac-buttonactivetext to content), but it's a worthy cleanup.

Depends on D127246

Differential Revision: https://phabricator.services.mozilla.com/D127259
2021-10-01 19:42:16 +00:00
Stephen A Pohl
600e9bddd3 Bug 1633860: Place window control buttons on the right side on macOS when using an RTL system locale, regardless of the Firefox locale. r=mstange,emilio,harry
Differential Revision: https://phabricator.services.mozilla.com/D116921
2021-09-22 18:51:20 +00:00
Emilio Cobos Álvarez
a0b03f3393 Bug 1693222 - Implement SelectedItem and SelectedItemText system colors. r=mstange
Since Highlight / HighlightText are now equivalent to the text selection
ones, remove those too.

Differential Revision: https://phabricator.services.mozilla.com/D123964
2021-09-02 11:38:01 +00:00
Narcis Beleuzu
cbaf570ec7 Backed out changeset 28a0487d0291 (bug 1693222) for reftest failure on themed-widget.html. CLOSED TREE 2021-09-02 02:26:12 +03:00
Emilio Cobos Álvarez
e48b7285ba Bug 1693222 - Implement SelectedItem and SelectedItemText system colors. r=mstange
Since Highlight / HighlightText are now equivalent to the text selection
ones, remove those too.

Differential Revision: https://phabricator.services.mozilla.com/D123964
2021-09-01 18:21:57 +00:00
Andrew Osmond
2569649469 Bug 1724936 - Remove XRender support. r=jrmuizel
This has been deprecated for a long time, and it doesn't work in
conjuction with WebRender.

Differential Revision: https://phabricator.services.mozilla.com/D122368
2021-08-25 19:35:23 +00:00
Bob Owen
d046af952a Bug 1701796: Move IsTouchDeviceSupportPresent to LookAndFeel remoting to prevent win32k usage in the content process. r=emilio,geckoview-reviewers,owlish
Differential Revision: https://phabricator.services.mozilla.com/D123497
2021-08-25 14:32:13 +00:00
Karl Tomlinson
4f07caeed2 Bug 1725917 use the same logic for chrome ColorScheme in MatchFirefoxThemeIfNeeded() as in ColorSchemeForDocument() r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D122807
2021-08-18 07:45:15 +00:00
Iulian Moraru
527242eb0a Backed out changeset e40234e5ffde (bug 1725917) for causing linux build bustages on nsLookAndFeel.cpp. CLOSED TREE 2021-08-18 09:52:04 +03:00
Karl Tomlinson
02d611e373 Bug 1725917 use the same logic for chrome ColorScheme in MatchFirefoxThemeIfNeeded() as in ColorSchemeForDocument() r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D122807
2021-08-18 00:58:57 +00:00
Emilio Cobos Álvarez
d6ec436d29 Bug 1724405 - Make ui.caretBlinkCount a proper widget int, and make it respect GTK settings. r=stransky
And make sure the caret ends up being visible, rather than _not_
visible.

This should be implementable on windows as well. It seems macOS doesn't
have a timeout thing.

Differential Revision: https://phabricator.services.mozilla.com/D122132
2021-08-10 14:39:27 +00:00
Emilio Cobos Álvarez
7056f31f28 Bug 1722480 - Ensure nsLookAndFeel::EnsureInit doesn't trigger any reentrant invalidation. r=stransky
RestoreSystemTheme() can trigger gtk theme name changes which can
trigger invalidations again. The other theme changes
(WithAltThemeConfigured and MatchFirefoxThemeIfNeeded) already did this
correctly.

Differential Revision: https://phabricator.services.mozilla.com/D120958
2021-07-28 10:29:19 +00:00
Emilio Cobos Álvarez
1b5b0df813 Bug 1721347 - Add OS theme info to about:support. r=Gijs,fluent-reviewers
I'm not sure what information would be useful in other OSes, so ifdef
the row for GTK for now, but I made this trivial to show in Windows /
macOS / Android as soon as they return useful information.

Differential Revision: https://phabricator.services.mozilla.com/D120331
2021-07-20 20:09:09 +00:00
Emilio Cobos Álvarez
58320c9d07 Bug 1720874 - Try to find menupopup background with :backdrop pseudo-class. r=stransky
This theme only styles menus with menu:backdrop (which always seems to
match for context menus).

Try that before giving up. Also, fall back to the window background if
that would ever fail (which seems better than just rendering
transparent).

Differential Revision: https://phabricator.services.mozilla.com/D120199
2021-07-19 20:28:33 +00:00
Emilio Cobos Álvarez
0975c36ff0 Bug 1716462 - Set right theme name when switching to Adwaita Dark. r=stransky
This doesn't change behavior on GNOME because we already set
"gtk-application-prefer-dark-theme" to dark, and the fallback theme is
Adwaita, but on KDE we get the wrong close icons if we don't do this.

Differential Revision: https://phabricator.services.mozilla.com/D117724
2021-06-23 07:53:43 +00:00
Emilio Cobos Álvarez
2daadf1e38 Bug 1717077 - Prefer blending with theme_bg_color rather than white to compute accent color. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D118310
2021-06-23 07:52:57 +00:00
Emilio Cobos Álvarez
3898bc51ed Bug 1717077 - Make RestoreSystemTheme call a bit more fine-grained. r=stransky
While testing the above patch on a variety of gtk themes, I noticed that
selection colors were inconsistent (as in, from the old theme) when
switching gtk themes, and tracked that down to this call.

Since we only need to restore the theme when actually overridden, track
that instead.

Differential Revision: https://phabricator.services.mozilla.com/D118311
2021-06-23 07:52:25 +00:00
Emilio Cobos Álvarez
dc1c8ebb1a Bug 1716462 - Add a bit more logging. r=stransky
And reuse an already-computed name rather than calling GetGtkTheme
again.

Differential Revision: https://phabricator.services.mozilla.com/D117723
2021-06-16 17:02:09 +00:00
Dorel Luca
3fcbaa8267 Backed out 2 changesets (bug 1716462) for Build bustages. CLOSED TREE
Backed out changeset da9c8170a934 (bug 1716462)
Backed out changeset 42abdfd99cb4 (bug 1716462)
2021-06-16 18:50:02 +03:00
Emilio Cobos Álvarez
ba93c5a57b Bug 1716462 - Add a bit more logging. r=stransky
And reuse an already-computed name rather than calling GetGtkTheme
again.

Depends on D117722

Differential Revision: https://phabricator.services.mozilla.com/D117723
2021-06-16 14:35:29 +00:00
Emilio Cobos Álvarez
cc64128ba8 Bug 1713920 - Add some logging for native GTK colors. r=stransky
Let's see if that allows us to figure out what's going on here.

Differential Revision: https://phabricator.services.mozilla.com/D117893
2021-06-16 14:13:43 +00:00
Emilio Cobos Álvarez
ac8a4acd23 Bug 1707872 - Make LookAndFeel log its own module. r=stransky
Also no behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D117227
2021-06-10 12:39:00 +00:00
Emilio Cobos Álvarez
83e5f56596 Bug 1707872 - Make GTK theme follow the firefox theme globally. r=stransky
This matches what macOS is doing in bug 1715145, and improves the
situation in the cases the user chooses a light Firefox theme, but a
dark GTK theme, or vice versa.

The nice thing of doing it globally is that we don't need to teach the
GTK code to paint with different color schemes in different windows,
which would be massively annoying.

This is expected to have an slight performance cost on startup for
light-theme users (as we need to read the dark gtk theme colors), but
it's hopefully ok.

Depends on D117227

Differential Revision: https://phabricator.services.mozilla.com/D117228
2021-06-10 11:43:00 +00:00
Emilio Cobos Álvarez
13bc8ff1c6 Bug 1707872 - Factor out some code in Gtk's LookAndFeel. r=stransky
No behavior change intended.

Differential Revision: https://phabricator.services.mozilla.com/D117226
2021-06-10 11:08:06 +00:00
Emilio Cobos Álvarez
e05536a57f Bug 1714103 - Fallback to unthemed scrollbars if the thumb wouldn't be visible. r=stransky
The right fix for this theme in particular would be for WidgetUsesImage
to check "border-image". However, that doesn't work (instead I get a GTK
warning saying that border-image is not gettable).

So instead, make sure that we fallback to unthemed colors if the thumb
would be invisible in any of its states. This is more resilient anyways.

Depends on D116936

Differential Revision: https://phabricator.services.mozilla.com/D116937
2021-06-08 08:45:44 +00:00
Emilio Cobos Álvarez
e1bff55fac Bug 1714103 - Simplify a condition in RecordLookAndFeelSpecificTelemetry. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D116936
2021-06-08 08:45:44 +00:00
Emilio Cobos Álvarez
fe8a82a1fc Bug 1713629 - Tweak light theme detection code to find the right theme on more cases. r=stransky
This was an oversight of mine when originally writing this code. We need
to substitute longer prefixes first, otherwise themes like "Foo-Darker"
would end up with a "Foo-er" theme rather than "Foo", and we'd just fall
back to Adwaita (which is not a huge deal, but not the intent of this
code).

Differential Revision: https://phabricator.services.mozilla.com/D116392
2021-06-01 18:04:51 +00:00
Masayuki Nakano
b5b84dc235 Bug 1712675 - part 2: Make any cpp file under widget/gtk stop redefining LOG macro r=rmader,stransky
`LOG` is defined by `nsWindow.h` for a shortcut of `MOZ_LOG` for generic use
under `widget/gtk`.  However, some cpp files do `#undef LOG` and redefine it.
This causes the CPP file order important in unified cpp files since a CPP
file's `LOG` may be redefined unexpectedly with changing the unified order
and/or group.  Therefore, each cpp file should define its own macro name
instead of redefining `LOG`.

Differential Revision: https://phabricator.services.mozilla.com/D115978
2021-05-26 22:53:30 +00:00
Emilio Cobos Álvarez
3787f00582 Bug 1710967 - Move global gtk settings change observation to nsLookAndFeel. r=stransky
They more logically belong there, and this should result in less signal
handlers etc as a side effect (not that it matters much anyways).

Differential Revision: https://phabricator.services.mozilla.com/D115037
2021-05-14 16:18:51 +00:00
Emilio Cobos Álvarez
06bde8229a Bug 1710643 - Use titlebar colors when using CSD rather than -moz-menubartext. r=stransky
As the titlebar may be different when active / inactive, and have
other colors than a menubar.

Differential Revision: https://phabricator.services.mozilla.com/D114875
2021-05-12 22:52:28 +00:00
Emilio Cobos Álvarez
15aa19b29f Bug 1710643 - Remove support for unused gtk infobar widget and colors. r=stransky
Presumably they were for notifications and now we use native notifications?

Differential Revision: https://phabricator.services.mozilla.com/D114874
2021-05-12 19:13:21 +00:00
Emilio Cobos Álvarez
c91ad29659 Bug 1709647 - Prefer to compute GTK accent color out of selected_* named colors. r=stransky
And since, when present, these are the colors for a selected cell, use
them for HTML cell highlight colors (the <select multiple> ones).

Depends on D114392

Differential Revision: https://phabricator.services.mozilla.com/D114393
2021-05-09 17:11:53 +00:00
Emilio Cobos Álvarez
b7081517ae Bug 1709647 - For semi-transparent select background colors, don't change the selection foreground color. r=stransky
As it won't get enough contrast anyways. This is what Gecko does on macOS where
selection colors are also semi-transparent.

Depends on D114391

Differential Revision: https://phabricator.services.mozilla.com/D114392
2021-05-09 17:11:53 +00:00
Emilio Cobos Álvarez
709fb5190d Bug 1709647 - Trivial cleanup to GTK nsLookAndFeel. r=stransky
I wrote these functions, but they only have one caller now so they can
go be back to the switch statement.

Depends on D114389

Differential Revision: https://phabricator.services.mozilla.com/D114390
2021-05-09 17:11:52 +00:00
Emilio Cobos Álvarez
9e4258e142 Bug 1709719 - Try harder to get background colors on GTK. r=stransky
With the theme in comment 3 context menus in e.g. the DevTools style
inspector were already broken before the regressing patch.

This implements a hacky way to get the central pixel of a pattern image,
or a relevant color from a gradient, and use it as a background-color
instead of transparent.

Differential Revision: https://phabricator.services.mozilla.com/D114428
2021-05-08 12:25:01 +00:00
Iulian Moraru
70a27f3859 Backed out changeset eecb6331a2c1 (bug 1661516) for causing popup regressions. CLOSED TREE 2021-05-08 00:16:26 +03:00
Jan Horak
c7ff42b993 Bug 1661516 Use right gravity for the context menu to flip it correctly; r=stransky
To flip context menu correctly near the monitor edge we need to use
correct gravity and anchor of 2x2 size for the gdk_window_move_to_rect.

Differential Revision: https://phabricator.services.mozilla.com/D113981
2021-05-06 10:44:55 +00:00
Emilio Cobos Álvarez
b9d4014408 Bug 1709295 - Keep dark system color extraction behind a pref for now. r=stransky
We'll have to pay this startup time penalty eventually for light theme
users as well but, until we do, we can avoid this regression.

Differential Revision: https://phabricator.services.mozilla.com/D114215
2021-05-04 13:44:08 +00:00
Emilio Cobos Álvarez
a716323708 Bug 1707957 - Extract both light and dark system colors in GTK. r=stransky
And add code to use the appropriate variant like we do in macOS with
respect-system-appearance (but this still needs more work as noted in
StaticPrefList.yaml).

Still, it cleans up a bunch, and allows to not depend on the content
process boundary to provide light system colors.

Depends on D113542

Differential Revision: https://phabricator.services.mozilla.com/D113543
2021-04-30 12:36:50 +00:00
Emilio Cobos Álvarez
e7b6b5547c Bug 1708163 - Extract per-theme data in nsLookAndFeel into its own struct. r=stransky
We're going to change the setup a bit to support both light and dark
system colors in the chrome process, like mac does. This is just
refactoring though.

Remove some unneeded IsContentProcess() check since it can't happen now
that we always enable RemoteLookAndFeel.

Differential Revision: https://phabricator.services.mozilla.com/D113542
2021-04-28 12:22:33 +00:00