Commit graph

46362 commits

Author SHA1 Message Date
Mike Hommey
7bc667f6b4 style: Fix warnings about whitelist/blocklist functions being deprecated in bindgen 0.59
Differential Revision: https://phabricator.services.mozilla.com/D147695
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
c0ecfde11c style: Remove some dead vibrancy code
Drive-by cleanup.

Differential Revision: https://phabricator.services.mozilla.com/D147698
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
6ae56890b3 style: Improve Percentage -> LengthPercentage conversion
This doesn't change behavior because we only use them for images that
have no clamping.

Depends on D147008

Differential Revision: https://phabricator.services.mozilla.com/D147511
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
079fce37d2 style: Do hue interpolations in degrees rather than radians. r=barret
This gives us a bit more precision.

Differential Revision: https://phabricator.services.mozilla.com/D147007
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
bc1845a8f8 style: Fix hue adjustment to match the spec
The value to sum is tau, not pi. This was caught by some tests, see
https://drafts.csswg.org/css-color/#shorter

Differential Revision: https://phabricator.services.mozilla.com/D147006
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
1e5079ca00 style: Fix color-mix() percentage normalization
Differential Revision: https://phabricator.services.mozilla.com/D147005
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
6fc4355dc2 style: Implement more color-mix() color-spaces
We had code to convert between these and the latest draft supports them so...

Differential Revision: https://phabricator.services.mozilla.com/D147004
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
95e9898db4 style: Make the color interpolation code more generic
It's really piece-wise premultiplied interpolation, with a special-case
for hue, so centralize the implementation.

Differential Revision: https://phabricator.services.mozilla.com/D147003
2023-08-16 17:46:41 +02:00
Oriol Brufau
0fc3267d2e Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
f4ede10441 style: Update color-mix() syntax to match the current spec
Test expectation updates for this in the latest patch of the bug.

Differential Revision: https://phabricator.services.mozilla.com/D147002
2023-08-16 17:46:41 +02:00
Hiroyuki Ikezoe
3723a7b18d style: Parse scroll-snap-stop style and propagate it to APZ side
Depends on D146147

Differential Revision: https://phabricator.services.mozilla.com/D145850
2023-08-16 17:46:41 +02:00
Oriol Brufau
f5cf952525 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
d1aeb3921b style: Cache computed styles objects display: none subtrees
This reuses our existing undisplayed style generation, but in a
per-document rather than per-nsComputedDOMStyle object, which means that
we can avoid re-resolving styles of elements in display: none subtrees
much more often.

This brings the test-case in the bug to par with other browsers or
better, and is much simpler than the initial approach I tried back in
the day.

Differential Revision: https://phabricator.services.mozilla.com/D147547
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
39ac4840ee style: Make modal dialog code more generic, and make it apply to fullscreen too behind a pref
For now, don't turn it on by default yet, because I want to wait for
more discussion in https://github.com/w3c/csswg-drafts/issues/6965 and
so on. But I think the code is simple enough to land this.

Differential Revision: https://phabricator.services.mozilla.com/D147295
2023-08-16 17:46:41 +02:00
Oriol Brufau
1cb9396455 style: Change order of container shorthand
Since the initial value of container-type is an open issue [1],
I'm leaving that as-is for now.

[1] https://github.com/w3c/csswg-drafts/issues/7202

Differential Revision: https://phabricator.services.mozilla.com/D147338
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
d51bd1ee46 style: Implement overflow-clip-margin: <length>
Differential Revision: https://phabricator.services.mozilla.com/D146432
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
8c3553226b style: Ensure options in listbox selects are not stacking contexts by default
We could have a different property or something but this seems
reasonable as well probably.

Differential Revision: https://phabricator.services.mozilla.com/D146994
2023-08-16 17:46:41 +02:00
Oriol Brufau
9605ed7c74 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
bbf10a43b8 style: More container queries plumbing
Provide container information in computed::Context and use it to resolve
the container queries.

