Commit graph

88 commits

Author SHA1 Message Date
Nazım Can Altınova
227737c685 Convert animation-iteration-count longhand into vector_longhand 2017-01-08 17:19:09 +03:00
Nazım Can Altınova
8e21d65303 Convert transition-timing-function longhand into vector_longhand 2017-01-08 17:19:01 +03:00
bors-servo
1d9bbfa07b Auto merge of #14851 - hiikezoe:float-iteration-count-rebased, r=emilio
animation-iteration-count property is a number instead of integer.

<!-- Please describe your changes on the following line: -->
This is a revised PR  for #14732.
@emilio?
---
<!-- 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] There are tests for these changes

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

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14851)
<!-- Reviewable:end -->
2017-01-05 03:44:20 -08:00
Boris Zbarsky
c826b18f87 Bug 1298588 part 10, servo piece. Pass through useful default styles to apply_declarations(). r=bholley 2017-01-04 23:13:48 -05:00
Hiroyuki Ikezoe
f78cd2caf1 animation-iteration-count property is a number instead of integer. 2017-01-05 09:50:10 +09:00
Emilio Cobos Álvarez
56f9a1a55c
style: Document the animations code. 2016-12-31 04:53:38 +01:00
Patrick Walton
ca3d802f03 layout: Minor style cleanup. 2016-11-30 16:36:02 -08:00
Patrick Walton
89dff2d77f layout: Don't restart a transition if the end value for the new
transition is the same as the end value for a running transition per
CSS-TRANSITIONS § 3.

Besides being contrary to spec, the old behavior could cause a cascade
of CSS transitions incorrectly triggering themselves when calls to
`getComputedStyle()` were intermingled with them.

Improves performance of nytimes.com.
2016-11-30 16:36:02 -08:00
Ravi Shankar
c51db9f5f1 Remove usage of keyword_list (and prefer single_keyword) 2016-11-17 23:41:38 +05:30
Emilio Cobos Álvarez
6c3458767b
style: Refactor and add infrastructure for font metrics in style.
This commit itself only moves things around and adds an extra parameter to the
`apply_declarations` function to eventually handle #14079 correctly.

Probably needs a more granular API to query fonts, á la nsFontMetrics, but
that's trivial to do once this is landed.

Then we should make the font provider mandatory, and implement the missing stylo
bits.
2016-11-13 11:54:10 +01:00
Simon Sapin
98bd99b74c rule tree: Remove unsound transmute()
RuleTreeDeclarationsIterator would yield &PropertyDeclaration
with the lifetime of the rule tree, but the reference would only
be valid as long as the iterator was holding the corresponding lock.

The lock would be released when the iterator’s `.next()` method
moves to the next rule tree node, or when  the iterator is dropped.

Also change apply_declaration to not require a `Clone` iterator
(since closures unfortunately don’t implement `Clone`).
Instead have it take a callable that returns a fresh iterator.
2016-11-05 17:29:54 +01:00
Emilio Cobos Álvarez
de4fe6e2b6 Concurrent rule tree, v1
This patch introduces infrastructure for the rule tree, and constructs it.

We don't use it yet, nor have good heuristics for GC'ing it, but this should not
happen anymore once we store the rule node reference in the node.

I haven't messed up with memory orders because I want to do a try run with it,
then mess with them.

Take down the ApplicableDeclarationsCache, use the rule tree for doing the cascade.
2016-11-05 17:29:52 +01:00
Simon Sapin
53b638c0e2 Update to string-cache 0.3 2016-11-03 16:23:05 +01:00
Xidorn Quan
09cbe3bce0 Make style context use parking_lot::RwLock 2016-11-02 10:10:11 +11:00
Patrick Walton
fb2d1e1020 layout: Add a new cascading mode that inherits all properties, even
non-inheritable ones.

This works like the `modify_style_for_*` functions and will allow us to
easily migrate from them to real cascading.
2016-10-26 14:14:01 -07:00
Keith Yeung
668163ec5c Emit TransitionEnd events in the layout thread and process it in the script thread 2016-10-11 19:36:06 -07:00
Simon Sapin
89a29a7f12 Use parking_lot::RwLock instead of DOMRefCell for PropertyDeclarationBlock 2016-10-04 18:34:59 +02:00
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
Simon Sapin
3ce64fd269 Rename DeclarationBlock to ApplicableDeclarationBlock
Make it more different from PropertyDeclarationBlock
2016-09-06 14:17:26 +08:00
Simon Sapin
16bbc2f26e Merge normal and important declarations in style rules.
Have a single Vec instead of two. Fix #3426
2016-08-21 03:40:35 +02:00
Simon Sapin
4062899fd8 Import SelectorMap back from the selectors crate.
Nobody else uses it, and I want to make breaking changes to it.
2016-08-21 03:40:30 +02:00
Emilio Cobos Álvarez
9e88a495c8
style: Introduce a generic way of gathering information from the cascade, and use it for viewport units. 2016-08-16 10:58:16 -07:00
Emilio Cobos Álvarez
6d67525172
style: Refactor TRestyleDamage and TNode to accept/provide a "style source"
In the Gecko case, this style source would be the style context. In the servo
case, it will be always the computed values.

We could optimise this further in the case of stylo (from three FFI calls to
one) if we use an API of the form CalcAndStore(node, new_cv). But that would
imply borrowing the data twice from Servo (we also have borrow_data_unchecked
fwiw, but...).
2016-08-03 13:31:11 -07:00
Michael Howell
6a37877734 Complete animations whether or not cascade is done
Fixes #12554
2016-07-28 11:22:20 -07:00
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