Commit graph

8732 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
f1e04f76f0 style: Properly fail to serialize grid shorthand when not roundtripping
Other browsers also don't roundtrip properly, but they fail less
severely.

Differential Revision: https://phabricator.services.mozilla.com/D152794
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
59da4326fd style: Remove nsTimingFunction and ComputedTimingFunction
They're simple wrappers of StyleComputedTimingFunction so we can remove
them.

Differential Revision: https://phabricator.services.mozilla.com/D152700
2023-10-02 14:37:19 +00:00
David Shin
c296356a8c style: linear(...) easing: Implement right-continuous behaviour on discontinuities
Differential Revision: https://phabricator.services.mozilla.com/D152078
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
2a1e89468a style: Ensure we cancel transitions without the need of an extra flush
When something switches to display: none, right now we rely on
StopAnimationsForElementsWithoutFrames(), which posts a restyle and the
previous ProcessPendingRestyles call was papering over it.

For other elements in the display none subtree it doesn't matter,
because we don't keep their styles around, but for the display: none
element themselves we do need to update transitions on time.

We could, possibly more generally, remove
StopAnimationsForElementsWithoutFrames() altogether and cancel
animations when we clear style data, perhaps... But that's probably
worth a follow-up.

Differential Revision: https://phabricator.services.mozilla.com/D151600
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
a961519a56 style: Propagate flags from original property to aliases
Even we don't have internal aliases right now (and that seems a bit
silly) we do have pref-gated aliases. An alias ID passed to IsEnabled
with the wrong EnabledState would misbehave, assert, and crash.

Though we don't have such callers in the tree because InspectorUtils
passes only arguments that make us not look at the flags, it seems more
reliable this way.

Differential Revision: https://phabricator.services.mozilla.com/D151594
2023-10-02 14:37:19 +00:00
Oriol Brufau
9622d4912e Further changes required by Servo 2023-10-02 14:37:19 +00:00
Boris Chiou
e53f4ee4c7 style: Support animation-composition in keyframe at rules
So we can specify the keyframe-specific composite operation. However,
these is a spec issue about the default composite for CSS Animations:
https://github.com/w3c/csswg-drafts/issues/7476.

I choose to use auto as the default composite for missing keyframes to match
the definition in web-animations-1 because I think this makes more sense:
> If the keyframe-specific composite operation for a keyframe is not set, the
> composite operation specified for the keyframe effect as a whole is used for
> values specified in that keyframe.

Differential Revision: https://phabricator.services.mozilla.com/D150808
2023-10-02 14:37:19 +00:00
Boris Chiou
06f81aea07 style: Implement CSS animation-composition longhand in style system
This patch introduces animation-composition longhand but we don't
accept it in @keyframe rule for now. I will support this for @keyframe
in the patch series.

Besides, the shorthand of animation doesn't include animation-composition.
The spec issue is: https://github.com/w3c/csswg-drafts/issues/6946.
We could fix the shorthand once this spec issue gets updated.

Differential Revision: https://phabricator.services.mozilla.com/D150299
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
047812cb98 style: Clean up a bit traversal culling
Differential Revision: https://phabricator.services.mozilla.com/D151544
2023-10-02 14:37:19 +00:00
Ziran Sun
461850d5e6 style: make contain-intrinsic-size *animatable*
Differential Revision: https://phabricator.services.mozilla.com/D151231
2023-10-02 14:37:19 +00:00
David Shin
af058e6332 style: C++ ComputedTimingFunction uses Rust's timing function calculation
This was made economical by having Rust's computed `easing::TimingFunction` use
a fully resolved function for `linear(...)` easing, as per draft resolution from
https://github.com/w3c/csswg-drafts/issues/7415

Differential Revision: https://phabricator.services.mozilla.com/D151295
2023-10-02 14:37:19 +00:00
David Shin
bb0f857dfa style: Port bezier edge cases handling from C++ to Rust
Differential Revision: https://phabricator.services.mozilla.com/D150569
2023-10-02 14:37:19 +00:00
David Shin
168c868330 style: Update rust's step function basd on C++ ComputedTimingFunction
Differential Revision: https://phabricator.services.mozilla.com/D150566
2023-10-02 14:37:19 +00:00
David Shin
a585d41910 style: Move Rust animation to ComputedTimingFunction
Differential Revision: https://phabricator.services.mozilla.com/D150565
2023-10-02 14:37:19 +00:00
Oriol Brufau
e6b834ffac Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
0e61a179ee style: Add color-mix to DevTools autocomplete
Differential Revision: https://phabricator.services.mozilla.com/D151180
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
c4b71c5b7f style: Minor indentation fix. DONTBUILD
MANUAL PUSH: White-space only change
2023-10-02 14:37:19 +00:00
Ziran Sun
6fec9d6f8c style: Add support for parsing the contain-intrinsic-size property from the CSS-sizing specification
Differential Revision: https://phabricator.services.mozilla.com/D151001
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
b0693b2f4d style: Make fullscreen modal
As per https://github.com/w3c/csswg-drafts/issues/7311.