This still fails a lot of tests because we are not ensuring that layout
is up-to-date when we style the container descendants, but that's
expected.

Differential Revision: https://phabricator.services.mozilla.com/D146478
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
5c2fac087f style: Clean up unused -moz-window-shadow values
After bug 1768278 and bug 1767815 there's no more uses of the cliprounded value
in the tree (also it causes artifacts on HiDPI screens so we probably don't
want new usages).

The "sheet" value is unused, and the other values other than "default" and
"none" are only derived from "default", so they don't need to be exposed in the
style system.

Differential Revision: https://phabricator.services.mozilla.com/D145821
2023-08-16 17:46:41 +02:00
Autumn on Tape
08641b0ce8 style: Implement 'update' media feature
Differential Revision: https://phabricator.services.mozilla.com/D146338
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
af958c4c79 style: Lint and 32-bit build fix.
MANUAL PUSH: Bustage fix CLOSED TREE
2023-08-16 17:46:41 +02:00
Oriol Brufau
a7699d9034 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
f48b95e2e3 style: Move size of tests to compile-time tests in the style crate
Same reasoning as the previous commit.

Differential Revision: https://phabricator.services.mozilla.com/D146104
2023-08-16 17:46:41 +02:00
Oriol Brufau
50d31686be Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
9a7e8006e1 style: Convert specified value tests to compile-time tests
These were written at a time where std::mem::size_of wasn't a `const fn` in
Rust.

Now that it is, we can make these tests live in the style crate, and the build
not to compile if they fail.

Differential Revision: https://phabricator.services.mozilla.com/D146103
2023-08-16 17:46:41 +02:00
David Shin
5f75d29aac style: Implement piecewise linear function
Differential Revision: https://phabricator.services.mozilla.com/D145256
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
a1c8d7ebb2 style: Fix layer statement rules with multiple layer names
MANUAL PUSH: Trivial orange fix CLOSED TREE.
2023-08-16 17:46:41 +02:00
Oriol Brufau
7300c12a13 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
82c5be08c8 style: Track @container condition id in style rules
Much like we track layer rules. Consolidate that "containing rule state
we pass down while building the cascade data" in a single struct that we
can easily restore.

For now, do nothing with it. I want to land this patch separately
because it touches the Rule struct and CascadeData rebuilds, which both
are performance sensitive.

