Commit graph

49 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
0b67b218d0
style: Add a new Timer structure to the shared style context, and basic infrastructure for controlling animations. 2016-07-20 09:05:53 -07:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Emilio Cobos Álvarez
2d566ef0ef
style: Fix parsing and add generated keyframes 2016-06-28 15:20:59 +00:00
Emilio Cobos Álvarez
46eec45886
layout: Simplify logic in layout/animation.rs
Self-review is helpful it seems.
2016-06-28 15:13:07 +00:00
Emilio Cobos Álvarez
f54583884e
layout: animation: hoist down precise_time_s() call to avoid calling it unnecessarily
This was here before, but I moved it up presumably in one of my attempts and
never forgot to restore that.
2016-06-28 15:13:05 +00:00
Emilio Cobos Álvarez
8527762b83
style: Allow pausing and unpausing animations.
There's a bit of flickering when unpausing where the node has the original
state, but I'm not totally sure where it comes from, posibly from
PropertyAnimation returning None due to no styles changing?
2016-06-28 15:13:03 +00:00
Emilio Cobos Álvarez
2b2e58a868
style: WTF I was thinking about when I wrote that? 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
33f581883b
style: Support animation-direction. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
9cf2e52d36
tidy: Clean up warnings and tidy lints. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
cb3da24f08
style: layout: Get actual keyframes working!
There are a few shortcomings, for example:

 * We don't do the same as other browsers when some properties are not specified
   in some of the keyframes, though this is easy to work out (though a bit more
   expensive in the sense that we should apply all the previous keyframes' style
   instead of just the previous and the next.

 * To trigger the initial animation, a restyle is necessary. Should be easy to
   do an initial restyle off-hand or something like that, but for now this is
   worked-around adding a :hover rule to the node.

   Also, the animation is resetted when the node is hovered. That's a bug, but
   is probably not so difficult to test.

 * A few things, mainly animation-direction, are not supported yet, but
   shouldn't be that hard to support.

Still a lot of work to do, but I think this approach might be ok.
2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
bc970596d6
layout: Make animations work... more or less.
There's some maths I've done wrong, but it DOES animate some things, though
they're only triggered past the first restyle, and we probably have some
duplications where the animations arrive to layout.

Anyway, got to go.
2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
c16c5acade
style: Rewrite the animation representation to allow having state in layout
I have to make the appropriate changes in layout, but I'm running out of battery
in the bus.
2016-06-28 15:09:53 +00:00
Ms2ger
5c03dd8eb1 Introduce a script_layout_interface crate and move RestyleDamage to it. 2016-06-20 19:02:36 +02:00
Ms2ger
cc2b2b50a7 Remove ConstellationChan.
It's a pointless abstraction that propagates the obsolete chan terminology,
swaps the order in which the sender and receiver are returned, and hides a
source of panics.
2016-05-19 17:13:44 +02:00
Joshua Holmer
83e66d6959 Move AnimationState to script_traits
Resolves #9223
2016-01-13 18:14:12 -05:00
Ms2ger
39ba25572b Stop reexporting Animation from layout_interface. 2016-01-11 09:47:08 +01:00
Bobby Holley
513a75d86a Hoist the rest of css/matching.rs into style/. 2016-01-04 09:41:31 -08:00
Bobby Holley
08f2a24552 Remove the dependency of css/matching.rs on concrete RestyleDamage.
We can make this easier by inlining helper method implementations in the traits themselves,
which makes the code more compact as a nice side-effect.
2016-01-04 09:38:04 -08:00
bors-servo
3f407ea3d6 Auto merge of #9077 - bholley:split_layout_context_etc, r=SimonSapin
Split the style-related bits out of LayoutContext and hoist more stuff into style/

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9077)
<!-- Reviewable:end -->
2015-12-30 11:01:23 +05:30
Bobby Holley
a05d7f1dfd Hoist style-related context bits into style/.
We do a few things-here:
* Hoist non-layout-dependent fields in SharedLayoutData and LocalLayoutData into style/.
* Hoist parts of css/matching.rs into style/.
* Hoist parts of layout/animation.rs into style/animation.rs.
* Remove the duplicated-but-slightly-different definition of OpaqueNode.
2015-12-29 12:07:07 -08:00
Joe Kachmar
655268d111 Separate script and layout messages, issue #8843 2015-12-26 12:24:51 -05:00
Tomas Cernaj
5507be2653 Move ScriptMsg from msg crate into script_traits 2015-12-09 20:50:11 +01:00
Ms2ger
2e40297885 Move from clock_ticks to time.
This is recommended at <https://github.com/tomaka/clock_ticks>.
2015-12-07 11:03:48 -05:00
Patrick Walton
e881f0feeb Write animated values into the ComputedValues structures when
animations complete or are interrupted.

