Commit Graph
161 Commits
Author SHA1 Message Date
Jan-Niklas Jaeschke c25a8c4b54 Bug 1867940 - Text Fragments: Implement sensible default colors. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D212378
2024-06-05 10:46:53 +00:00
Emilio Cobos Álvarez a1f5f732e4 Bug 1893949 - Make the fix work on android properly too.
MANUAL PUSH: Orange fix CLOSED TREE
2024-05-01 03:01:32 +02:00
Emilio Cobos Álvarez 3a5519d46c Bug 1887552 - Simplify caret visibility code. r=sefeng,geckoview-reviewers
Make the "is hidden due to non-collapsed selection" use the regular
caret-hiding mechanism, so that we make sure nsCaret and paint are
consistent on their caret visibility.

As part of this simplification:

 * Remove LookAndFeel::IntID::ShowCaretDuringSelection, it's 0 on all
   platforms.

 * Remove nsCaret::IsMenuPopupHidingCaret. Is really broken as per the
   comments (it assumes single-process mode, doesn't deal with shadow
   dom, and it's not like it's particularly useful anyways since the
   menu popup could be semi-transparent or what not).

Differential Revision: https://phabricator.services.mozilla.com/D205557
2024-03-26 10:53:17 +00:00
Emilio Cobos Álvarez cbb5a52d47 Bug 1881488 - Use a static pref for tooltip delay. r=masayuki,dom-core
It's 500 everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D202419
2024-02-22 12:59:41 +00:00
Gregory Pappas c280096576 Bug 1860161 - Fade out overlay scrollbars on Android r=emilio,geckoview-reviewers,m_kato
Noticed while working on bug 1859864 that ScrollbarFadeDuration on
Android is 0. It seemed a bit odd because every other platform with
overlay scrollbars has a non-zero fade duration, but I figured that it
was intentional and for power saving/performance/etc.

Looking closer, it seems this is actually a regression from switching
away from the old java scrollbars to gecko scrollbars (bug 1223928).
The old java scrollbars did fade out (bug 704784).

The fade animation makes scrollbars look nicer imo so it would be cool
if we could bring this back.

Chromium uses a duration of 300ms so we should probably match that,
since people are used to it.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc;l=68-84;drc=6d4dcee2c0a7d7750037ffb70de6b82385d7ad0e

Differential Revision: https://phabricator.services.mozilla.com/D191503
2023-10-24 04:18:50 +00:00
Iulian Moraru 24531c40a0 Backed out changeset d59c5fae45bd (bug 1860161) for causing wpt failures on keyboard.html. CLOSED TREE 2023-10-23 17:57:03 +03:00
Gregory Pappas 18efcff464 Bug 1860161 - Fade out overlay scrollbars on Android r=emilio,geckoview-reviewers,m_kato
Noticed while working on bug 1859864 that ScrollbarFadeDuration on
Android is 0. It seemed a bit odd because every other platform with
overlay scrollbars has a non-zero fade duration, but I figured that it
was intentional and for power saving/performance/etc.

Looking closer, it seems this is actually a regression from switching
away from the old java scrollbars to gecko scrollbars (bug 1223928).
The old java scrollbars did fade out (bug 704784).

The fade animation makes scrollbars look nicer imo so it would be cool
if we could bring this back.

Chromium uses a duration of 300ms so we should probably match that,
since people are used to it.
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/widget/compositing/layer_tree_settings.cc;l=68-84;drc=6d4dcee2c0a7d7750037ffb70de6b82385d7ad0e

Differential Revision: https://phabricator.services.mozilla.com/D191503
2023-10-23 12:23:12 +00:00
Gregory Pappas ce94d29c1b Bug 1859864 - Define overlay scrollbar behavior on Android in LookAndFeel instead of with prefs r=geckoview-reviewers,emilio,owlish
Like Mac/Windows do

Differential Revision: https://phabricator.services.mozilla.com/D191344
2023-10-18 22:25:18 +00:00
Luke Warlow 5515bc733e Bug 1849040 - Android prefers-contrast support r=geckoview-reviewers,m_kato
This patch adds support for the Android high contrast text setting. This triggers the prefers-contrast media query as well as prefers-reduced-transparency.