Its layout shouldn't change because I also changed LayerId to be a u16
(this shouldn't matter in practice, since LayerOrder is already a u16).

Differential Revision: https://phabricator.services.mozilla.com/D145243
2023-08-16 17:46:41 +02:00
Oriol Brufau
b05552369f Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
4878422c93 style: Simplify selector flags setup even more
In my investigation for bug 1766439, I am digging into why selector
matching regressed.

It doesn't help that the selector-matching code is instantiated a
gazillion times (so there's a ton of copies of the relevant functions).

This was needed in the past because we had different ways of setting the
selector flags on elements, but I unified that recently and now we only
need to either set them or not. That is the kind of thing that
MatchingContext is really good for, so pass that instead on
MatchingContext creation.

Differential Revision: https://phabricator.services.mozilla.com/D145428
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
db53845694 style: Remove proton places tooltip code
There's nobody working on it, and tooltips should hopefully be nice
enough after recent changes (bug 1765423).

Having it enabled causes artifacts like bug 1767815 comment 3. We can
always rescue this from hg history if needed.

Differential Revision: https://phabricator.services.mozilla.com/D145621
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
68af027381 style: Implement media feature expression multi-range syntax
Differential Revision: https://phabricator.services.mozilla.com/D145231
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
f545a473ff style: Refactor media feature expression representation in preparation to support multi-range syntax
No behavior change.

Depends on D145229

Differential Revision: https://phabricator.services.mozilla.com/D145230
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
990de9ceaa style: Factor out parsing the query feature name
No behavior change.

Differential Revision: https://phabricator.services.mozilla.com/D145229
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
d1a281ebbd style: Fix insertRule with layer statements before imports
We need to do a bit more nuanced check because @layer statements might
go before imports.

Differential Revision: https://phabricator.services.mozilla.com/D144996
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
819ebc5710 style: Introduce Optional<T> to represent optional values in the style system
cross-fade() was kinda doing this in its own way with PercentOrNone, but
since now we have more use-cases for this we should probably make this a
slightly more general solution.

I added some convenience APIs, but they're unused as of this patch so
let me know if you want them gone.

Differential Revision: https://phabricator.services.mozilla.com/D144831
2023-08-16 17:46:41 +02:00
Oriol Brufau
16cfd01823 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
1003d644aa style: Add support for parsing container-query-specific features
There are some mediaqueries-5 features that we still don't support and
explain the remaining failures in at-container-{parsing,serialization}.

Differential Revision: https://phabricator.services.mozilla.com/D144446
2023-08-16 17:46:41 +02:00
Oriol Brufau
989f8d89c4 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
679a69defb style: cleanup animation-name
Make the representation the same between Gecko and Servo code. This will
enable further clean-ups in the future.

Make serialization be correct, serializing as identifier unless it's an
invalid one (in which case we serialize as a string).

This changes our stringification behavior in the specified style, but
now it will match the computed style and be more correct over-all.

Differential Revision: https://phabricator.services.mozilla.com/D144473
2023-08-16 17:46:41 +02:00
Oriol Brufau
ca25d17626 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
453e7d03d4 style: Move some of the media query code to a more generic queries module
No behavior change, just moving and renaming files.

The code in the "queries" module will be shared between @media and
@container.

@media has some other code that container queries doesn't need like
MediaList / MediaType / etc. That remains in the media_queries module.

Differential Revision: https://phabricator.services.mozilla.com/D144435
2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
3eed093e33 style: Tweak contain bitflag definition order to avoid static constructors
This has no behavior change otherwise. The STRICT definition depended on
SIZE, which was defined later. That's fine in Rust, but in C++ it causes
the initialization to be dynamic because it doesn't have the definition
of SIZE yet (ugh).

This is the fix for the regression, though the following patch turns on
constexpr support in cbindgen, which would've caught this at build-time,
and guarantees that we don't have extra static constructors.

Differential Revision: https://phabricator.services.mozilla.com/D144316
2023-08-16 17:46:41 +02:00
Boris Chiou
3b174e376e style: Add scroll() to animation-timeline for style system
scroll() is defined in the spec proposal, and there is a temporary spec:
https://drafts.csswg.org/scroll-animations-1/rewrite#scroll-notation.

The spec is still under development, so we don't drop the orignal
scroll-timeline at rule. Instead, we add a new scroll() notation to
animation-timeline, and support both syntax for now.

Differential Revision: https://phabricator.services.mozilla.com/D143417
2023-08-16 17:46:41 +02:00
Oriol Brufau
f981596622 Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
8d8b5942be style: Make media feature evaluation take a computed::Context
This has no behavior change right now, but will simplify sharing code
with container queries.

Container queries will have container information in the
computed::Context (this is necessary anyways for container-based units),
so this avoids having to have different code for media and container
queries.

Differential Revision: https://phabricator.services.mozilla.com/D144152
2023-08-16 17:46:41 +02:00
Oriol Brufau
6279504ddb Further changes required by Servo 2023-08-16 17:46:41 +02:00
Emilio Cobos Álvarez
76847f7b45 style: Move transitions and animations to nsStyleUIReset
This mostly just moves code around, to minimize potential behavior
changes. There are some cleanups that we should try to do long term
(this "have an array with n different counts" is pretty weird).

But for now this should unblock people.

The destination struct (nsStyleUIReset) was chosen mainly because it's
small and non-inherited, and it doesn't seem like a worse place than
nsStyleDisplay.

Differential Revision: https://phabricator.services.mozilla.com/D144183
2023-08-16 17:46:41 +02:00