Commit Graph

181 Commits

Author SHA1 Message Date
Ting-Yu Lin
a6d1bf0cc4 Bug 1792615 - Run "cargo +nightly fmt" for style components in servo. r=emilio
The directories changed:
* servo/components/selectors/
* servo/components/style/
* servo/components/style_derive/
* servo/ports/geckolib/

Per review request, disable rustfmt in `components_to_transform_3d_matrix()` to
preserve the format for a call to `Transform3D::new`.

My mozilla-central is at
https://hg.mozilla.org/mozilla-central/rev/d1ae84015c22f2034435b47194fdced878072035

My nightly rust is 1.66.0-nightly (8b705839c 2022-09-26).

Differential Revision: https://phabricator.services.mozilla.com/D158234
2022-09-28 07:10:52 +00:00
David Shin
4dec2bd47c Bug 1766041: Part 2: Update rust's step function basd on C++ ComputedTimingFunction. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D150566
2022-07-09 17:33:57 +00:00
David Shin
c3e578e6f8 Bug 1766041: Part 1: Move Rust animation to ComputedTimingFunction. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D150565
2022-07-09 17:33:57 +00:00
Csoregi Natalia
cfc13bbba9 Backed out 5 changesets (bug 1766041) for gtest failures on APZCBasicTester. CLOSED TREE
Backed out changeset 3b0cd4ee7d1e (bug 1766041)
Backed out changeset 5de0ed4fd59b (bug 1766041)
Backed out changeset cc7ffb683e8a (bug 1766041)
Backed out changeset ce5a895e7a06 (bug 1766041)
Backed out changeset 315578c436ca (bug 1766041)
2022-07-08 03:12:42 +03:00
David Shin
759f279d0e Bug 1766041: Part 2: Update rust's step function basd on C++ ComputedTimingFunction. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D150566
2022-07-07 22:52:58 +00:00
David Shin
926f163b28 Bug 1766041: Part 1: Move Rust animation to ComputedTimingFunction. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D150565
2022-07-07 22:52:57 +00:00
David Shin
30f898451a Bug 1764126 - Part 3: Hook up linear easing calculation for servo and expose it to C++. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146838
2022-06-07 11:51:24 +00:00
David Shin
36b890eae9 Bug 1764126 - Part 2: Rust side plumbing work for linear easing function. r=emilio
Add LinearFunction to TimingFunction. Because the linear function is a
variable list of linear stops, the enum is no longer Copyable.

Differential Revision: https://phabricator.services.mozilla.com/D146837
2022-06-07 11:51:24 +00:00
Emilio Cobos Álvarez
a7977e5e52 Bug 1765550 - Move transitions and animations to nsStyleUIReset. r=dshin
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
2022-04-20 15:13:54 +00:00
Emilio Cobos Álvarez
8e5a6310b1 Bug 1699220 - Add support for the revert-layer keyword. r=boris
This patch looks bigger than it is, but it's mostly because
of plumbing.

To implement revert-layer we need not only the cascade origin of the
declaration, but the whole cascade level, plus also the layer order.

In order to do this, encapsulate these two things inside a 32-bit
`CascadePriority` struct and plumb it through the rule tree and so on.
This allows us to remove the packing and unpacking of CascadeLevel,
though I kept the ShadowCascadeOrder limit for now in case we need to
reintroduce it.

Fix `!important` behavior of layers while at it (implementing it in
`CascadeLevel::cmp`, spec quote included since it was tricky to find)
since some revert-layer tests were depending on it.

The style attribute test is failing now, but follow-up commit fixes
it, see spec issue.

In terms of the actual keyword implementation, it's sort of
straight-forward: We implement revert and revert-layer in a shared
way, by storing the cascade priority that reverted it.

Differential Revision: https://phabricator.services.mozilla.com/D133372
2021-12-14 15:38:34 +00:00
Emilio Cobos Álvarez
e8ee779a63 Bug 1695251 - Cherry-pick various servo changes.
All formatting and not-part-of-the-gecko-build changes.

