Commit graph

45836 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
efb5a8cfe5 style: Fix rebase mistake
MANUAL PUSH: Bustage fix CLOSED TREE
2023-05-31 00:50:32 +02:00
Emilio Cobos Álvarez
0be968fb4c style: Remove -moz-gtk-csd-transparent-background
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
2023-05-31 00:50:32 +02:00
Oriol Brufau
c204f3a96d Further changes required by Servo 2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
07e5ea6966 style: Expose titlebar radius as a chrome-only CSS environment variable
Mostly plumbing.

Differential Revision: https://phabricator.services.mozilla.com/D128680
2023-05-31 00:50:31 +02:00
Oriol Brufau
5c861b90c5 Further changes required by Servo 2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
e74b41cafe style: Add support for chrome-only environment variables
This bit is taken straight from D73454 (I reviewed it but I guess
another pair of eyes is ok, it's really straight-forward).

Co-authored-by: Nicklas Boman <smurfd@gmail.com>

Differential Revision: https://phabricator.services.mozilla.com/D128679
2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
685b2cd29a style: Remove -moz-toolbar-prefers-color-scheme
By making prefers-color-scheme return the ColorSchemeForChrome(), which
accounts for the Firefox theme.

Differential Revision: https://phabricator.services.mozilla.com/D128611
2023-05-31 00:50:31 +02:00
Emilio Cobos Álvarez
8c6af822b0 style: Make anonymous scrollbar caching work on mac by default, and unify scrollbars.css across platforms
We make it work on macOS by setting pointer-events: none + opacity: 0 rather
than visibility: hidden, and tweaking the caching setup to be Android-like.

Now that the scrollbars sheet is the same across platforms, move it to where
the rest of the UA sheets are. This way we guarantee that the RDM vs. Android
difference is less (just the ifdef at the top of the sheet).

Depends on D128084

Differential Revision: https://phabricator.services.mozilla.com/D128085
2023-05-31 00:50:30 +02:00
Emilio Cobos Álvarez
750c9ee814 style: Clean up GTK titlebar colors
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
2023-05-31 00:50:30 +02:00
Boris Chiou
f00818b8ec style: Tweak the serialization of rotate property
The serialization of rotate should be updated to match the current spec.

1. If a rotation about the z axis (that is, in 2D) is specified, the property
   must serialize as just an <angle>.

2. If any other rotation is specified, the property must serialize with an axis
   specified. If the axis is parallel with the x or y axes, it must serialize
   as the appropriate keyword.

Also, we need to handle the zero length vector separately because it is
parallel to every other vector but different from x axis, y axis, or z axis.

Differential Revision: https://phabricator.services.mozilla.com/D127747
2023-05-31 00:50:30 +02:00
Emilio Cobos Álvarez
6899931303 style: Make inert not modify the computed style
Differential Revision: https://phabricator.services.mozilla.com/D127422
2023-05-31 00:50:30 +02:00
Emilio Cobos Álvarez
b3deee4cc8 style: Remove support for -moz-system-color() as chrome code no longer uses it (in favor of color-scheme)
Differential Revision: https://phabricator.services.mozilla.com/D127802
2023-05-31 00:50:30 +02:00
Emilio Cobos Álvarez
5766329ffe style: Add basic support for dark form controls to nsNativeBasicTheme
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
2023-05-31 00:50:29 +02:00
Emilio Cobos Álvarez
b6fa162955 style: Part 1 - Enable color-scheme CSS property in chrome sheets
Differential Revision: https://phabricator.services.mozilla.com/D127300
2023-05-31 00:50:29 +02:00
Emilio Cobos Álvarez
3bf9bf696a style: Ensure to copy over the viewport/font units invalidation bits when reusing reset properties
Differential Revision: https://phabricator.services.mozilla.com/D127262
2023-05-31 00:50:29 +02:00
Emilio Cobos Álvarez
f17c42110c style: Clean up button active system colors
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
2023-05-31 00:50:29 +02:00
Emilio Cobos Álvarez
3c0a1f2cb2 style: Remove NS_AUTHOR_SPECIFIED_PADDING
There's only one meaningful usage of it, which is to disable native
appearance of the <input type=range> (the windows native theme is no
longer exposed to content).

<input type=range> is inconsistent with every other native widget, which
only disables native appearance if the author specifies backgrounds or
borders. So make it match literally all other widgets and simplify a bit
the code.

We had no tests for this special behavior, let me know if you think it's
worth adding one (but I don't feel very strongly about it).

Differential Revision: https://phabricator.services.mozilla.com/D127082
2023-05-31 00:50:28 +02:00
Oriol Brufau
3d54b27a50 Further changes required by Servo 2023-05-31 00:44:03 +02:00
Boris Chiou
c21a0dcc96 style: Part 2: Add animation-timeline into animation shorthand
We use the same rule as blink: serialize the animation-timeline if
it is not the default value.

Differential Revision: https://phabricator.services.mozilla.com/D126451
2023-05-30 23:26:04 +02:00
Boris Chiou
2a7436481c style: Part 1: Add animation-timeline longhand property in style system
This patch adds the animation-timeline longhand property. For
shorthand, we will do that in the next patch.

This patch includes the aut-generated code in
devtools/shared/css/generated/properties-db.js, by `./mach devtools-css-db`.

Note:
1. we will use this property in Bug 1676791. For now, only make sure
   we parse it and serialize it correctly.
2. The syntax of animation-timeline may be updated, based on the spec
   issue: https://github.com/w3c/csswg-drafts/issues/6674.
   However, it's not a big problem to update it later, so we still can
   prototype this property based on the current version of spec.

Differential Revision: https://phabricator.services.mozilla.com/D126450
2023-05-30 23:26:04 +02:00
Oriol Brufau
7d8a87cd01 Further changes required by Servo 2023-05-30 23:26:03 +02:00
Emilio Cobos Álvarez
b0a356e3b3 style: Order keyframe rules by layer
@counter-style/@font-face/@scroll-timeline need similar fixes, but tests
for those haven't been synced yet so waiting for that before writing
them.

Differential Revision: https://phabricator.services.mozilla.com/D126616
2023-05-30 23:26:03 +02:00
Emilio Cobos Álvarez
6785ffea7b style: Unprefix -moz-fit-content
I'm not aware of any reason we shouldn't do this, as it is interoperable
with other browsers, and it causes compat issues from sites that forget
to use the prefixed version.

Note this removes some #[parse(aliases)]. These only affect devtools
autocomplete behavior, and we avoid autocompleting -moz-prefixed
keywords when possible, so even though it's a slight behavior change,
it's worth it.

Differential Revision: https://phabricator.services.mozilla.com/D126718
2023-05-30 23:26:03 +02:00
Stephen A Pohl
d830ec8562 style: Place window control buttons on the right side on macOS when using an RTL system locale, regardless of the Firefox locale
Differential Revision: https://phabricator.services.mozilla.com/D116921
2023-05-30 23:26:03 +02:00
Emilio Cobos Álvarez
2a42be3cc8 style: Print lock address on assert
Note that the crash reason is sanitized so we're not exposing anything
sensitive.

I think my patch just changed the signature of the stack, as it didn't
change anything related to guards or what not. But without knowing why
is failing or a repro it's hard to know what's going on.

Printing the address at list would give us some indication of what might
be going wrong (perhaps we're using a static lock when we don't expect
one or such?).

Differential Revision: https://phabricator.services.mozilla.com/D125948
2023-05-30 23:26:03 +02:00
Emilio Cobos Álvarez
75acb72256 style: Get rid of nsStackFrame
There are no legacy-stack uses anymore.

Differential Revision: https://phabricator.services.mozilla.com/D126077
2023-05-30 23:26:02 +02:00
Oriol Brufau
4de990e41a Further changes required by Servo 2023-05-30 23:26:02 +02:00
Boris Chiou
9e4535cb00 style: Part 5: Drop the unused effective_xxx_rules
It seems only effective_style_rules() and effective_viewport_rules() are
used. Let's drop the unused ones.

Differential Revision: https://phabricator.services.mozilla.com/D125905
2023-05-30 23:26:02 +02:00
Boris Chiou
b297c10fbf style: Part 3: Add CSSScrollTimelineRule for CSSOM
Implement CSSScrollTimelineRule CSSOM API.
https://drafts.csswg.org/scroll-animations-1/#the-css-scroll-timeline-rule-interface

We rely on the CSSOM API for testing. However, the wpt doesn't match the
current spec and it has some errors. We update the wpt and enable the
preference for testing in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D125766
2023-05-30 23:26:02 +02:00
Oriol Brufau
2a11460915 Further changes required by Servo 2023-05-30 23:26:02 +02:00
Boris Chiou
bb703e303d style: Part 2: Hook @scroll-timeline rule into style system
We add scroll-timeline rule into the stylesheet rule type, and add a new
perference to protect it: layout.css.scroll-linked-animations.enabled.

We will use this perference for animation-timeline property as well.

Differential Revision: https://phabricator.services.mozilla.com/D125765
2023-05-30 23:26:01 +02:00
Boris Chiou
111c8d616f style: Part 1: Implement @scroll-timeline in style system
Define the data structure for @scroll-timeline rule, the parsing code,
and the serialization.

Differential Revision: https://phabricator.services.mozilla.com/D125764
2023-05-30 23:26:01 +02:00
Emilio Cobos Álvarez
3e251f50fc style: Fix anonymous name handling in presence of stylesheet sharing
We need to compute the anonymous name on the fly while building the
CascadeData, otherwise we may see the same layer rule in two places due
to stylehseet sharing and make them incorrectly share a name.

Differential Revision: https://phabricator.services.mozilla.com/D125175
2023-05-30 23:26:01 +02:00
Emilio Cobos Álvarez
5fe148d5f1 style: Add some parsing and serialization tests for @layer
This uncovers some serialization bugs, and some missing null-checks
given the statement layer doesn't have a rule list.

Differential Revision: https://phabricator.services.mozilla.com/D125176
2023-05-30 23:26:01 +02:00
Oriol Brufau
35bf5f0b09 Further changes required by Servo 2023-05-30 23:26:01 +02:00
Emilio Cobos Álvarez
4522e7f94a style: Add experimental support for "e", "pi", and various trigonometric functions in calc()
I'll add some tests before enabling. Also, WebKit folks (who have
implemented cos() / tan() / sin()) said they will upstream their tests
to WPT, so I'll extend those with the inverse functions before landing
as well.

Differential Revision: https://phabricator.services.mozilla.com/D124990
2023-05-30 23:26:01 +02:00
Oriol Brufau
4f193fbf49 Further changes required by Servo 2023-05-30 23:26:00 +02:00
Emilio Cobos Álvarez
1e5806610b style: Don't consider system-ui valid for user font prioritization
Since the user can't configure it, at least from the UI (we could add UI
for it but it's unclear it'd be worth it).