Differential Revision: https://phabricator.services.mozilla.com/D186389
2023-09-11 07:24:31 +00:00
Emilio Cobos Álvarez e59a831ff4 Bug 1845540 - Remove some unused win-specific system colors and appearance values. r=mstange,devtools-reviewers,mhowell
Differential Revision: https://phabricator.services.mozilla.com/D184597
2023-07-26 20:57:47 +00:00
Emilio Cobos Álvarez 08e09f6299 Bug 1838460 - Remove unused -moz-buttondefault color. r=stransky
Differential Revision: https://phabricator.services.mozilla.com/D183776
2023-07-18 17:21:40 +00:00
Emilio Cobos Álvarez c4ecae68aa Bug 1838460 - Remove unused moz-menubartext color. r=geckoview-reviewers,devtools-reviewers,nchevobbe,amejiamarmol
-moz-menubarhovertext has one usage that can go away once we remove
windows 7 / 8 so not touching that yet.

Depends on D182896

Differential Revision: https://phabricator.services.mozilla.com/D182897
2023-07-07 15:23:10 +00:00
Emilio Cobos Álvarez a7fdb81411 Bug 1831136 - Plumb android text scale via nsLookAndFeel. r=geckoview-reviewers,dholbert,owlish
That's how we do it for all other platforms. Do this rather than via a
custom mostly-untested pref, which allows us to simplify text zoom
handling.

Differential Revision: https://phabricator.services.mozilla.com/D177062
2023-05-11 19:01:19 +00:00
CanadaHonk 859310b9a4 Bug 1794628 - Implement inverted-colors media feature r=geckoview-reviewers,morgan,emilio,m_kato,cmartin
Implemented the inverted-colors media feature from Media Queries Level 5
for all platforms.
Spec: https://drafts.csswg.org/mediaqueries-5/#inverted

Platform specific implementations:
- Windows: Checks system color filter setting, and if it is inverted
  (note: Windows does not live update due to having to read a reg key)
- Mac: Checks dedicated inverted accessibility system setting
- Android: Checks dedicated inverted system setting
- Linux: No GTK API exposes anything like it so always none

Locked behind new pref `layout.css.inverted-colors.enabled`,
always off by default for now.

Also added new WPT tests (none previously).

Other browsers:
- WebKit: shipped since Safari 9.1 (Jan 2017)
- Blink: no signal

Test page: https://goose.icu/inverted-colors

Differential Revision: https://phabricator.services.mozilla.com/D173201
2023-04-11 13:34:00 +00:00
CanadaHonk 78363430df Bug 1736914 - Implement prefers-reduced-transparency media query r=geckoview-reviewers,emilio,jonalmeida,ohall
Implemented the prefers-reduced-transparency media query for all
platforms.

Windows and Mac have specific settings which are used, others (Android
and Linux/GTK) have it enabled if prefers-reduced-motion is also enabled
as there is no dedicated setting to check.

Locked behind new pref `layout.css.prefers-reduced-transparency.enabled`,
off by default always for now.

Also added new WPT tests (none previously).

Demo video: https://goose.icu/firefox_prt.mp4
Test page: https://goose.icu/prefers-reduced-transparency

Differential Revision: https://phabricator.services.mozilla.com/D172424
2023-03-13 21:30:17 +00:00
Emilio Cobos Álvarez 285cf6bb05 Bug 1802799 - Fix android build.
MANUAL PUSH: Trivial bustage fix CLOSED TREE
2022-12-20 00:19:16 +01:00
Ben Freist e990b1f018 Bug 1802799 - [refactor] Migrate NS_STYLE_TEXT_DECORATION_STYLE_* defines r=emilio,geckoview-reviewers,ohall
Differential Revision: https://phabricator.services.mozilla.com/D163177
2022-12-19 22:47:24 +00:00
Emilio Cobos Álvarez 514bcd7b6a Bug 1755564 - Make SpellCheckerUnderline go through the stand-in color code-path. r=geckoview-reviewers,calu
This doesn't change behavior since it's red for all platforms including
the standins.

Depends on D157748

Differential Revision: https://phabricator.services.mozilla.com/D163402
2022-12-07 18:44:57 +00:00
Emilio Cobos Álvarez cf59d0afa3 Bug 1638052 - Implement Buttonborder/mark/marktext. r=geckoview-reviewers,calu,dholbert
Needs some extra test expectation updates.

Differential Revision: https://phabricator.services.mozilla.com/D157748
2022-12-03 11:19:56 +00:00
Sandor Molnar fac7a32c11 Backed out changeset 5f89b0e8bdb5 (bug 1638052) for causing wpt failures in css/css-color/deprecated-sameas-018.html 2022-12-03 00:51:39 +02:00
Emilio Cobos Álvarez cdeea6a3b9 Bug 1638052 - Implement Buttonborder/mark/marktext. r=geckoview-reviewers,calu,dholbert
Needs some extra test expectation updates.