Differential Revision: https://phabricator.services.mozilla.com/D106634
2021-02-26 17:00:55 +00:00
Emilio Cobos Álvarez
25d3f423c1 Bug 1646811 - Fix gecko build.
Depends on D80248

Differential Revision: https://phabricator.services.mozilla.com/D80249
2020-06-18 18:14:29 +00:00
Martin Robinson
16205a26a7 Bug 1646811 - servo: Combine AnimationAndTransitionDeclarations and AnimationRules.
These two structs are very similar, so we can combine them.

Depends on D80243

Differential Revision: https://phabricator.services.mozilla.com/D80244
2020-06-18 18:14:07 +00:00
Martin Robinson
3edfabc7f8 Bug 1646811 - servo: Add animation and transition support for pseudo-elements.
This change extends the DocumentAnimationSet to hold animations for
pseudo-elements. Since pseudo-elements in Servo are not in the DOM like
in Gecko, they need to be handled a bit carefully in stylo.  When a
pseudo-element has an animation, recascade the style. Finally, this
change passes the pseudo-element string properly to animation events.

Fixes: #10316

Depends on D80242

Differential Revision: https://phabricator.services.mozilla.com/D80243
2020-06-18 18:14:05 +00:00
Martin Robinson
34a463798b Bug 1646811 - servo: Add DocumentAnimationSet and AnimationSetKey.
This will be used in order to hold animations for pseudo elements in the
DocumentAnimationSet. Also no longer store the OpaqueNode in the
animation and transition data structures. This is already part of the
DocumentAnimationSet key.

Depends on D80241

Differential Revision: https://phabricator.services.mozilla.com/D80242
2020-06-18 18:14:02 +00:00
Martin Robinson
ac6a5d222d Bug 1646811 - servo: animations: Don't always re-resolve the node style.
When animations and transitions change don't always re-resolve node
style, just replace the animation and transition rules and re-cascade.

Depends on D80236

Differential Revision: https://phabricator.services.mozilla.com/D80237
2020-06-18 18:12:34 +00:00
Martin Robinson
47e3dbaf80 Bug 1646811 - servo: Include animations and transitions in the cascade.
Instead of applying animations and transitions to styled elements,
include them in the cascade. This allows them to interact properly with
things like font-size and !important rules.

Depends on D80234

Differential Revision: https://phabricator.services.mozilla.com/D80235
2020-06-18 18:12:14 +00:00
Martin Robinson
694a5a05a0 Bug 1646811 - servo: Better computation of animation keyframes.
This begins to address #26625 by properly applying CSS variables during
keyframe computation and no longer using `apply_declarations`. Instead,
walk the declarations, combining them into IntermediateComputedKeyframe,
maintaining declarations that modify CSS custom properties. Then compute
a set of AnimationValues for each keyframe and use those to produce
interpolated animation values.

Depends on D80233

Differential Revision: https://phabricator.services.mozilla.com/D80234
2020-06-18 18:12:07 +00:00
Martin Robinson
dfe189b874 Bug 1646811 - servo: Cache animation computed values when animations change.
Instead of recalculating the animation style every tick of an animation,
cache the computed values when animations change. In addition to being
more efficient, this will allow us to return animation rules as property
declarations because we don't need to consult the final style to produce
them.

Depends on D80232

Differential Revision: https://phabricator.services.mozilla.com/D80233
2020-06-18 18:11:57 +00:00
Emilio Cobos Álvarez
4744023957 Bug 1643201 - Miscellaneous build fixes.
Depends on D78198

Differential Revision: https://phabricator.services.mozilla.com/D78199
2020-06-04 00:35:08 +00:00
Martin Robinson
e36ca696a9 Bug 1643201 - servo: Implement animation-fill-mode.
Fixes #26460.

Depends on D78194

Differential Revision: https://phabricator.services.mozilla.com/D78195
2020-06-04 00:34:45 +00:00
Martin Robinson
21541f0682 Bug 1643201 - servo: Remove AnimatedProperty.
This removes an extra layer of abstraction and allows Servo to share
more code with Gecko. In addition, we will need to handle raw
`AnimationValue` structs soon in order to fully implement "faster
reversing of interrupted transitions."

