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

158 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez f2a6ce01df Bug 1690954 - Draw the menulist arrow button using currentColor rather than a fixed color. r=jfkthame
As its background might not be themed.

Differential Revision: https://phabricator.services.mozilla.com/D115194
2021-05-17 12:11:15 +00:00
Emilio Cobos Álvarez 2ecfa192c1 Bug 1710324 - Use non-native scrollbar drawing in nsNativeThemeGTK. r=stransky
Right now we paint scrollbars using gtk in nsNativeThemeGTK, and that
makes them look a bit inconsistent if the non-native implementation ends
up drawing them differently. I think scrollbars should look the same
regardless of where they're drawn.

This simplifies the code, and also brings proper scrollbar-{width,color}
support to the native theme, which is nice because Thunderbird uses it
if you use a theme there.

I opted for removing the code, but let me know if you'd rather keep it
behind the widget.non-native-theme.enabled pref or such.

Differential Revision: https://phabricator.services.mozilla.com/D114699
2021-05-11 13:57:18 +00:00
Emilio Cobos Álvarez e746e3a732 Bug 1709647 - Don't use theme active scrollbar thumb color for dark scrollbars if it's greyish. r=stransky
As in that case it probably doesn't have enough contrast. This is drive-by
since, while I was looking at that GTK theme, the scrollbars are monochrome.

Differential Revision: https://phabricator.services.mozilla.com/D114394
2021-05-11 09:32:20 +00:00
Emilio Cobos Álvarez 34a9a0f457 Bug 1705605 - Implement accent-color in nsNativeBasicTheme. r=mstange
This is a new addition for CSS UI Level 4:

  https://drafts.csswg.org/css-ui-4/#widget-accent

I want to provide feedback on some spec issues, and thought it was a
kinda neat thing to prototype (it also makes testing contrast and such
with random GTK themes easier).

For now enable for Nightly only.

Differential Revision: https://phabricator.services.mozilla.com/D112312
2021-04-27 10:41:00 +00:00
Emilio Cobos Álvarez c0ba36dc12 Bug 1703774 - Fix radii computation in WebRender codepath for auto-style outline. r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D111235
2021-04-08 14:23:25 +00:00
Emilio Cobos Alvarez 9ac846cb5c Bug 1703604 - When using a transparent scrollbar button / track color, use the thumb color to paint the scrollbar arrow. r=spohl
This improves the rendering of youtube.com on Windows, and I think should be uncontroversial.

scrollbar-color: transparent transparent will still get you the fully transparent scrollbar.

Differential Revision: https://phabricator.services.mozilla.com/D111137
2021-04-08 09:48:01 +00:00
Butkovits Atila 933498728f Backed out changeset 47b38a36e71a (bug 1703604) for causing bustages at nsNativeBasicThemeGTK.cpp. CLOSED TREE 2021-04-08 02:55:47 +03:00
Emilio Cobos Alvarez 25c7684295 Bug 1703604 - When using a transparent scrollbar button / track color, use the thumb color to paint the scrollbar arrow. r=spohl
This improves the rendering of youtube.com on Windows, and I think should be uncontroversial.

scrollbar-color: transparent transparent will still get you the fully transparent scrollbar.

Differential Revision: https://phabricator.services.mozilla.com/D111137
2021-04-07 19:41:17 +00:00
Stephen A Pohl b35b953353 Bug 1702755: Correct corner radii of progress bar, range and meter form controls in non-native theme. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D110668
2021-04-02 14:39:17 +00:00
Emilio Cobos Álvarez 390c6943fe Bug 1702676 - Change public LookAndFeel API to accept a color scheme. r=mstange
This shouldn't change behavior, but is the biggest cross-platform part
of the change so I'd like to get it landed sooner rather than later.

The two calls like:

  GetColor(ColorID::TextSelectBackground, color);
  if (color == 0x000000) {
    mColorTextSelectForeground = NS_RGB(0xff, 0xff, 0xff);
  } else {
    mColorTextSelectForeground = NS_DONT_CHANGE_COLOR;
  }

that I'm removing are just broken. They were calling the version of
GetColor the function that took a default value when the color wasn't
available, not the version of the color with the outparam.

To prevent such mistakes, add two signatures, GetColor(), returning a
Maybe<nscolor> and Color(), returning a color with a fallback.