Differential Revision: https://phabricator.services.mozilla.com/D157748
2022-12-02 19:12:22 +00:00
Emilio Cobos Álvarez e75f1ad698 Bug 1776556 - Restore Windows' accent-color / system-color behavior for now. r=mstange
This basically pref-gates some of the accent-color changes that landed before
the soft-freeze to match current release behavior, at least for now.

In the future we might want to reconsider turning these on, but at the very
least we should figure out a good story for the grey-ish accent colors, see the
comments in the pref definitions.

The only tricky bit is the use-theme-accent pref handling. I made it specific
to the non-native-theme again so that AccentColor and NNT kept behaving
consistently, but AccentColor in the browser chrome used the real accent color.

Differential Revision: https://phabricator.services.mozilla.com/D150339
2022-06-28 18:55:27 +00:00
Emilio Cobos Álvarez b8a3bad0da Bug 1775247 - Make AccentColor/Text consistent with accent-color: auto. r=mstange
It'd be weird otherwise, as in platforms where use-theme-accent is false
(Windows), form controls would be blue (the default accent color) but
the AccentColor color would be the system accent color still.

Differential Revision: https://phabricator.services.mozilla.com/D149877
2022-06-22 09:45:07 +00:00
Emilio Cobos Álvarez c82697d39b Bug 1775247 - Implement AccentColor/AccentColorText and remove -moz-prefixed version of the color. r=mstange
As per https://github.com/w3c/csswg-drafts/issues/7347.

Mostly renaming, doesn't change behavior other than exposing the new
color keywords (tested in wpt).

Differential Revision: https://phabricator.services.mozilla.com/D149876
2022-06-22 09:45:06 +00:00
Emilio Cobos Álvarez 42a711655b Bug 1773558 - Move fixed-point font types to Rust. r=layout-reviewers,jfkthame
Now that cbindgen and rust support const generics, it seems more simple.

This centralizes all the relevant font constants etc in rust and avoids
conversions when going from rust to C++ and vice versa.

Differential Revision: https://phabricator.services.mozilla.com/D148847
2022-06-13 00:59:23 +00:00
Noemi Erli fbf29a9961 Backed out changeset 7585591a9bad (bug 1773558) for causing failures in system-fonts.html 2022-06-12 19:02:33 +03:00
Emilio Cobos Álvarez 152643ec11 Bug 1773558 - Move fixed-point font types to Rust. r=layout-reviewers,jfkthame
Now that cbindgen and rust support const generics, it seems more simple.

This centralizes all the relevant font constants etc in rust and avoids
conversions when going from rust to C++ and vice versa.

Differential Revision: https://phabricator.services.mozilla.com/D148847
2022-06-12 10:48:58 +00:00
Emilio Cobos Álvarez 2d088fa3b6 Bug 1771796 - Remove -moz-scrollbar-thumb-proportional. r=dholbert
It unconditionally matches on all platforms, so it's not returning any useful information.

Depends on D147689

Differential Revision: https://phabricator.services.mozilla.com/D147690
2022-06-02 11:58:18 +00:00
Emilio Cobos Álvarez 8de26dc4c1 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 650c68e961 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
Emilio Cobos Alvarez afa337042d 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
Stephen A Pohl d42bf8fe6b Bug 1719427: Refactor scrollbar drawing code across platforms. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129265
2021-11-15 12:39:38 +00:00
criss 317421bcb1 Backed out 4 changesets (bug 1719427) for causing build bustages. CLOSED TREE
Backed out changeset d6948ef7f495 (bug 1719427)
Backed out changeset 4df7017f6bc9 (bug 1719427)
Backed out changeset 8c5bb08f80e9 (bug 1719427)
Backed out changeset e32004dd2014 (bug 1719427)
2021-11-15 13:46:20 +02:00
Stephen A Pohl b1a6c42698 Bug 1719427: Refactor scrollbar drawing code across platforms. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D129265
2021-11-15 11:15:54 +00:00
Emilio Cobos Álvarez c5be0433f1 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 1708cbcf2d 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 a801e09d23 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
Makoto Kato 4da47a4e4a Bug 1556983 - Primary pointer capability should be coarse when having touch screen. r=geckoview-reviewers,agi
Many users report that GeckoView returns non-coarse value for primary pointer
capabilities. Actually, we assume that primary pointer device is 1st device by
`InputDevice.getDeviceIds`, but some mobile devices seems not to return touch
screen as 1st item according to user reports.