Depends on D78192

Differential Revision: https://phabricator.services.mozilla.com/D78193
2020-06-04 00:34:34 +00:00
Martin Robinson
267e3846b6 Bug 1643201 - servo: Move most animation processing to script.
This is preparation for sharing this code with layout_2020 and
implementing selective off-the-main-thread animations.

We still look for nodes not in the flow tree in the layout thread.

Depends on D78191

Differential Revision: https://phabricator.services.mozilla.com/D78192
2020-06-04 00:34:31 +00:00
Martin Robinson
31a19e13a0 Bug 1643201 - servo: Split animations and transitions into separate lists.
This change splits the list of animations and transitions, which are
almost always handled differently. It also renames
`ElementAnimationState` to `ElementAnimationSet` and establishes an
`AnimationState` for every transition and animation. This allows us to
stop continually reallocating lists every time a transition or animation
needs to be canceled.

Fixes #14419.

Depends on D78189

Differential Revision: https://phabricator.services.mozilla.com/D78190
2020-06-04 00:34:20 +00:00
Martin Robinson
21c53762ce Bug 1643201 - servo: Use a restyle for animation ticks.
This change corrects synchronization issues with animations, by
reworking the animation processing model to do a quick restyle and
incremental layout when ticking animations.

While this change adds overhead to animation ticks, the idea is that
this will be the fallback when synchronous behavior is required to
fulfill specification requirements. In the optimistic case, many
animations could be updated and applied off-the-main-thread and then
resynchronized when style information is queried by script.

Fixes #13865.

Depends on D78187

Differential Revision: https://phabricator.services.mozilla.com/D78188
2020-06-04 00:34:15 +00:00
Martin Robinson
984e49d8cd Bug 1643201 - servo: Add support for animationend event.
This is triggered when an animation finishes. This is a high priority
because it allows us to start rooting nodes with animations in the
script thread.