Differential Revision: https://phabricator.services.mozilla.com/D125182
2023-05-30 23:26:00 +02:00
Emilio Cobos Álvarez
7108be870d style: Add a simple CSSLayerRule implementation
The specifics of how this is going to work are still getting spec'd /
discussed in https://github.com/w3c/csswg-drafts/issues/6576, but this
allows DevTools to work fine and the feature to be complete enough for
Nightly experimentation (with the other in-flight patches).

Otherwise devtools crashes when trying to inspect pages that use them.

Differential Revision: https://phabricator.services.mozilla.com/D124656
2023-05-30 23:26:00 +02:00
Emilio Cobos Álvarez
0cc049946e style: Fix layer statement with nested layer names
When we had:

  @layer A.B;

We were registering "A" and "B", not "A" and "A.B", which was the intention.

Fix is trivial.

Depends on D124620

Differential Revision: https://phabricator.services.mozilla.com/D124621
2023-05-30 23:26:00 +02:00
Oriol Brufau
a6f9a364db Further changes required by Servo 2023-05-30 23:23:17 +02:00
Emilio Cobos Álvarez
92092bf0aa style: Fix out of order child layer registration, and enable the tests
This makes layer order use a fixed set of bits per nesting level, to "reserve"
bits for children before they are registered.