This adds a new pair of reader-writer locks. I measured the performance
of style recalculation on Wikipedia and the overhead of the locks was
not measurable.

Closes #7816.
2015-11-24 19:50:52 -06:00
Keith Yeung
19294db6e5 Split ConstellationMsg into ScriptMsg and CompositorMsg 2015-11-16 23:10:53 -08:00
Hayden Faulds
66b85fe4fc make layout task fields private 2015-11-12 12:42:57 +00:00
Ms2ger
4c3038f378 Pass the constellation_chan to animation::update_animation_state directly. 2015-11-09 09:04:03 +01:00
Ms2ger
c469d09543 Move running_animations from LayoutTaskData to LayoutTask. 2015-11-09 09:04:02 +01:00
Ms2ger
5e4039d328 Move new_animations_receiver from LayoutTaskData to LayoutTask. 2015-11-09 09:03:59 +01:00
Ms2ger
8674345d61 Move LayoutTask::first_reflow out of its Cell.
As the LayoutTask is uniquely owned, and we no longer have borrows of its
fields hanging around, we can use mutable references to simplify some code.
2015-11-09 09:03:52 +01:00
Ms2ger
8fc75704c9 Wrap SharedLayoutContext::new_animations_sender in a Mutex. 2015-11-07 11:23:47 +01:00
Patrick Walton
8d58197bf0 layout: Avoid flooding the compositor with animation state changes if
there are no animations running and no new animations were added.

Avoids compositor jank during scroll.
2015-11-02 16:34:17 -08:00
Patrick Walton
1892b27daf layout: Do a couple of minor style cleanups. 2015-09-27 15:38:22 -07:00
Glenn Watson
f6cb6c3b86 Ensure that animations expire correctly and stop compositing occurring after they finish.
There were two problems here:
(1) The animation state update function was only called when nodes were dirty or there were new animations.
(2) When all animations for a node expired, the entry from the hash table was not removed.

The result was that once an animation began, the compositor would be running as fast as it can forever.

Fixes #7721.
2015-09-24 10:29:58 +10:00
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Simon Sapin
40b4348824 Upgrade to rustc 1.4.0-dev (cb9323ec0 2015-09-01) 2015-09-02 09:22:17 +02:00
João Oliveira
067a22a868 Replace uses of for foo in bar.iter(),
and `for foo in bar.iter_mut(), and for foo in bar.into_iter()
(continuation of #7197)
2015-08-18 01:46:11 +01:00
Josh Matthews
8bb853f643 Fix existing syntactics nits. 2015-08-16 10:30:43 -04:00
João Oliveira
0038580abf Replace uses of for foo in bar.iter() and for foo in bar.iter_mut()
closes #7197
2015-08-15 02:27:39 +01:00
Ms2ger
fdafc5c360 Store a Sender<ConstellationControlMsg> in LayoutTask. 2015-08-12 15:55:16 +02:00
Patrick Walton
7349b6ac28 layout: Tie transitions to the DOM node and finish them instantly when
new styles are set.

Tying transitions to the DOM node avoids quadratic complexity when
updating them.

Finishing transitions instantly when styles are updated makes our
behavior more correct.
2015-08-01 23:01:43 -07:00
Patrick Walton
cac01edf80 style: Switch animation timestamps to be doubles instead of floats.
32-bit floats are not enough to hold timestamps since the epoch and
result in jank.
2015-08-01 17:46:39 -07:00
Simon Sapin
75e3e787f6 Upgrade to rustc 1.3.0-dev (f3b97a74a 2015-07-03) 2015-07-04 11:32:41 +02:00
Manish Goregaokar
94fa868d2b Add unsafe blocks to make_unique
See #6376
2015-06-14 20:52:27 +05:30
Guro Bokum
be2cb665de Start using on_refresh_driver_tick #5681
Final
2015-05-06 02:08:39 +07:00
Simon Sapin
ef8edd4e87 Upgrade to rustc 551a74dddd84cf01440ee84148ebd18bc68bd7c8. 2015-05-05 10:07:34 -04:00
Ms2ger
4d41f1c991 Stop using the deprecated range function. 2015-04-22 20:26:40 +02:00
Joseph Seaton
d843526cb8 Animate many more CSS properties 2015-04-16 17:42:57 +01:00
Patrick Walton
66dd8c8a6c layout: Implement CSS transitions per CSS-TRANSITIONS § 2.
Transition events are not yet supported, and the only animatable
properties are `top`, `right`, `bottom`, and `left`. However, all other
features of transitions are supported. There are no automated tests at
present because I'm not sure how best to test it, but three manual tests
are included.
2015-03-31 08:46:11 -07:00