This doesn't yet cause a lot of tests to pass because they rely on the
existence of `Document.getAnimations()` and the presence of
`animationstart` and animationiteration` events.

Depends on D78186

Differential Revision: https://phabricator.services.mozilla.com/D78187
2020-06-04 00:34:12 +00:00
Martin Robinson
0bcf8fa29c Bug 1643201 - servo: Split animation cancellation from update_style_for_animation.
`update_style_for_animation` previously handled both canceling defunct
animations and also updating style to reflect current animation state.
This change splits those two concerns because we want to start handling
replaced or canceled animations and finished animations in two different
places.

This is a refactor, so ideally it shouldn't change any behavior.

Depends on D78185

Differential Revision: https://phabricator.services.mozilla.com/D78186
2020-06-04 00:34:09 +00:00
Martin Robinson
e561f3c706 Bug 1643201 - servo: Restyle should reflect animations and transitions.
When doing a restyle, we should apply animations and transitions to the
new style so that it is reflected in `getComputedStyle()` and the new
style information properly cascades. This is the first part of properly
ticking animations and transitions.

This causes a couple new animations tests failures (along with many new
passes), but we currently don't have support for properly handling
animations after they have completed, so this isn't totally unexpected.

Depends on D78184

Differential Revision: https://phabricator.services.mozilla.com/D78185
2020-06-04 00:34:06 +00:00
Martin Robinson
0a86ef369c Bug 1643201 - servo: Add ElementAnimationState and PossibleElementAnimationState.
This refactor is preparation for implementing a specification
compliant transitions and animations processing model.

These data structures hold all the animation information about a single
node. Since adding, updating, and modifying animations for a single node
are all interdependent, it makes sense to start encapsulating animation
data and functionality into a single data structure. This also opens up
the possibility for easier concurrency in the future by more easily
allowing per-node mutexes.

Differential Revision: https://phabricator.services.mozilla.com/D78184
2020-06-04 00:34:02 +00:00
Emilio Cobos Álvarez
3621bb9c6b Bug 1636357 - Clean up cascade rule iteration. r=nordzilla
The current API was pretty awkward as a result of two things:

 * Not being able to create empty iterators for smallbitvec.
 * We used to call the `F` function multiple times, but turns out that
   collecting the declarations in a SmallVec was a perf win.

So clean this up so that it looks more similar to other APIs, taking an
iterator directly.

This is a bit more code, but hopefully easier to understand (and also hopefully
easier to optimize).

The motivation for this work is that I plan to investigate rebasing / landing
https://github.com/servo/servo/pull/20151, and I don't want more instantiations
of apply_declarations and such.

Differential Revision: https://phabricator.services.mozilla.com/D74369
2020-05-11 21:33:31 +00:00
Emilio Cobos Álvarez
0bb7451f2b Bug 1632363 - Fix some warnings introduced by the previous patches.
MANUAL PUSH: Avoid reviewer information from previous patches from
getting lost.
2020-04-23 05:11:04 +02:00
Martin Robinson
72f1806eca Bug 1632363 - Add support for canceling CSS transitions. r=emilio
This change adds support for canceling CSS transitions when a property
is no longer transitionable or when an element becomes styled with
display:none. Support for canceling and replacing CSS transitions when
the end value changes is still pending. This change also takes advantage
of updating the constellation message to fix a bug where transition
events could be sent for closed pipelines.

Cherry-picked from https://github.com/servo/servo/pull/26244
(though this is not part of the Gecko build).
2020-04-23 05:10:23 +02:00
Martin Robinson
735332edca Bug 1632363 - Eliminate AnimationFrame. r=emilio
This intermediate data structure doesn't really buy us anything and is a
bit confusing.

Cherry-picked from https://github.com/servo/servo/pull/26214
(though this is not part of the Gecko build).
2020-04-23 05:10:21 +02:00
Martin Robinson
bbf2363c50 Bug 1631154 - Add an iterator for transition properties. r=emilio
This simplifies the code a bit and also will allow us to more easily
make improvements to servo's animation implementation in the future.
2020-04-18 04:04:24 +02:00
Josh Matthews
5966e76ad8 Bug 1630676 - Refactor some Servo-only animations code. 2020-04-16 21:17:44 +02:00
Ciure Andrei
b9f226f4e7 Backed out 11 changesets (bug 1630676) for causing multiple failures CLOSED TREE
Backed out changeset c1fbe364b76c (bug 1630676)
Backed out changeset 629970c8f0b7 (bug 1630676)
Backed out changeset 1530f4a9aef2 (bug 1630676)
Backed out changeset a5b60fb5a0e1 (bug 1630676)
Backed out changeset a6e1a31c3e0d (bug 1630676)
Backed out changeset 4df9717e28f0 (bug 1630676)
Backed out changeset c76b0b0e503b (bug 1630676)
Backed out changeset 3c89aec57d0a (bug 1630676)
Backed out changeset 369cf504584d (bug 1630676)
Backed out changeset d7eff4acb616 (bug 1630676)
Backed out changeset 1d47c9354eeb (bug 1630676)
2020-04-16 21:45:51 +03:00
Josh Matthews
a2d7ce8d2c Bug 1630676 - Refactor some Servo-only animations code. 2020-04-16 18:37:52 +02:00
Emilio Cobos Álvarez
2462cd97a7 Bug 1596712 - Use only Origin during the cascade, rather than CascadeLevel. r=heycam
The micro-benchmark `style-attr-1.html` regressed slightly with my patch, after
the CascadeLevel size increase.

This benchmark is meant to test for the "changing the style attribute doesn't
cause selector-matching" optimization (which, mind you, keeps working).

But in the process it creates 10k rules which form a perfect path in the rule
tree and that we put into a SmallVec during the cascade, and the benchmark
spends most of the time pushing to that SmallVec and iterating the declarations
(as there's only one property to apply).

So we could argue that the regression is minor and is not what the benchark is
supposed to be testing, but given I did the digging... :)

My patch made CascadeLevel bigger, which means that we create a somewhat bigger
vector in this case. Thankfully it also removed the dependency in the
CascadeLevel, so we can stop using that and use just Origin which is one byte to
revert the perf regression.

Differential Revision: https://phabricator.services.mozilla.com/D53181
2019-11-17 23:28:39 +00:00
Emilio Cobos Álvarez
be057f5295 Bug 1560777 - Remove various bits of dead code removed in upstream servo. r=emilio 2019-06-23 13:10:27 +02:00
Emilio Cobos Álvarez
fa217d3402 Bug 1556602 - Fix various warnings with rust 1.37 nightly. r=froydnj
In particular:

 * trait objects without an explicit `dyn` are deprecated
 * `...` range patterns are deprecated

I think these shouldn't really warn by default and should be clippy / opt-in
lints, but anyway, doesn't hurt.

Differential Revision: https://phabricator.services.mozilla.com/D35135
2019-06-18 21:32:16 +00:00
Emilio Cobos Álvarez
1cd03174c7 Bug 1511811 - Minor build fixup after the Servo crossbeam_channel update. 2018-12-03 08:48:25 -05:00
Bastien Orivel
1031c1524d Bug 1511811 - Update crossbeam-channel to 0.3.
Cherry-picks https://github.com/servo/servo/pull/22142
2018-12-03 08:48:15 -05:00
Emilio Cobos Álvarez
dea05cdada Bug 1511811 - Use https for the MPL license URL.
Cherry-picks https://github.com/servo/servo/pull/22198
2018-12-03 08:43:48 -05:00
shindli
3a4462fafb Backed out 13 changesets (bug 1511811) for Btup bustages
Backed out changeset d71cde918f43 (bug 1511811)
Backed out changeset 0ae2634de8e1 (bug 1511811)
Backed out changeset 53d1f5ca4099 (bug 1511811)
Backed out changeset 5a08148928ef (bug 1511811)
Backed out changeset da7816ec50ef (bug 1511811)
Backed out changeset 5fe23889cccc (bug 1511811)
Backed out changeset 800bc60c75a7 (bug 1511811)
Backed out changeset 2392d8199cd0 (bug 1511811)
Backed out changeset 7bc486fbd195 (bug 1511811)
Backed out changeset d2c997426108 (bug 1511811)
Backed out changeset ddd573878432 (bug 1511811)
Backed out changeset 29c8ec1559a4 (bug 1511811)
Backed out changeset f5851346109d (bug 1511811)
2018-12-03 15:39:11 +02:00
Emilio Cobos Álvarez
95bf5ec91b Bug 1511811 - Minor build fixup after the Servo crossbeam_channel update. 2018-12-03 08:15:30 -05:00
Bastien Orivel
fdd2b560d3 Bug 1511811 - Update crossbeam-channel to 0.3.
Cherry-picks https://github.com/servo/servo/pull/22142
2018-12-03 08:15:26 -05:00
Emilio Cobos Álvarez
11a665046f Bug 1511811 - Use https for the MPL license URL.
Cherry-picks https://github.com/servo/servo/pull/22198
2018-12-03 08:15:21 -05:00
Simon Sapin
8796faa7aa Bug 1506391 - cargo fix --edition. r=emilio 2018-11-11 02:40:21 +01:00
Brindusan Cristian
d311f835d2 Backed out 7 changesets (bug 1506391) for Btup bustages.
Backed out changeset b8216171101c (bug 1506391)
Backed out changeset 03d2309b737d (bug 1506391)
Backed out changeset 7b63f3149852 (bug 1506391)
Backed out changeset be88680421db (bug 1506391)
Backed out changeset 3840ce1ebfb0 (bug 1506391)
Backed out changeset 94517e21621c (bug 1506391)
Backed out changeset 32bde6f52a32 (bug 1506391)
2018-11-11 01:08:20 +02:00
Simon Sapin
daedee00db Bug 1506391 - cargo fix --edition. r=emilio 2018-11-10 21:14:05 +01:00