See the comment in LayerOrder for the implementation limits it imposes, and
potential alternatives if these limits are not enough (but I think they should
be).

Enable the tests, as they mostly pass now (commit incoming to fix the remaining
ones).

Differential Revision: https://phabricator.services.mozilla.com/D124620
2023-05-30 23:09:44 +02:00
Oriol Brufau
f351d955ad Further changes required by Servo 2023-05-30 23:09:44 +02:00
Jonathan Kew
d299040d55 style: Fix the serialization order for the text-decoration shorthand to match the canonical order in the spec
Differential Revision: https://phabricator.services.mozilla.com/D124536
2023-05-30 23:09:44 +02:00
Oriol Brufau
f063308e33 Further changes required by Servo 2023-05-30 23:09:43 +02:00
Emilio Cobos Álvarez
6bc198b757 style: Implement @import layer|layer(<name>)
This works modulo the existing nested layer order bug. Will be covered
by WPT /css/css-cascade/layer-import.html once the feature is enabled (I
can probably enable it right away for those tests, but I'd rather fix
the obvious bugs first).

Differential Revision: https://phabricator.services.mozilla.com/D124538
2023-05-30 23:09:43 +02:00
Emilio Cobos Álvarez
3dc3fb9412 style: Plumb layer order through ApplicableDeclarationBlock, and make it have an effect
Same, I want to land this separately to see if it affects
micro-benchmarks. If so, we might want to pack the layer order
_somewhere_ (though in this case I'm not sure where, tbh).

With this, layer rules should have an effect on the page. There are
a few things missing before being able to enable them:

 * Fix nested layer order in some cases (when parent layers are declared
   out of order, see the previous commit mentioning this).
 * Some kind of OM representation, perhaps.
 * Tests of course, which are coming in bug 1728722 and bug 1727276.

But this should be enough to allow playing with them.

Depends on D124337

Differential Revision: https://phabricator.services.mozilla.com/D124338
2023-05-30 23:09:43 +02:00
Oriol Brufau
93fb8861ae Further changes required by Servo 2023-05-30 23:03:46 +02:00
Emilio Cobos Álvarez
874737d877 style: Add layer_order to rules
I want to land this separately because we might want to get smarter with
the size of the Rule struct (maybe restricting layer order to a u8 per
scope and packing it with the source order, since 255 layers seem
plenty), but I'd rather do the obvious thing for now.

Depends on D124336

Differential Revision: https://phabricator.services.mozilla.com/D124337
2023-05-27 06:25:55 +02:00
Emilio Cobos Álvarez
1f62a7144d style: Tweak recursion in add_rule to only cause a function call per recursion level
This code is really hot, and we've had perf regressions in the past for
introducing function calls in the hot path.

After the previous patch, add_rule is recursive and thus it can't be
inlined, causing a function call for each CSS rule.

This reduces the overhead by making the function take a rule list
instead, causing a function call per rule _list_, which should be
unnoticeable in practice.

Depends on D124335

Differential Revision: https://phabricator.services.mozilla.com/D124336
2023-05-27 06:25:55 +02:00