Differential Revision: https://phabricator.services.mozilla.com/D110651
2021-04-02 12:22:14 +00:00
Narcis Beleuzu e9fb777466 Backed out changeset 597b9606c3ca (bug 1702676) for reftest failures on mq_prefers_reduced_motion_reduce.html CLOSED TREE 2021-04-02 09:34:53 +03:00
Emilio Cobos Álvarez f7f84a3c53 Bug 1702676 - Change public LookAndFeel API to accept a color scheme. r=mstange
This shouldn't change behavior, but is the biggest cross-platform part
of the change so I'd like to get it landed sooner rather than later.

The two calls like:

  GetColor(ColorID::TextSelectBackground, color);
  if (color == 0x000000) {
    mColorTextSelectForeground = NS_RGB(0xff, 0xff, 0xff);
  } else {
    mColorTextSelectForeground = NS_DONT_CHANGE_COLOR;
  }

that I'm removing are just broken. They were calling the version of
GetColor the function that took a default value when the color wasn't
available, not the version of the color with the outparam.

To prevent such mistakes, add two signatures, GetColor(), returning a
Maybe<nscolor> and Color(), returning a color with a fallback.

Differential Revision: https://phabricator.services.mozilla.com/D110651
2021-04-02 00:21:37 +00:00
Emilio Cobos Álvarez 92686b6ec6 Bug 1702282 - Minor cleanup to ComputeCheckboxColors. r=mstange
No behavior change.

Depends on D110449

Differential Revision: https://phabricator.services.mozilla.com/D110450
2021-04-01 19:02:19 +00:00
Emilio Cobos Álvarez f7e9b9f2f8 Bug 1702282 - Improve contrast of disabled checkmarks and radio buttons. r=mstange
Use a more opaque checkmark color.

Depends on D110448

Differential Revision: https://phabricator.services.mozilla.com/D110449
2021-04-01 19:02:19 +00:00
Emilio Cobos Álvarez 01639dfc2d Bug 1702282 - Remove useless !isDisabled checks in nsNativeBasicTheme. r=mstange
We always check whether something is disabled first so they're just
noise.

No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D110448
2021-04-01 19:02:18 +00:00
Emilio Cobos Álvarez 0c995f22b1 Bug 1701825 - Minor scrollbar tweaks. r=stransky
This is a follow-up that I thought was worth doing, but let me know if
you disagree or what not. I think this produces the best results:

 * For light pages, we still get light scrollbars for the track, but the
   active thumb still uses the dark theme highlight color.

 * For dark pages, we again still use the themed highlight color for the
   thumb, and we use dark scrollbar colors elsewhere like we do now.

Again, let me know if you think this is not worth it, or is too much, or
what not. I've tested this on a decent range of popular GTK themes and
it looks like a clear progression to me.

Differential Revision: https://phabricator.services.mozilla.com/D110203
2021-03-30 17:31:33 +00:00
Emilio Cobos Álvarez 03f14a4edc Bug 1701846 - Make setting overlay scrollbars on GTK do something sane-ish. r=mstange
So that they work sorta similar to the native ones. This is intended
mostly for testing, but hey, if someone is motivated enough...

I haven't tracked the native gtk overlay scrollbar durations down,
someone motivated enough could do that if they wanted to. But this seems
close enough.