Differential Revision: https://phabricator.services.mozilla.com/D150335
2023-10-02 14:37:19 +00:00
David Shin
c49a49d7a5 style: linear(...) easing: Simplify piecewise linear implementation given parsing simplification
Differential Revision: https://phabricator.services.mozilla.com/D150163
2023-10-02 14:37:19 +00:00
David Shin
e3e2ee64de style: linear(...) easing: Parsing should split a linear stop value into two for entries with both linear-stop-length set
This brings the behaviour inline with `linear-gradient(...)`

Differential Revision: https://phabricator.services.mozilla.com/D149926
2023-10-02 14:37:19 +00:00
David Shin
09fc10c5c2 style: linear(...) Easing: First linear entry should Get 0.0 assigned for input if not specified
Previously, had the smallest input value over all entries was assigned. However,
that does not match the behaviour of `linear-gradient(...)`, which this easing
function is modeled after.

Differential Revision: https://phabricator.services.mozilla.com/D149916
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
bb5de5833c style: Improve LookAndFeel color caching
To be honest, I'm a bit baffled that bug 1773795 caused a performance
regression, but I think it's because the standins codepath is not really
cached, so system colors that are "spoofed" always go through the
massive switch, which could potentially be expensive.

To fix, this, rejigger a bit the caches so that we key on both
color-scheme and use-standins. Also, while at it, make the set of colors
we spoof a single bitflag check, rather than relying on the compiler to
do something potentially smart with it.

