Commit graph

396 commits

Author SHA1 Message Date
bors-servo
46bb635c4c Auto merge of #16587 - hiikezoe:intermediate-rgba, r=birtles,boris
Introduce intermediate rgba

<!-- Please describe your changes on the following line: -->
This is a PR for https://bugzilla.mozilla.org/show_bug.cgi?id=1356941
---
<!-- 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 it's for stylo.

<!-- 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/16587)
<!-- Reviewable:end -->
2017-04-24 07:22:39 -05:00
Hiroyuki Ikezoe
0ec5a64a71 ComputedDistance for IntermediateTextShadow. 2017-04-24 15:40:30 +09:00
Hiroyuki Ikezoe
46e567e688 Use IntermediateColor for text-shadow. 2017-04-24 15:40:29 +09:00
Hiroyuki Ikezoe
1e9c118f7f ComputedDistance for IntermediateBoxShadow. 2017-04-24 15:40:28 +09:00
Hiroyuki Ikezoe
424e4f9d35 Use IntermediateColor for box-shadow. 2017-04-24 15:40:26 +09:00
Hiroyuki Ikezoe
2d808bf162 Introduce a macro to implement Interpolate trait for box-shadow and text-shadow.
This macro will be used for implementation of intermediate type shadows
as well.  In the case of intermediate types transparent_color will be
IntermediateRGB::transparent().
2017-04-24 15:40:25 +09:00
Hiroyuki Ikezoe
09e728b43d ComputedDistance for IntermediateColor. 2017-04-24 15:40:24 +09:00
Hiroyuki Ikezoe
486578fe74 Use IntermediateColor for caret-color. 2017-04-24 15:40:23 +09:00
Hiroyuki Ikezoe
5834577157 Introduce IntermediateColor to store currentcolor or IntermeditateRGBA. 2017-04-24 15:40:22 +09:00
Hiroyuki Ikezoe
8de605f0dd ComputedDistance for IntermediateRGBA. 2017-04-24 15:40:21 +09:00
Hiroyuki Ikezoe
d70e4aa229 Use IntermediateRGBA to store overflowed RGBA components during interpolation. 2017-04-24 15:40:20 +09:00
Hiroyuki Ikezoe
ce51ff3a9a Check animation_value_type is not 'discrete' instead of 'normal' for ComputeDistance.
We will introduce various new animation_value_type in subsequent patches,
so we should just check 'discrete' type for properties that we can't compute
distance.
2017-04-24 15:23:48 +09:00
Simon Sapin
7fe57ecaea Rename StdoutErrorReporter to RustLogReporter. 2017-04-24 08:23:41 +02:00
Hiroyuki Ikezoe
94fb839fdd Rename animation_type to animation_value_type. 2017-04-24 15:23:39 +09:00
Hiroyuki Ikezoe
1da31f5cf3 Introduce IntermediateRGBA type.
We need to store color values that each components exceeds its normal range
(i.e. [0, 1]) during animation operations (e.g. interpolation). We clamp it
right before we insert animated values into the cascade.
2017-04-24 15:13:59 +09:00
Manish Goregaokar
8bfcc6992e tidy and test fixes 2017-04-21 14:53:27 -07:00
Manish Goregaokar
b0dcb72722 stylo: System font support for keyword font longhands 2017-04-21 14:53:18 -07:00
Manish Goregaokar
c1c4c8fa59 stylo: Add basic system font support, use for font-size and font-family 2017-04-21 14:53:09 -07:00
Boris Chiou
57f87007f2 Bug 1332633 - Part 1: Implement ComputeDistance trait.
Introduce ComputeDistance trait, which implement compute_distance and
compute_squared_distance.

For vector, compute_squared_distance is necessary because we use Euclidean
distance as the distance between two values. The easier way to implement
compute_squared_distance is to square the result from compute_distance, but
for some property values, they may have many components, e.g. (v1, v2, v3).
If we just square the result from compute_distance, the computation is
(sqrt(v1^2 + v2^2 + v3^2))^2. There are two redundant operators:
"square-root" and then "square". In order to avoid this, we should
implement compute_squared_distance separately for these types.