Differential Revision: https://phabricator.services.mozilla.com/D110192
2021-03-30 03:31:21 +00:00
Emilio Cobos Álvarez ab1118bc65 Bug 1700802 - Add a small radius to the auto style outline. r=mstange
(When not following the frame's border radius of course)

This makes stuff like:

  data:text/html,<input style="border-color: lightgrey">

More aesthetically pleasing when focused, and we still keep the square
inside the outline (this is what Safari does).

Differential Revision: https://phabricator.services.mozilla.com/D109680
2021-03-25 11:28:08 +00:00
Emilio Cobos Álvarez 75e5766b67 Bug 1699930 - Don't let GTK text scale affect non-native scrollbar sizes. r=mstange
This matches the native theme. We plumb it via LookAndFeel to avoid
having to load GTK settings in child processes.

Differential Revision: https://phabricator.services.mozilla.com/D109275
2021-03-22 16:11:33 +00:00
Emilio Cobos Álvarez c0053473fd Bug 1699931 - Fix checked checkbox radius in the non-native theme. r=mstange
This is caused by a minor issue with WebRender disabled where the radii
was slightly off because it wasn't accounting for the deflation of the
rect.

Differential Revision: https://phabricator.services.mozilla.com/D109206
2021-03-22 08:12:22 +00:00
Emilio Cobos Álvarez 5cbba9b317 Bug 1699937 - Don't draw focus outlines for box-shadow in the non-native theme. r=mstange
This is a relatively easy way to improve the rendering with the
non-native theme while not regressing anything.

In the future, once non-native-theme is shipped and default everywhere,
I think we could provide something like:

  bool nsITheme::GetShadowRect(nsIFrame*, StyleAppearance, LayoutDeviceRect&, RectCornerRadii&)

or such, where we can provide a precise rect + radii, and we would avoid
painting the shadow if the function returned false. That would allow us
to remove the native theme box shadow code path, and avoid WR fallback,
all at once.

Differential Revision: https://phabricator.services.mozilla.com/D109209
2021-03-20 23:08:11 +00:00
Cosmin Sabou 53e07f6afd Backed out changeset c793fb0c34e0 (bug 1699931) for Android reftest failures on element-paint-native-widget.html. 2021-03-20 19:56:27 +02:00
Emilio Cobos Álvarez 897ce5540c Bug 1699931 - Fix checked checkbox radius in the non-native theme. r=mstange
This also uncovered a minor issue with WebRender disabled where the
radii was slightly off because it wasn't accounting for the border.

Differential Revision: https://phabricator.services.mozilla.com/D109206
2021-03-20 17:04:41 +00:00
Emilio Cobos Alvarez 31b583bbcc Bug 1698783 - Respect Windows' system scrollbar sizes. r=mstange
Depends on D108960

Differential Revision: https://phabricator.services.mozilla.com/D108973
2021-03-18 19:12:49 +00:00
Emilio Cobos Álvarez 2ef90f0690 Bug 1698783 - Make non-native scrollbar size configurable in Windows too. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D108960
2021-03-18 19:12:49 +00:00
Emilio Cobos Alvarez ab368a8926 Bug 1698284 - Make the non-native theme not use system colors if we're not overriding the pages' colors. r=morgan
This prevents contrast issues with high contrast themes when the page only
specifies some of the colors (which is an issue which we have historically
had on GTK with dark themes for a long time).

Feel free to push back on this if you prefer this, as on GTK we force a light
theme on content anyways, but this is a problem on windows for users that use a
high contrast theme but allow pages to override colors.

Differential Revision: https://phabricator.services.mozilla.com/D108324
2021-03-16 16:46:05 +00:00
Emilio Cobos Álvarez f717a6f4db Bug 1698336 - Fix high contrast rendering of <meter>. r=mstange
Using the same color for the track and the meter chunk is not going to
fly of course...

In high contrast, make the colors consistent with <progress>, which
seems like a reasonable thing to do.

Differential Revision: https://phabricator.services.mozilla.com/D108347
2021-03-15 21:06:54 +00:00
Emilio Cobos Álvarez 871d3edbf8 Bug 1698302 - bonus: support indeterminate progress meter. r=mstange
I wonder if we could do something more fancy with the animation than
QueueAnimatedContentForRefresh, which is timer based, like a
transform-like animation that WebRender could run or something, but this
is probably good enough for now.

Depends on D108335

Differential Revision: https://phabricator.services.mozilla.com/D108336
2021-03-15 21:01:08 +00:00
Emilio Cobos Álvarez 2950a6ee21 Bug 1698302 - Paint progress/meter chunks along with the track. r=mstange
The progress chunk already has the right size, but it's easier to get
the right clipping if we just paint it as part of the progress bar.

This is much like we paint the range track and thumb. We apply the
native appearance atomically so this should be fine.

Differential Revision: https://phabricator.services.mozilla.com/D108335
2021-03-15 21:01:08 +00:00
Emilio Cobos Alvarez b51dbb1fd3 Bug 1698284 - Minor high-contrast theme tweaks in the non-native theme. r=mstange
Mostly use matching foreground / background colors. Buttonface is the
counterpart of Buttontext, and Highlightext the counterpart of Highlight.

This fixes contrast of checkboxes and radio buttons for example, and a couple
other contrast issues with light themes specially.

Differential Revision: https://phabricator.services.mozilla.com/D108319
2021-03-15 21:00:36 +00:00
Emilio Cobos Álvarez de1f51fa10 Bug 1697467 - Push the high contrast code from nsNativeBasicThemeWin to nsNativeBasicTheme. r=mstange
Linux can also have high contrast (and mac, if you tweak prefs, but
let's assume that doesn't happen), so no reason we shouldn't share this
code.

One related simplification while I was doing this code move is that I
managed to remove the scrollbar "border" code. Turns out that Windows
was overriding ComputeScrollbarColors so that border and track colors
were always the same, and Linux was ignoring the border anyways, so with
this we can simplfiy the implementation a bit (as the Linux scrollbar
track / corner code can be shared with Windows now).

Differential Revision: https://phabricator.services.mozilla.com/D107863
2021-03-12 14:44:13 +00:00
Emilio Cobos Álvarez bcb55cbfee Bug 1697210 - Make disabled checkbox / radio buttons do the right thing when painted with non-webrender. r=mstange
data:text/html,<input type=checkbox checked disabled>

Has a weird double border because the DrawTarget codepath fills and
strokes the same path, which is fine if the border is opaque, but not
otherwise.

Since this is the only use for a non-opaque border that we have, I
think, dealing with it on the caller seems a bit simpler. But let me
know if you want me to fix it more generally in
PaintRoundedRectWithRadius. I think for the semi-transparent border
case we'd need to create two paths, one for the background and one for
the border, which is a bit unfortunate.

The webrender codepath does the right thing, but of course that doesn't
get used for checkboxes.

Differential Revision: https://phabricator.services.mozilla.com/D107815
2021-03-12 12:28:44 +00:00
Emilio Cobos Álvarez 692aa3d131 Bug 1697210 - Make the checkbox / radio rect paint to an exact number of device pixels. r=mstange
This used to be the case (for default-sized radio buttons anyways)
before bug 1693688 (since GetMinimumWidgetSize returns a
LayoutDeviceIntSize, which rounded).

With the previous patch we never see uneven borders, but the radio might
be e.g. one pixel taller than its width, which also looks odd. So
truncate to device pixels to avoid it.

Differential Revision: https://phabricator.services.mozilla.com/D107810
2021-03-12 11:25:49 +00:00
Emilio Cobos Álvarez 4f99f41d10 Bug 1697210 - Paint radio checkmark as part of nsNativeBasicTheme::PaintRadioControl, and snap the checkmark inset. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D107809
2021-03-12 11:25:49 +00:00
Emilio Cobos Álvarez 6283dfa76c Bug 1696833 - Vertical range input paints value in the wrong direction. r=mstange
When the value increases we make the bar smaller, that's unfortunate!

Differential Revision: https://phabricator.services.mozilla.com/D107398
2021-03-07 21:44:37 +00:00
Emilio Cobos Álvarez 089ba70779 Bug 1696709 - Fix rect used to paint outline-style: auto when there's no border-radius. r=mstange
Embarrassing regression from bug 1694059.

Differential Revision: https://phabricator.services.mozilla.com/D107358
2021-03-06 01:53:38 +00:00
Emilio Cobos Álvarez a9ec257d55 Bug 1696378 - Fix snapping issues with outlines. r=mstange
This isn't really an uneven border (because we snap border widths
correctly); this is the textfield border snapping differently than the
outline, actually, in a way such that the outline shows underneath. We
use negative offsets to try to cover the border but that breaks in this
case.