Also, Android's `InputDevice` API doesn't define what is primary pointer
device, so we cannot assume primary pointer device well.

Other implements are,

- Chrome returns coarse if something input device has coarse capability.
- Firefox for Windows seems to return coarse if it is tablet mode.

So we should return coarse as primary pointer capability when having touch
screen, like Chrome.

But there is still another issue.

When I check some devices (including Android VM on Chrome OS), even if no touch
screen, the `InputDevice`'s source may has `SOURCE_TOUCHSCREEN`. Chrome checks
that fine pointer at first, then it checks coarse pointer. But current GV is
coarse pointer at first. Since the `InputDevice`'s source may have both
`SOURCE_MOUSE` and `SOURCE_TOUCHSCREEN` on touchpad/mouse, GV returns different
result. So we shouldn't check `SOURCE_TOUCHSCREEN` at first.

Differential Revision: https://phabricator.services.mozilla.com/D129901
2021-11-02 02:04:06 +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 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 Á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 Álvarez 5154f71468 Bug 1731678 - Add some generic dark system colors for Windows/Android/standins. r=dholbert
Eventually we should support all of them, but for now they are only used
by native code (unless you enable the color-scheme pref) and these will
be enough.

Differential Revision: https://phabricator.services.mozilla.com/D126737
2021-09-29 10:20:56 +00:00
Emilio Cobos Álvarez 9d100a125c Bug 1730867 - Use native scrollbars on Android. r=mstange
We only draw a scrollbar thumb, so it's easy enough (fair amount of
boilerplate, though).

For now I've done the trivial thing (keep painting a round thumb without
other fancy things), as that's what we were doing, but in the future we
should consider drawing a stroke around the thumb like cocoa does to add
more contrast.

This patch does change behavior in some cases. For example dark websites
now get a lighter, easier to distinguish scrollbar, thanks to the
scrollbar darkening code in nsNativeBasicTheme.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D125826
2021-09-28 17:04:34 +00:00
Csoregi Natalia b47c207fb5 Backed out 3 changesets (bug 1730867) for multiple reftest failures. CLOSED TREE
Backed out changeset aed4ce969bb6 (bug 1730867)
Backed out changeset 84abb450636b (bug 1730867)
Backed out changeset bbd4d5126a19 (bug 1730867)
2021-09-28 19:47:49 +03:00
Emilio Cobos Álvarez 771ad9d24a Bug 1730867 - Use native scrollbars on Android. r=mstange
We only draw a scrollbar thumb, so it's easy enough (fair amount of
boilerplate, though).

For now I've done the trivial thing (keep painting a round thumb without
other fancy things), as that's what we were doing, but in the future we
should consider drawing a stroke around the thumb like cocoa does to add
more contrast.

This patch does change behavior in some cases. For example dark websites
now get a lighter, easier to distinguish scrollbar, thanks to the
scrollbar darkening code in nsNativeBasicTheme.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D125826
2021-09-28 12:52:42 +00:00
criss d9f8612d21 Backed out 5 changesets (bug 1730867) for causing multiple reftest failures. CLOSED TREE
Backed out changeset 3a0215aefdf5 (bug 1730867)
Backed out changeset 6d0aac048440 (bug 1730867)
Backed out changeset 12f9678771c8 (bug 1730867)
Backed out changeset 315dd0b76f3f (bug 1730867)
Backed out changeset 894f76b91190 (bug 1730867)
2021-09-28 06:41:46 +03:00
Emilio Cobos Álvarez 46f0a3ae81 Bug 1730867 - Use native scrollbars on Android. r=mstange
We only draw a scrollbar thumb, so it's easy enough (fair amount of
boilerplate, though).

For now I've done the trivial thing (keep painting a round thumb without
other fancy things), as that's what we were doing, but in the future we
should consider drawing a stroke around the thumb like cocoa does to add
more contrast.

This patch does change behavior in some cases. For example dark websites
now get a lighter, easier to distinguish scrollbar, thanks to the
scrollbar darkening code in nsNativeBasicTheme.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D125826
2021-09-27 13:56:49 +00:00
Emilio Cobos Álvarez ac1658800b Bug 1693222 - Fix selecteditem color on macOS.
This is an oversight. I made selecteditem be -moz-html-cellhighlight,
but that's for inactive cells.

Use the inactive cell color everywhere (though android doesn't
differentiate). This matches other browsers and what was reviewed on
this bug.

MANUAL PUSH: The semi-transparent text-selection-disabled color caused
one test failure CLOSED TREE.
2021-09-02 17:27:30 +02: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