Commit graph

137 commits

Author SHA1 Message Date
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
Emilio Cobos Álvarez
cb286403d0 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 01:10:22 +00:00
Emilio Cobos Álvarez
15ff419df0 Bug 1694059 - Rename various nnt prefs. r=spohl,mstange
As per feedback in D105931.

Differential Revision: https://phabricator.services.mozilla.com/D105991
2021-02-22 20:05:35 +00:00
Emilio Cobos Álvarez
965efb55a0 Bug 1694059 - Pass draw target by reference in non-native widget code. r=mstange
And remove some useless argument names. This is just preparation for the next
patch and shouldn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D105930
2021-02-22 16:18:33 +00:00
Emilio Cobos Álvarez
6825bbc8f8 Bug 1693688 - Make the non-native theme not return minimum sizes for checkboxes (and most other widgets). r=spohl,mstange
This matches closer what Chrome and Safari do (Safari paints outside of
the box when this happens, but the layout box still respects the
author), see:

  data:text/html,<button style="padding: 0; width: 0">
  data:text/html,<input type=checkbox style="width: 0">

Etc. For checkboxes, this matches what OSX does, too.

Since we still want checkboxes to be slightly larger than what they'd be
otherwise, we add a hook to tweak it when non-native theme is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D105798
2021-02-20 00:13:10 +00:00
Noemi Erli
73493a49e5 Backed out 2 changesets (bug 1693688) for causing failures in browser_options-view-01.js CLOSED TREE
Backed out changeset d0bd198837ee (bug 1693688)
Backed out changeset e0b1f4b79d4b (bug 1693688)
2021-02-19 23:39:07 +02:00
Emilio Cobos Álvarez
d1915bcf15 Bug 1693688 - Make the non-native theme not return minimum sizes for checkboxes (and most other widgets). r=spohl,mstange
This matches closer what Chrome and Safari do (Safari paints outside of
the box when this happens, but the layout box still respects the
author), see:

  data:text/html,<button style="padding: 0; width: 0">
  data:text/html,<input type=checkbox style="width: 0">

Etc. For checkboxes, this matches what OSX does, too.

Since we still want checkboxes to be slightly larger than what they'd be
otherwise, we add a hook to tweak it when non-native theme is enabled.

Differential Revision: https://phabricator.services.mozilla.com/D105798
2021-02-19 18:42:17 +00:00
Stephen A Pohl
1f52641c4f Bug 1693426: Add support for vertical progress bars and meters in the non-native theme. r=emilio,mstange
Differential Revision: https://phabricator.services.mozilla.com/D105551
2021-02-18 06:12:54 +00:00
Emilio Cobos Álvarez
a228cdaaa6 Bug 1691428 - Stop claiming we support the Menuitem widgets in nsNativeBasicTheme.cpp. r=mstange
We don't.

Depends on D104874

Differential Revision: https://phabricator.services.mozilla.com/D104875
2021-02-16 10:36:18 +00:00
Emilio Cobos Álvarez
ca89009775 Bug 1692721 - nsNativeBasicTheme should handle outline-offset like non-auto outline does. r=mstange
I thought we didn't support outline-offset on auto-style outline.

The rect we get is already inflated, so we just got to compute the
radius using that.

Differential Revision: https://phabricator.services.mozilla.com/D105125
2021-02-16 10:25:32 +00:00
Emilio Cobos Álvarez
d96854eeb1 Bug 1691781 - Make Linux tab bar use the darker of the highlight / highlighttext colors. r=dao
Some GTK themes use very soft colors for selection backgrounds, using
darker colors for the text. This makes the tab and focus outlines in the
tab bar not have sufficient contrast with usual backgrounds.

I needed to do this for bug 1690778, but it seems worth doing it on the
front-end as well.

Differential Revision: https://phabricator.services.mozilla.com/D104547
2021-02-11 16:36:54 +00:00
Emilio Cobos Álvarez
1d3c069803 Bug 1690778 - Derive accent color from theme highlight color in GTK. r=mstange
This makes form controls match the rest of the GTK theme like selection
colors, etc.

An alternative to this would be to just use non-native colors on GTK for
all content, but that seems somewhat unfortunate and we do the right
thing for scrollbars so...

I've tried on a variety of themes and this looks nice so far.

