Commit graph

264 commits

Author SHA1 Message Date
Mantaroh Yoshinaga
c89c938623 Add get_zero_value for IntermediateSVGPaint. 2017-06-23 10:32:50 +09:00
Simon Sapin
837cb6ddb2 Pass some 48-bytes closures by references instead of by value. 2017-06-22 02:02:31 +02:00
Hiroyuki Ikezoe
6c69771ea5 Use FnvHashmap instead of HashMap for AnimationValueMap. 2017-06-21 08:36:48 +09:00
Anthony Ramine
6f4061d4ad Use generics for the filter property
This introduces an additional shadow type for drop-shadow().
2017-06-20 13:48:53 +02:00
Mantaroh Yoshinaga
b9f6994dcc Add compute distance for Filter. 2017-06-19 09:47:26 +09:00
Mantaroh Yoshinaga
87e580a33d Make filter property animatable. 2017-06-19 09:47:26 +09:00
Mantaroh Yoshinaga
ccf08bcead Preserve the unit when interpolating/adding angles with matching units.
If the units of two angles being interpolated/added matches, we should preserve
the original unit; otherwise, we fall back to radians. This matches the behavior
of Gecko.
2017-06-19 09:47:26 +09:00
Simon Sapin
a5bb55790f Untry style 2017-06-18 13:18:13 +02:00
Anthony Ramine
608e7f71a2 Make computed types hold Percentage instead of bare CSSFloat 2017-06-15 16:59:03 +02:00
Anthony Ramine
ad79a19587 Derive ToCss for TransitionProperty 2017-06-15 13:08:31 +02:00
Anthony Ramine
51a4481388 Use CustomIdent for transition-property 2017-06-15 13:03:23 +02:00
Brian Birtles
d249c61c0d Add IsTransitionable FFI 2017-06-15 10:20:46 +09:00
Brian Birtles
479c3e4528 Move nscssproperty_id_is_animatable together with the other animatable-related code
Now we have AnimatableLonghand (to do with animatability) and
TransitionProperty (to do with transitionability), we should move
nscssproperty_id_is_animatable to be part of the former group.
2017-06-15 10:20:16 +09:00
Brian Birtles
e74f7792f5 Make TransitionProperty treat all properties that are not transitionable as unsupported
Currently properties that are discretely animated cannot be
transitioned. Now that TransitionProperty should only be used for
transitions, we can redefine it to treat non-transitionable properties
as unsupported. This should allow us to simplify the code and make it
more self-documenting (e.g. making TransitionProperty actually relate to
transitions).
2017-06-15 10:19:48 +09:00
Brian Birtles
5ce7b1cc55 Move is_discrete from TransitionProperty to AnimatableLonghand 2017-06-15 10:19:22 +09:00
Brian Birtles
a2307adf46 Convert AnimationValue::from_computed_values to take an AnimatableLonghand 2017-06-15 10:18:55 +09:00
Brian Birtles
8f3dad598f Use AnimatableLonghand for AnimationValueMap and related code
In the next few patches we move all non-transition related code over to
using AnimatableLonghand instead of TransitionProperty. This will allow
us to re-purpose TransitionProperty to represent only properties that
can be transitioned (i.e. excluding discrete properties) as well as
simplifying the code by removing the need to deal with shorthands and
the "all" value in places that do not need to handle those values.
2017-06-15 10:18:18 +09:00
Brian Birtles
9c3c954aa2 Introduce AnimatableLonghand type
This type, which we will use in the next patch in this series, can
represent only longhands whose animation type is not "none". By
introducing this type, we can later restrict the meaning of
TransitionProperty to only cover properties whose animation type is not
"none" OR "discrete" (since currently CSS transitions should not animate
properties whose animation type is discrete).  Doing so will also mean
that CSS transitions ignore the 'display' property by default.