I had to shuffle the order of colors around so that the expression to
initialize the bitfield is constexpr (doesn't go over 1 << 64), but
other than that this patch should be relatively straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D150100
2023-10-02 14:37:19 +00:00
Oriol Brufau
34c3767560 Further changes required by Servo 2023-10-02 14:37:19 +00:00
David Shin
5d528ec8be style: Use Rust's ComputedTimingFunction for IPDL
Differential Revision: https://phabricator.services.mozilla.com/D149663
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
a19674a5a7 style: Use style interpolation code for gradients
This ensures they're clamped on Animated -> sRGB conversion, and in the
future we'll have to implement different color spaces so we'll need to
use it anyways.

Differential Revision: https://phabricator.services.mozilla.com/D149792
2023-10-02 14:37:19 +00:00
Oriol Brufau
189039bea5 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Martin Robinson
64febfbe9a style: Implement CSS 'contain: style'
Add an implementation of CSS `contain: style`. This introduces two new
data structures, the ContainStyleScope and ContainStyleScopeManager.

ContainStyleScope manages one `contain: style` "world" which has its own
counter and quote lists. The contents of these lists depend on their
parent scopes, but are not affected by their children.
ContainStyleScopeManager manages a tree of scopes starting at a root
scope which is outside of any `contain: style` element.

Scopes are stored in a hash table that is keyed off of the nsIContent
which establishes the `contain: style` scope. When modifying quote or
content lists, the ContainStyleScopeManager is responsible for finding
the appropriate `contain: style` scope to modify.

Perhaps the most complex part of this is that counters and quotes have
read access to the state of counters and quotes that are in ancestor
`contain: style` scopes. In the case of counters, USE nodes that are at
the beginning of counter lists might have a counter scope that starts in
an ancestor `contain: style` scope. When nsCounterNode::SetScope() is
called, the code may look upward in the `contain: style` scope tree to
find the start of the counter scope. In the case of quotes, the first
node in the quote list must look for the state of quotes in ancestor
`contain: style` scopes.

Differential Revision: https://phabricator.services.mozilla.com/D149508
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
ad68880627 style: Implement AccentColor/AccentColorText and remove -moz-prefixed version of the color
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
2023-10-02 14:37:19 +00:00
David Shin
ca6ad97159 style: Refactor function parsing branches for specified::easing::TimingFunction
Differential Revision: https://phabricator.services.mozilla.com/D149756
2023-10-02 14:37:19 +00:00
Oriol Brufau
3d02b4ef90 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
34373c2ac8 style: Check for allowed colors recursively in forced-colors mode
Differential Revision: https://phabricator.services.mozilla.com/D149733
2023-10-02 14:37:19 +00:00
Tiaan Louw
3d0cf4dbf9 style: Add simple parsing and matching support for :has
Parsing is behind a config value `layout.css.has-selectors.enabled`. This
change does not support p:has(> a) combinators, but will handle them
gracefully, just not matching on them.

Differential Revision: https://phabricator.services.mozilla.com/D149515
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
dcdf9f33d5 style: Fix grid shorthand parsing to not incorrectly ignore the last token in one case
Differential Revision: https://phabricator.services.mozilla.com/D149666
2023-10-02 14:37:19 +00:00
Mike Hommey
fb95cb7993 style: Update stylo to itertools:0.10, itoa:1.0 and toml:0.5
Differential Revision: https://phabricator.services.mozilla.com/D149454
2023-10-02 14:37:19 +00:00
Jonathan Kew
becb855b3a style: Only accept the CSS2 font-variant values (normal/small-caps) in the font shorthand; CSS Fonts 3/4 font-variant additions are not allowed
Differential Revision: https://phabricator.services.mozilla.com/D149440
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
6a5f012d3b style: Fix dynamic viewport size
Differential Revision: https://phabricator.services.mozilla.com/D149275
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
5de65d9f2c style: Make viewport-relative units zoomable via "zoom text only"
They're not font relative, so it we probably want them to be zoomed.

Differential Revision: https://phabricator.services.mozilla.com/D148796
2023-10-02 14:37:19 +00:00
Boris Chiou
82d7f2154d style: Hook named scroll timelines to animation-timeline
Basically, animation-timeline could be
1. auto
2. none
3. <timeline-name>

We extend the <timeline-name> to cover both @scroll-timeline rule and
scroll-timeline-name property. We check @scroll-timeline rule first. If
it doesn't exist, we check scroll-timeline-name of the element itself,
the previous silbings, and their ancestors.

Differential Revision: https://phabricator.services.mozilla.com/D146358
2023-10-02 14:37:19 +00:00
Boris Chiou
13acff77d1 style: Support scroll-timeline shorthand in style system
Implement
"scroll-timeline: <'scroll-timeline-axis'> || <'scroll-timeline-name'>".

Differential Revision: https://phabricator.services.mozilla.com/D146020
2023-10-02 14:37:19 +00:00
Boris Chiou
0c709f714b style: Support scroll-timeline-axis longhand in style system
Implement "scroll-timeline-axis: block | inline | vertical | horizontal".

Differential Revision: https://phabricator.services.mozilla.com/D146019
2023-10-02 14:37:19 +00:00
Boris Chiou
8d8594ef86 style: Support scroll-timeline-name longhand in style system
Implement "scroll-timeline-name: none | <custom-ident>".

Differential Revision: https://phabricator.services.mozilla.com/D146018
2023-10-02 14:37:19 +00:00
Oriol Brufau
105050d46d Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
dcafbde256 style: Move fixed-point font types to Rust
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
2023-10-02 14:37:19 +00:00
Mike Hommey
48749641d3 style: Update derive_more to 0.99.17
Limit its features to those we actually use, which turns out is none for
webrender_api.

Differential Revision: https://phabricator.services.mozilla.com/D148734
2023-10-02 14:37:19 +00:00
Oriol Brufau
04a817c0d2 Further changes required by Servo 2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
c283b32991 style: Add a low-priority selector list for pseudo-classes that have global rules
This avoids trying to match those global rules for most elements that
can't match them anyways.

Differential Revision: https://phabricator.services.mozilla.com/D147640
2023-10-02 14:37:19 +00:00
Tiaan Louw
1162204bad style: Rename :-moz-modal-dialog to :modal
Differential Revision: https://phabricator.services.mozilla.com/D148751
2023-10-02 14:37:19 +00:00
Emilio Cobos Álvarez
7f81cd4f7c style: While at it use some better names for some bits
Differential Revision: https://phabricator.services.mozilla.com/D148538
2023-10-02 14:37:19 +00:00
Oriol Brufau
6c3f92cb85 Further changes required by Servo 2023-10-02 14:37:19 +00:00