I thought of two ways to fix it, but this one looks slightly more
future-proof (and simpler), see the comment in ComputeBorderColor. Let
me know if you want me to go the other way (snapping offsets instead) or
both, actually.

The transparent border uncovered that the radius was slightly off, and
also that I forgot to snap the auto-style outline width properly, so I
fixed those drive-by too (without the first one stuff looks off
otherwise, at least, the second one I could move).

Differential Revision: https://phabricator.services.mozilla.com/D107287
2021-03-05 01:35:17 +00:00
Brindusan Cristian 8687336f7f Backed out changeset 42731d5daba6 (bug 1696378) for reftest failures in textarea-focus.html. CLOSED TREE 2021-03-05 03:15:14 +02:00
Emilio Cobos Álvarez dfd193480f Bug 1696378 - Fix snapping issues with outlines. r=mstange
This isn't really an uneven border (because we snap border widths
correctly); this is the textfield border snapping differently than the
outline, actually, in a way such that the outline shows underneath. We
use negative offsets to try to cover the border but that breaks in this
case.

I thought of two ways to fix it, but this one looks slightly more
future-proof (and simpler), see the comment in ComputeBorderColor. Let
me know if you want me to go the other way (snapping offsets instead) or
both, actually.

The transparent border uncovered that the radius was slightly off, and
also that I forgot to snap the auto-style outline width properly, so I
fixed those drive-by too (without the first one stuff looks off
otherwise, at least, the second one I could move).