Furthermore, introducing this type will allow the animation code to
clearly document when a property is allowed to be a shorthand or
unanimatable property and when it is expected to be an animatable
longhand. This, in turn, will allow us to remove a few
no-longer-necessary checks and simplify the code.
2017-06-15 10:13:04 +09:00
Brian Birtles
c1bf6d3efc Only include shorthands with at least one animatable component in TransitionProperty
This allows simplifying the code somewhat and means we can ignore
unanimated shorthands a little sooner. Furthermore, it removes the odd
inconsistency where TransitionProperty only included animatable
longhands but allowed all shorthands regardless of whether or not they
were animatable.
2017-06-15 10:12:03 +09:00
Brian Birtles
09c2b1b930 Move definition of animatable for shorthands to Shorthand object
By moving this definition to the Shorthand object we can more easily
re-use it in subsequent patches in this series.
2017-06-15 10:11:34 +09:00
Mantaroh Yoshinaga
95b272d9aa Return zero when computing distance of Option with both value is none. 2017-06-14 11:03:53 +09:00
Anthony Ramine
f658215f12 Fix Animatable impl for LengthOrPercentageOrNone 2017-06-13 10:19:23 +02:00
Josh Matthews
27ae1ef2e7 Thread ParseError return values through CSS parsing. 2017-06-09 16:46:25 -04:00
Josh Matthews
3773a4d499 Encapsulate CSS error reporter creation for stylo. 2017-06-09 13:16:38 -04:00
Hiroyuki Ikezoe
c1ec6f6913 nscsspropertyid_is_animatable handles shorthand property as well.
We consider the shorthand animatable if any of sub properties are animatable.
2017-06-09 07:03:18 +09:00
Xidorn Quan
c62935577a Add separate computed Color value. 2017-06-08 12:59:26 +10:00
Xidorn Quan
bf77f81ed6 Create RGBAColor for colors compute to RGBA. 2017-06-08 10:42:26 +10:00
bors-servo
f4a720483d Auto merge of #17202 - BorisChiou:stylo/animation/mismatched_transform, r=Manishearth,birtles
stylo: Bug 1335998 - Handle interpolation and accumulation of mismatched transform lists

These are the interdependent patches of Bug 1335998. We want to do interpolation and accumulation for mismatched transform lists, so introduce ComputedOperation::InterpolateMatrix and ComputedOperation::Accumulation. Both arms store the from_list and to_list, and resolve them until we have the layout information. For the Servo part, we haven't implemented how to read the transform lists in layout/fragment.rs, but I think it would be easy. (related issue #13267)

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix [Bug 1335998](https://bugzilla.mozilla.org/show_bug.cgi?id=1335998)
- [X] There are tests for these changes

<!-- 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/17202)
<!-- Reviewable:end -->
2017-06-06 23:54:41 -07:00
Boris Chiou
1d44c273d3 Implement an FFI and matrix conversions for matrix decomposition/interpolation/recomposition.
We use Servo backend to decompose/interpolate/recompose matrices on both
main thread and compositor thread.
2017-06-07 13:04:05 +08:00
Xidorn Quan
3e47e6eab2 Make text-shadow reuse Shadow directly. 2017-06-07 13:32:17 +10:00
Boris Chiou
313f7d86db Define ComputedOperation::AccmulateMatrix.
If we set the composite operation to accumulate, we may need to accumulate two
mismatched transform lists, and then to interpolate them. In order to
accumulate two mismatched transform lists, we also need the reference
box information, so use the same idea as that for interpolation. i.e.
use AccmulateMatrix to store it temporarily, and convert it into matrix
later.
2017-06-07 11:31:01 +08:00
Boris Chiou
a6099d0fc0 Define ComputedOperation::InterpolateMatrix.
We use this arm to store the interpolated result of two mismatched
transform lists, and we resolve it until we know the reference box size
(on Gecko side). The conversion from ComputedOperation::InterpolateMatrix
to eCSSKeyword_interpolatematrix will be implemented later in this patch series.
2017-06-07 11:30:39 +08:00
Anthony Ramine
65356b13f8 Use predefined_type for transition-property 2017-06-06 14:35:58 +02:00
Manish Goregaokar
9aad71d74f stylo: Make SVGPaint and SVGPaintKind animatable 2017-06-05 23:25:55 -07:00
Brian Birtles
e48f94cbda Don't introduce calc() when interpolating between length and percentages if either side is zero
Without this patch anim-css-strokewidth-1-by-pct-pct.svg (and possibly
others) fails because we calculate the result as 'calc(0px + 10%)' and
we don't support calc on stroke-width (yet) so the rendered result is
incorrect.