Differential Revision: https://phabricator.services.mozilla.com/D104496
2021-02-10 00:47:38 +00:00
Emilio Cobos Álvarez
2cbb8a03f1 Bug 1691064 - Make outline-style auto follow border radii. r=mstange
This matches Safari and improves the rendering when this shows by
default on unthemed form controls.

Differential Revision: https://phabricator.services.mozilla.com/D104322
2021-02-08 16:25:16 +00:00
Emilio Cobos Álvarez
e531b2b7fd Bug 1689615 - Only paint one outline for outline-style:auto with nnt. r=mstange
outline-style: auto might show up in non-themed controls and such, and
the double-outline there might look ugly.

Following border-radius would be an extra improvement for the reddit
case, but no platform does it currently (Safari on macOS does it), so
let's consider that in a follow-up.

Differential Revision: https://phabricator.services.mozilla.com/D104214
2021-02-05 16:25:57 +00:00
Emilio Cobos Álvarez
5d9da34947 Bug 1690700 - Improve scrollbars for non-native GTK theme. r=mstange
This is based on the windows implementation and has two nice things:

 * Makes scrollbar-color react to active / hover state, like on Windows.
 * Implements dark scrollbar support.

Differential Revision: https://phabricator.services.mozilla.com/D103969
2021-02-04 16:15:27 +00:00
Emilio Cobos Álvarez
e7cfc6d6f2 Bug 1690043 - Remove requirement for root scrollbars to be opaque in the non-native theme. r=mstange
This seems to come from bug 1179780, but custom scrollbars shouldn't
have this requirement, and it's kind of artificial anyway.

Differential Revision: https://phabricator.services.mozilla.com/D103692
2021-02-01 19:32:09 +00:00
Emilio Cobos Álvarez
a091ae7d29 Bug 1689603 - Return 2px border for most widgets in nsNativeBasicTheme. r=spohl
This is slightly unfortunate on one hand because we're technically lying
(but so is chromium and our GTK theme, on the other hand).

It is nice because it means that themed and unthemed controls have the
same size by default though, which seems desirable.

So I'm a bit on the edge here, but I think this is probably the less bad
option to grow our form controls if we want to do it.

Differential Revision: https://phabricator.services.mozilla.com/D103477
2021-01-29 21:18:54 +00:00
Emilio Cobos Álvarez
4b4ff83478 Bug 1689253 - Add a more sensible scrollbar size API to nsITheme, and use it to replace ScrollbarNonDisappearing. r=spohl
There's no reason we should need an scrollbar box to query the size of a
scrollbar. I plan to use this in the following patch to make the size of a
resizer not vary depending on whether the container has scrollbars or not,
which is what ultimately causes the reftest failure.

Differential Revision: https://phabricator.services.mozilla.com/D103302
2021-01-28 22:11:54 +00:00
Emilio Cobos Álvarez
9ea4db0ec1 Bug 1687865 - Fix up the radius in PaintBorderRectWithRadius if we're too small. r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D103258
2021-01-28 13:14:34 +00:00
Emilio Cobos Álvarez
2e368fc8fb Bug 1689252 - Simplify progress/meter painting in nsNativeBasicTheme. r=spohl
This shares and simplifies the code significantly, and also fixes the
artifacts when value is too small.

Differential Revision: https://phabricator.services.mozilla.com/D103257
2021-01-28 20:58:39 +00:00
Emilio Cobos Álvarez
cdd2c2e7a3 Bug 1689286 - Make the number input spinners look nicer with padding. r=spohl
If you add padding to the input on the inline-end, like some of the
examples in bug 1674431, then the darker border looks off.

Without it, the number input still looks nice, so I think we should do
this.

We might want to introduce the padding by default (see bug 1689286).

Differential Revision: https://phabricator.services.mozilla.com/D103270
2021-01-28 14:17:01 +00:00
Emilio Cobos Álvarez
5fd3126bf6 Bug 1688978 - Snap border widths in the non-native theme like we snap layout borders. r=mstange
We might want to snap focus outline widths as well, but that's harder
because it has various segments and separation between them, so we
probably want to snap those separately... So for now only border rects
probably makes sense.

Differential Revision: https://phabricator.services.mozilla.com/D103106
2021-01-26 22:12:03 +00:00