Commit graph

64 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
5c70dfab01 Have a concrete SelectorImpl type everywhere in the style crate.
It is conditionally compiled to one implementation or the other
(Gecko or Servo) with `#[cfg(…)]`.
2016-07-20 08:42:46 +02:00
Simon Sapin
4b7060554b Rename ComputedValuesStruct to ComputedValues.
Doing this in a separate commit avoids mixups
with the ComputedValues trait that the previous commit removed.
2016-07-20 08:42:45 +02:00
Simon Sapin
789807b7b0 Remove the ComputedValue traits and style_struct_traits 2016-07-20 08:42:40 +02:00
Ms2ger
e7f9959ad9 Fix a build warning in animation.rs. 2016-07-08 16:44:50 +02:00
Emilio Cobos Álvarez
8ba676533b
style: Fix timing-function overriding from the keyframe declaration list.
The previous behavior is plain wrong, since that array has always at least one
element, so we effectively couldn't specify anything else than "ease" in our
animations.
2016-07-07 16:05:28 -07:00
Emilio Cobos Álvarez
62345ae14d
style: Do not re-expire animations.
If we're restyling a page with animations and layout takes too long, we
might still have the expired animations from the last restyle, without these
being cleared out by layout on `tick_animations`.

Unfortunately it's hard (near to impossible?) to make a reduced test case for
this, since it heavily depends on the speed of the build and conditions that
only happen under heavy loads.

Mainly, it depends on how accurately the `TickAllAnimations` message is sent
from the constellation.

Thus, we can't just re-expire an animation, and we should re-check for it as a
previous animation.

Fixes #12171
2016-07-03 12:19:04 -07:00
bors-servo
a77cc9950f Auto merge of #11972 - emilio:style-thingies, r=bholley
Staticize CASCADE_PROPERTIES, (temporarily) fix stylo path for animations, and introduce the long-term path to follow

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors

<!-- Either: -->
- [x] These changes do not require tests because refactoring + geckolib

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

@bholley: I was going to do this "the good way", but that involves quite a few properties, so I thought I'd rather unlock stylo before :)

r? @bholley

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11972)
<!-- Reviewable:end -->
2016-07-02 13:27:25 -07:00
Emilio Cobos Álvarez
30963dd74d
style: remove is_servo(), as_servo() and as_servo_mut()
This commit adds a need_index prop to the style system, and autogenerates
iterators, and a get_xxx_mod(i) function from a get_xxx_prop() and
get_xxx_at(index) functions.

This allows us to (finally!) take rid of the as_servo() hack. There are a few
unimplemented clones, but I'm just too lazy for that right now.
2016-07-01 14:22:53 -07:00
Emilio Cobos Álvarez
ba53c4ea8d
style: Add a generic way to deal with lists of values, ditch all uses of as_servo in style/animations.rs 2016-07-01 14:22:52 -07:00
Emilio Cobos Álvarez
203d2a62c2
style: Remove the Mutex from new_animations_sender by moving it to the local StyleContext.
As a follow-up, we could move all the data living under a mutex in the
SharedLayoutContext only in order to create the local context to the same place.

This should increase animation performance when there are multiple animations in
one page that happen to be on different threads.
2016-07-01 13:48:06 -07:00
Emilio Cobos Álvarez
bc4e670c5a
style: Add a temporary workaround for geckolib animations.
With needs_borrow we will be able to remove this, though we'll have to implement
clone_ and borrow_ methods for a bunch of properties.
2016-07-01 10:02:14 -07:00
Emilio Cobos Álvarez
793de6dff2
style: Remove an unsound where clause, and don't reset the iteration count on restyle. 2016-06-28 15:27:59 +00:00
Emilio Cobos Álvarez
2d566ef0ef
style: Fix parsing and add generated keyframes 2016-06-28 15:20:59 +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
Emilio Cobos Álvarez
5b27e46d04
style: Atomize animation names. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
0077eb147c
style: Actually animate something!
So this actually allows some more animations to be triggered. The bad part of
this is that they're actually triggered always when the style is recalculated,
so we're going to have at least some more state into the node, and the
constellation, which would have to keep track of the animations states.
2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
f389cf61c4
style: Make animation functions as generic as possible. 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
6a362ae8e8
style: Refactor all the animated properties to use the style system properly 2016-06-28 15:09:53 +00:00
Emilio Cobos Álvarez
60192bb830
style: Refactor to pass animations cleanly, land animation-name parsing as experimental 2016-06-28 15:09:53 +00:00
Ms2ger
79e0d18a1d Add some documentation to the style crate. 2016-06-27 17:33:14 +02:00
Cullen Rhodes
40acd24e8f Report use statements that use {} with only one entry 2016-05-27 10:18:44 +01:00
Cameron McCormack
550d780e17 Move width and height from Box to Position.
This helps with style struct alignment between Servo and Gecko.
2016-05-04 11:06:42 +10:00
Per Lundberg
c7758a8ad8 Removed the T prefix for the style traits
More work as described in #10185.

The reason I upgraded lazy_static to 0.1.16 is because it fixes an issue with the Box name (std::boxed::Box was used in an unqualified name, which can cause name clashes when there is another type that exists with the same name).
2016-04-12 23:02:02 +03:00
Mauricio Collares
c3d6bfc3df Move some CSS properties from Animation to Box and delete Animation 2016-04-05 00:28:19 -03:00
Mauricio Collares
d8222dd63d Move CSS line-height property from InheritedBox to InheritedText 2016-04-05 00:28:18 -03:00
Mauricio Collares
aae8919da4 Move some CSS properties from Box to Position 2016-04-05 00:21:49 -03:00
Mauricio Collares
281e385ab2 Rename PositionOffsets to Position 2016-04-05 00:21:48 -03:00
Mauricio Collares
8c8090b5cd Move CSS text-shadow property from Effects to InheritedText 2016-04-05 00:21:46 -03:00
Per Lundberg
4cb4cc93e4 Renamed TComputedValues to ComputedValues
This is a followup to #10210, and a continuation of #10185.
2016-03-29 23:30:13 +03:00
Per Lundberg
c2ad084713 ComputedValues is now ServoComputedValues
This is the first part of #10185. More to follow. I have built this locally with both servo and geckolib without errors; let's see if it succeeds on all platforms as well.
2016-03-27 10:55:43 +03:00
Bobby Holley
c2daea2c9c Parameterize the rest of the style system on TNode. 2016-03-24 11:50:57 -07:00
Bobby Holley
5c749127cc Introduce traits for style structs and computed values. 2016-03-24 11:49:46 -07:00
Anthony Ramine
09f865919d Move util::bezier to style 2016-02-14 19:45:24 +01:00
Emilio Cobos Álvarez
61e04df266 style: Refactor the per_pseudo map from StyleData to avoid having an option value type.
This make the layout code way clearer.
2016-02-13 16:05:17 +01:00
Bobby Holley
513a75d86a Hoist the rest of css/matching.rs into style/. 2016-01-04 09:41:31 -08:00
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
Tetsuharu OHZEKI
e8c12c1c6d Fix warnings: Use Vec.extend_from_slice instead of Vec.push_all 2015-12-10 16:49:29 -05:00
David Zbarsky
00980ea595 Implement calc expressions for more value types 2015-11-01 23:16:14 -08:00
Glenn Watson
339a3f869b Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
Jaydeep
2a99915188 Check for Extra pointer dereferencing. Issue #7640. 2015-09-26 19:33:29 -07:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Michael Howell
554a4cf9f2 Add transitions for CSS calc().
Closes #7284
2015-09-19 19:39:55 -07: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