As a more thorough fix, we should make the zero-value for
LengthOrPercentageOrNumber a zero *number* (instead of a zero length)
but that won't work yet since we don't support animating between
stroke-widths with units and those that don't (see
https://bugzilla.mozilla.org/show_bug.cgi?id=1369614). Regardless of
that, we still shouldn't introduce calc in order to add a zero value
using the LengthOrPercentage type, so this change is still needed.
2017-06-05 12:49:32 +09:00
Brian Birtles
00cdced2ca Add get_zero_value to Animatable trait 2017-06-05 12:49:31 +09:00
Xidorn Quan
61eb7e055f Use animation_value_type in AnimatedProperty.
So that we can remove redundant interpolation code for corresponding
computed types.
2017-06-05 11:23:18 +10:00
Xidorn Quan
0ef3a23313 Use move for conversion between animatable value and computed types. 2017-06-05 10:33:50 +10:00
Anthony Ramine
5c6987a50d Use generics for the line-height property 2017-06-02 10:21:21 +02:00
bors-servo
433d68955b Auto merge of #17071 - servo:derive-all-the-things, r=emilio
Reuse Rect<T> some more

<!-- 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/17071)
<!-- Reviewable:end -->
2017-05-30 05:11:28 -05:00
daisuke
d0cf7d65f0 Implements background related discrete animatable properties 2017-05-29 16:09:20 +09:00
Anthony Ramine
862fc4f88d Rename BorderRadiusSize to BorderCornerSize 2017-05-29 00:58:53 +02:00
Anthony Ramine
af3ede418b Refactor BorderRadius and move it to the border modules
BorderRadius now parses itself reusing Rect<T>.
2017-05-28 14:36:37 +02:00
Manish Goregaokar
709912bcd3 Rollup merge of #17013 - mbrubeck:stylo, r=emilio
Bug 1363639 - stylo: Make interpolation of rect() match Gecko

<!-- 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/17013)
<!-- Reviewable:end -->
2017-05-24 11:59:27 -07:00
Brian Birtles
4d187524c6 Support addition of font-stretch
Although there are no specific tests for this yet if any code does try
to perform addition or accumulation with a font-stretch value it will
likely fail the bounds check in the Into trait. To avoid that this
patch provides an basic implementation of add_weighted for font-stretch
that should work correctly with portions whose sum is outside the [0.0,
1.0] range.
2017-05-24 11:08:51 +09:00
Brian Birtles
d45ee9d662 Support accumulation of transform lists 2017-05-24 11:08:50 +09:00
Brian Birtles
64b0d59d21 Define accumulate method on Animatable trait 2017-05-24 11:08:50 +09:00
Matt Brubeck
a8cce41ba9 Bug 1363639 - stylo: Make interpolation of rect() match Gecko 2017-05-23 17:28:52 -07:00
Hiroyuki Ikezoe
57c27e5d35 Rename MinLength to MozLength.
So that we can reuse this for non-min-prefixed properties (e.g. width).
2017-05-21 08:33:12 +09:00
Hiroyuki Ikezoe
95bda2dff9 Combine LengthOrPercentage and Auto into LengthOrPercentageOrAuto for {Min,Max}Length. 2017-05-21 08:33:12 +09:00