MozReview-Commit-ID: LmmrUXYlDb6
2017-04-21 11:37:57 +08:00
Nazım Can Altınova
f9225d84aa
Implement moz-transform property 2017-04-19 22:11:54 +03:00
Boris Chiou
43f9f8ca95 Bug 1353628 - Part 3: Create PropertyAnimation for shorthands.
Therefore, we can start transitions on shorthand properties properly.

MozReview-Commit-ID: Ev2u2tEalnK
2017-04-19 17:42:44 +08:00
Boris Chiou
a06ce4a6aa Bug 1353628 - Part 1: Add shorthand properties into TransitionProperty.
In order to make TransitionProperty::parse() also work on shorthands, we
should add shorthands into TransitionProperty, and add the arms in other
functions which match TransitionProperty.

MozReview-Commit-ID: KFd26KcQf3N
2017-04-19 17:42:24 +08:00
bors-servo
4d8c9c10cb Auto merge of #16496 - BorisChiou:stylo/transition/trigger, r=heycam
stylo: Bug 1341372 - Detect new transitions and let it run.

These are interdependent patches of Bug 1341372. We let animation-only restyle also work for RESTYLE_CSS_TRANSITIONS, and check if we need to update transitions by each transition property. If it is necessary to create/replace/cancel transitions, we create a SequentialTask for CSS_TRANSITIONS.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix Bug 1341372
- [X] These changes do not require tests because there are tests in Gecko already.

<!-- 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/16496)
<!-- Reviewable:end -->
2017-04-17 05:07:23 -05:00
Boris Chiou
2399cde504 Bug 1341372 - Part 5: Add TransitionProperty::any.
TransitionProperty::any returns true if one of its closure returns true.

MozReview-Commit-ID: 4YsKkHaWCYq
2017-04-17 17:06:37 +08:00
Mantaroh Yoshinaga
48ab03ec91 Make column-count/column-gap/column-width animatable. 2017-04-17 16:26:53 +09:00
Boris Chiou
51ad646c96 Bug 1343753 - Add Servo_Property_IsAnimatable.
MozReview-Commit-ID: 343Md43bpij
2017-04-12 18:32:53 +08:00
Boris Chiou
28db6788b1 Bug 1343753 - Add Servo_Property_IsDiscreteAnimatable.
MozReview-Commit-ID: 5pMw7Wynv2q
2017-04-12 18:32:50 +08:00
Hiroyuki Ikezoe
4ff5a1ef70 Add a tweak to avoid calling interpolate() if animation_type is discrete.
For discrete type of animations, we just need to return 'from' value if
progress is less than 0.5 and otherwise return 'to' value.

https://w3c.github.io/web-animations/#discrete-animation-type
2017-04-07 10:38:33 +09:00
Hiroyuki Ikezoe
97aacb242e Add an FFI function that returns an AnimationValue for a given nsCSSPropertyID from computed values.
When we compose style for a given nsCSSPropertyID in the case where
we have no specified values in target keyframe, we use this AnimationValue
for composition as if it's specified.
2017-04-06 10:30:28 +09:00
Hiroyuki Ikezoe
4516d25889 Make TransitionProperty::from_declaration() convert PropertyDeclaration::{CSSWideKeyword,WithVariables} as well. 2017-04-06 10:08:43 +09:00
Hiroyuki Ikezoe
ec40d1db91 Make AnimationValue::from_declaration return computed CSS variable.
In Gecko, we resolve CSS variables when we generate keyframes for each
animations (i.e. when we create script animations, when we create/update CSS
animations). AnimationValue::from_declaration is only called in both cases.
2017-04-05 09:09:13 +09:00
Emilio Cobos Álvarez
fc72f096a0
style: Properly track whether <angle> or <time> values came from calc() expressions. 2017-03-27 12:42:22 +02:00
bors-servo
8f3f8098c3 Auto merge of #16006 - upsuper:box-ordinal-group, r=Manishearth
Implement -moz-box-ordinal-group property