Differential Revision: https://phabricator.services.mozilla.com/D107287
2021-03-04 23:19:58 +00:00
Sylvestre Ledru 4edd85cc9b Bug 1519636 - Reformat recent changes to the Google coding style r=necko-reviewers,valentin
Updated with clang-format version 11.0.1 (taskcluster-B6bdwSKDRF-luRQWXBuzpA)

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D106920
2021-03-02 16:14:46 +00:00
Emilio Cobos Alvarez 56a0cfe07e Bug 1695798 - Crisper combobox and spinner button arrows for the non-native theme. r=mstange
This also makes them look not gross when zoomed in, which is a nice plus.

Differential Revision: https://phabricator.services.mozilla.com/D106855
2021-03-02 00:48:36 +00:00
Emilio Cobos Alvarez babc9888a5 Bug 1695741 - Choose more round points for windows scroll button arrows. r=mstange
This should help with fuzziness in some tests, and also look nicer.

Differential Revision: https://phabricator.services.mozilla.com/D106823
2021-03-01 22:55:37 +00:00
Emilio Cobos Alvarez 37d38b9608 Bug 1695679 - Simplify non-native theme scrollbar sizing on Windows to match the native theme. r=mstange
The native theme doesn't enforce the size of the whole scrollbar. This is
important because if the scrollbar overflows the scroller we might suppress it.

This causes a variety of test failures with the non-native theme enabled. One
of the most glaring ones is:

  http://wpt.live/css/css-flexbox/overflow-auto-006.html

We don't show scrollbars for the inline elements because their width is 50px
and the min scrollbar ends up being 51px (17 * 3) which is pretty unfortunate.

Instead, allow the thumb / scrollbar / track to shrink like the native theme.

Differential Revision: https://phabricator.services.mozilla.com/D106781
2021-03-01 22:55:32 +00:00
Emilio Cobos Álvarez 03fd22c802 Bug 1694059 - Use WebRender to render non-native range inputs and radio buttons. r=mstange
The only thing missing now are things that draw arrows / checkmarks.

Make the disabled range thumb opaque, to avoid dealing with clipping
(also matches all other browsers, fwiw).

Differential Revision: https://phabricator.services.mozilla.com/D106011
2021-02-23 23:22:19 +00:00
Cosmin Sabou 51f713408b Backed out changeset 3bf5d4016ea7 (bug 1694059) for input range reftest failures. CLOSED TREE 2021-02-23 14:25:35 +02:00
Emilio Cobos Álvarez 3ae296b53c Bug 1694059 - Use WebRender to render non-native range inputs and checkboxes. r=mstange
The only thing missing now are things that draw arrows / checkmarks.

Make the disabled range thumb opaque, to avoid dealing with clipping
(also matches all other browsers, fwiw).

Differential Revision: https://phabricator.services.mozilla.com/D106011
2021-02-23 10:51:37 +00:00
Emilio Cobos Álvarez 7f2b3314e0 Bug 1694059 - Use WebRender to render most non-native-theme widgets when possible. r=mstange
We basically use a couple primitives to draw these
(PaintRoundedRectWithRadius, FillRect), so making the code a bit generic
implementing stuff with WebRender seems straight-forward.

I've kept using the fallback codepath for the bits that draw complex
paths like arrows and such, but the rest of the things should work with
this patch.

A thing I'm not too happy about is the scrollbar painting setup (requires a lot
of boilerplate), but modulo template hacks make nsNativeBasicTheme a template
that receives its super class as a parameter or something) it seems hard to do
better.

Differential Revision: https://phabricator.services.mozilla.com/D105931
2021-02-23 10:49:37 +00:00
smolnar 7f2e38a6b3 Backed out changeset 960cb2cf2009 (bug 1694059) for causing reftest failures. 2021-02-23 06:41:58 +02:00
Emilio Cobos Álvarez c0fec9f98e Bug 1694059 - Use WebRender to render most non-native-theme widgets when possible. r=mstange
We basically use a couple primitives to draw these
(PaintRoundedRectWithRadius, FillRect), so making the code a bit generic
implementing stuff with WebRender seems straight-forward.

I've kept using the fallback codepath for the bits that draw complex
paths like arrows and such, but the rest of the things should work with
this patch.

A thing I'm not too happy about is the scrollbar painting setup (requires a lot
of boilerplate), but modulo template hacks make nsNativeBasicTheme a template
that receives its super class as a parameter or something) it seems hard to do
better.

Differential Revision: https://phabricator.services.mozilla.com/D105931
2021-02-23 02:58:47 +00:00
smolnar 79ca2f76fa Backed out changeset 4436a8bb02fd (bug 1694059) for causing reftest failures. CLOSED TREE 2021-02-23 04:17:14 +02:00