This PR fixes #16000.

<!-- 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/16006)
<!-- Reviewable:end -->
2017-03-17 15:15:01 -07:00
Xidorn Quan
9233882d49 Switch z-index to use predefined integer type 2017-03-17 23:08:03 +11:00
Xidorn Quan
b489c4ed90 Make Interpolate impl generic for Either 2017-03-17 23:08:00 +11:00
Xidorn Quan
0d556ddbf0 Add a predefined integer type 2017-03-17 23:07:57 +11:00
Hiroyuki Ikezoe
52bee9a4cf Add AnimationValueMap and expose it in FFI.
Current Gecko composes all of effects in the composite order at once.
We can put each computed value into this AnimationValueMap every time composing
an effect.
2017-03-17 12:29:34 +09:00
Bobby Holley
8cf331a498 Rearrange PropertyDeclaration to avoid embedding DeclaredValue.
From https://bugzilla.mozilla.org/show_bug.cgi?id=1347719

This effectively combines the discriminants of the two enums and reduces the
size of PropertyDeclaration by one word.

MozReview-Commit-ID: 9rCRiSVZTQT
2017-03-16 14:40:55 -07:00
Hiroyuki Ikezoe
16cba0876d Pass transition-property into gecko's struct. 2017-03-07 13:27:49 +09:00
austinprete
a2074f2653 Implement parsing/serialization for caret-color 2017-03-05 10:52:32 -07:00
Xidorn Quan
03f6d21cb5 Make DeclaredValue store CSSWideKeyword
Rather than having separate variant for each CSS-wide keyword.
2017-03-02 11:09:05 +11:00
Simon Sapin
0f2d000a23 Borrow input to match_ignore_ascii_case!
In cssparser version 0.11, this macro will stop implicitly borrowing its
own input.
2017-02-26 10:40:09 +01:00
Ethan Glasser-Camp
dd4f331603 Add support for MaxLength
This builds on the ExtremumLength type from the previous commit.
2017-02-24 15:44:49 -05:00
Ethan Glasser-Camp
76de979231 Implement a MinLength type
Implement an ExtremumLength type which contains all the enumerated
keyword values for min-width, min-height, max-width, and
max-height. Then, implement a MinLength which can be used for min-width
and min-height. So far this just maps to Gecko values.

Refs #13821.
2017-02-23 16:28:26 -05:00
bors-servo
af292c4a71 Auto merge of #15682 - upsuper:arc-types, r=Manishearth
Simplify defining arc ffi types

r? @Manishearth

I don't have a good sense for creating syntax... so if you have any suggestion for the syntax of `impl_arc_ffi` macro, it would be appreciated.

<!-- 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/15682)
<!-- Reviewable:end -->
2017-02-22 15:58:35 -08:00
Xidorn Quan
0cac276891 Simplify defining arc ffi types 2017-02-23 10:22:39 +11:00
Hiroyuki Ikezoe
396db281e3 Fill computed property values where the propery is missing in initial and final keyframes.
@keyframes anim {
  from { opacity: 0; transform: none; }
  to { transform: none; }
}

In above case, we have to add opacity property and value in the 'to' keyframe.
2017-02-22 19:04:50 +09:00
Emilio Cobos Álvarez
0c102e2350
style: Unbox a bunch of color properties.
This builds on https://github.com/servo/rust-cssparser/pull/118.
2017-02-14 20:18:31 +01:00
Manish Goregaokar
6b0d3902de Factor out ClipRect type into values; use Either for clip
MozReview-Commit-ID: C3R1erJdiID
2017-02-09 15:09:35 -08:00
Nazım Can Altınova
adb6d20293 Box DeclaredValue::WithVariables 2017-02-09 11:10:10 +01:00