Commit graph

407 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
8f215a8444
style: Port the style crate to rust 2018.
Differential Revision: https://phabricator.services.mozilla.com/D80101
2020-06-18 23:51:15 +02:00
Emilio Cobos Álvarez
332aec212c style: Miscellaneous servo build fixes. 2020-06-04 01:50:36 +02:00
Martin Robinson
0f1831e2fa Remove AnimatedProperty
This removes an extra layer of abstraction and allows Servo to share
more code with Gecko. In addition, we will need to handle raw
`AnimationValue` structs soon in order to fully implement "faster
reversing of interrupted transitions."
2020-05-13 11:02:52 +02:00
Martin Robinson
fad79a724c Add an iterator for transition properties
This simplifies the code a bit and also will allow us to more easily
make improvements to servo's animation implementation in the future.
2020-04-17 15:11:49 +02:00
Makoto Kato
80a1b64384
style: Part 2. Use Device for parameter instead of CssEnvironment.
CssEnvironment always is in Device, so use Device as parameter instead of CssEnvironment.

Differential Revision: https://phabricator.services.mozilla.com/D52507
2020-02-12 02:43:11 +01:00
Brian Birtles
f6b587051d style: Don't make visibility additive.
As per discussion here: https://github.com/web-platform-tests/wpt/pull/19160

This property type does not have a procedure for addition defined so it should
not be additive.

Differential Revision: https://phabricator.services.mozilla.com/D48454
2019-10-09 13:21:35 +02:00
Simon Sapin
ddb4e369dd Stylo: replace product={gecko,servo} with engine={gecko,servo-2013,servo-2020}
Renaming the variable helped make sure I looked at every use.
2019-07-29 17:37:03 +02:00
Simon Sapin
17ec774a49 Stylo: replace uses of mem::uninitialized with MaybeUninit
MozReview-Commit-ID: KGhYL6DJRaR
2019-07-16 08:03:54 +02:00
Emilio Cobos Álvarez
57868f571f style: Use cbindgen for filters.
Had to implement some OwnedSlice bits that the canvas code used.

Differential Revision: https://phabricator.services.mozilla.com/D31799
2019-06-04 01:03:52 -04:00
Brian Birtles
eba393cc82 Implement Animation.commitStyles.
Differential Revision: https://phabricator.services.mozilla.com/D30327
2019-05-29 16:14:16 +02:00
Emilio Cobos Álvarez
ab8776a144 style: Use OwnedSlice in the specified and computed values of most vector properties.
This is just a refactor in the right direction. Eventual goal is:

 * All inherited properties use ArcSlice<>.
 * All reset properties use OwnedSlice<> (or ThinVec<>).

No conversion happens at all, so we can remove all that glue, and also
compute_iter and co.

Of course there's work to do, but this is a step towards that.

Differential Revision: https://phabricator.services.mozilla.com/D30127
2019-05-29 16:14:07 +02:00
Emilio Cobos Álvarez
6fd17ccb35 style: Implement CSS revert keyword.
The only fishy bit is the animation stuff. In particular, there are two places
where we just mint the revert behavior:

 * When serializing web-animations keyframes (the custom properties stuff in
   declaration_block.rs). That codepath is already not sound and I wanted to
   get rid of it in bug 1501530, but what do I know.

 * When getting an animation value from a property declaration. At that point
   we no longer have the CSS rules that apply to the element to compute the
   right revert value handy. It'd also use the wrong style anyway, I think,
   given the way StyleBuilder::for_animation works.

   We _could_ probably get them out of somewhere, but it seems like a whole lot
   of code reinventing the wheel which is probably not useful, and that Blink
   and WebKit just cannot implement either since they don't have a rule tree,
   so it just doesn't seem worth the churn.

The custom properties code looks a bit different in order to minimize hash
lookups in the common case. FWIW, `revert` for custom properties doesn't seem
very useful either, but oh well.

Differential Revision: https://phabricator.services.mozilla.com/D21877
2019-03-13 15:08:35 +01:00
Emilio Cobos Álvarez
e0b3e5f691 style: Derive more stuff for clip rects.
I feel a bit weird for using LenghtPercentageOrAuto to implement LengthOrAuto,
but I don't think much other code will use it so it seemed a bit better to me.

Differential Revision: https://phabricator.services.mozilla.com/D21863
2019-03-13 15:08:32 +01:00
Boris Chiou
c81e1d82d5 style: Expand the mako code of Matrix3D and move them into transform.rs.
Although the methods of Matrix3D in animated_properties.mako.rs could be
simplified by mako, it's a little bit hard to read because they are far
from the usage and definition. Therefore, we move them to the definition of
computed::Matrix3D and expand the mako.

Differential Revision: https://phabricator.services.mozilla.com/D11961
2018-12-02 14:17:18 -05:00
Boris Chiou
e83f5629ff style: Move the animation code of transform into a different file.
Basically, most of the animation code of transform don't need mako, so
we could move them into values/animated/transform.rs.

However, we still use mako to generate some code to make the methods of
Matrix3D simpler, so I still leave them in animated_properties.mako.rs.

Differential Revision: https://phabricator.services.mozilla.com/D11934
2018-12-02 14:17:17 -05:00
Boris Chiou
8e47e7f134 style: Factor the mako code out from transform functions.
I'm trying to put all the mako code together, so we could move transform
code into a different file.

Differential Revision: https://phabricator.services.mozilla.com/D11933
2018-12-02 14:17:10 -05:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Boris Chiou
0b9ecbccfe
style: Rewrite the interpolation of Rotate to return correct type.
The original implementation always returns Rotate::Rotate3D, but it is
not correct, so we have to rewrite it:
1. If both from value and to value are none, we don't have to convert it
   into identity value, so just return None.
2. If one of the value is none, we replace it with an identity value based on
   the other one's rotate axis.
3. If we only have 2D rotation, we just animate the <angle>.
4. Otherwise, we do interpolation by 3D rotation.

Differential Revision: https://phabricator.services.mozilla.com/D11247
2018-11-17 09:56:00 +01:00
Boris Chiou
c6ead1dc0e
style: Percentage values of translate are serialized as percent for computed values.
Basically, we rewrite the type of generics::transform::Translate and its
ToCss to match the spec. Besides, we always serialize Translate by servo,
so we could drop a lot of duplicated code.

Differential Revision: https://phabricator.services.mozilla.com/D11206
2018-11-10 21:11:36 +01:00
Simon Sapin
e1fcffb336 Use 2018-style paths in code generated by Mako 2018-11-10 17:47:28 +01:00
Boris Chiou
23f2e99e99
style: Fix the default behavior of scale:<number>{1}.
The current spec says: "If only the X value is given, the Y value
defaults to the same value.", so we should update the behavior.

Besides, we also update the serialization, so we serialization both
specified and computed value by servo. We enable the preference
for all the css-transforms, so some of them are passed now.

Differential Revision: https://phabricator.services.mozilla.com/D10638
2018-11-08 15:22:28 +01:00
Emilio Cobos Álvarez
ac6f921588
style: Fix servo build. 2018-11-05 12:44:54 +01:00
Emilio Cobos Álvarez
b7da1bac88
style: Implement the env() function with hardcoded zeros for safe-area-inset.
Intent to Implement and Ship: https://groups.google.com/d/msg/mozilla.dev.platform/EVKyR1B87T0/_l-_qK8SAAAJ

Differential Revision: https://phabricator.services.mozilla.com/D9609
2018-11-05 12:33:16 +01:00
Emilio Cobos Álvarez
c88a483322
style: Move animation of svg-related bits outside of animated_properties.
Being in mako is unnecessary, and makes it harder to debug and such.

Differential Revision: https://phabricator.services.mozilla.com/D10843
2018-11-05 12:32:58 +01:00
Emilio Cobos Álvarez
8b49ef813f
style: Remove nscsspropertyid_is_{animatable,transitionable}.
There are better ways, plus the existing code didn't handle aliases at
all (not that it needed to, but it's better if it does).

Differential Revision: https://phabricator.services.mozilla.com/D10838
2018-11-05 12:32:52 +01:00
Emilio Cobos Álvarez
707bd841a8
style: Move various font-related animation code to its own file.
Similarly, the code is not trivial and doesn't really need to be in
mako.

Differential Revision: https://phabricator.services.mozilla.com/D10842
2018-11-05 12:32:45 +01:00
Emilio Cobos Álvarez
778ae7d745
style: Move various length animation implementations to its own file.
It's nicer, I think.

Differential Revision: https://phabricator.services.mozilla.com/D10841
2018-11-05 12:32:40 +01:00
Emilio Cobos Álvarez
f159c20198
style: Move the keyframes property priority stuff outside of animated_properties.
Similarly, no need to be here.

Differential Revision: https://phabricator.services.mozilla.com/D10840
2018-11-05 12:32:33 +01:00
Emilio Cobos Álvarez
282edf1a13
style: Move shorthand IDL order stuff out of animated_properties.
Doesn't really need to be in a mako file.

Differential Revision: https://phabricator.services.mozilla.com/D10839
2018-11-05 12:32:25 +01:00
Brian Birtles
8bc8a0bfa0
style: Interpolate the angle between mis-matched rotate() functions when the angle of one is zero.
Bug: 1501176
Reviewed-by: hiro
2018-11-05 12:29:52 +01:00
Brian Birtles
990f2c6bb9
style: Compare absolute dot-product to 1.0 when interpolating quaternions.
See the extended commit message for the following spec change:

  6b36d41ebc

Basically, by failing to take the absolute value, for certain content we can end
up doing division by zero which will mean that the test included in this patch
will cause an assertion to fail in debug builds and return
"matrix(NaN, NaN....)" in release builds.

Differential Revision: https://phabricator.services.mozilla.com/D9618
2018-10-28 23:44:04 +01:00
Brian Birtles
fc59165ff3
style: Implement the even more forgiving interpolation rules for transform lists.
As discussed in:

  https://github.com/w3c/csswg-drafts/issues/927

with tentative spec text:

  https://github.com/w3c/csswg-drafts/pull/3215

Differential Revision: https://phabricator.services.mozilla.com/D9185
2018-10-28 23:43:32 +01:00
Boris Chiou
c9d39b2b19
style: Move MozLength and MaxLength into generics.
Move MozLength and MaxLength into generics, and drop the manual implementation
of ToComputedValue.

Differential Revision: https://phabricator.services.mozilla.com/D8291
2018-10-19 00:38:25 +02:00
Cameron McCormack
89e4d6c049
style: Move list of Servo Boxed types to a separate header file.
Differential Revision: https://phabricator.services.mozilla.com/D8652
2018-10-19 00:36:49 +02:00
Emilio Cobos Álvarez
561e9c81f1
style: More useful logging for transition-related stuff.
Transitions are still broken, but I found these messages more helpful than the
previous ones when diagnosing problems.
2018-10-15 14:50:13 +02:00
Emilio Cobos Álvarez
6dcf9b7630
style: Use decomposition to interpolate matched perspective transform operations.
Looks like this produces sensible results for interpolation with 0, though I'm
not really convinced about the results from, let's say, 1px to 2000px in the
attached test-case, I would've expected a linear interpolation from that to go
through normal length interpolation.

css-transforms-1 says:

  > Two transform functions with the same name and the same number of arguments
  > are interpolated numerically without a former conversion. The calculated
  > value will be of the same transform function type with the same number of
  > arguments.
  >
  > Special rules apply to <matrix()>.

Which is what we do... I was going to file a spec issue but turns out that it's
already addressed in css-transforms-2:

  https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions

Which says:

  > The transform functions <matrix()>, matrix3d() and perspective() get
  > converted into 4x4 matrices first and interpolated as defined in section
  > Interpolation of Matrices afterwards.

Differential Revision: https://phabricator.services.mozilla.com/D4942
2018-09-05 19:11:26 +02:00
Nicholas Nethercote
fc9df0bcf3
style: Convert FnvHash{Set,Map} instances to FxHash{Set,Map}.
Bug: 1477628
Reviewed-by: heycam
2018-08-08 01:34:35 +02:00
Emilio Cobos Álvarez
5504cbdfd7
style: Animate logical properties.
The setup is that AnimationValue only contains physical properties, and
we physicalize when building keyframes and transitions.

Bug: 1309752
Reviewed-by: birtles
MozReview-Commit-ID: 9dI20N0LFrk
2018-07-24 03:28:10 +02:00
Dan Glastonbury
a76f5393d4
style: Change nscolor to StyleComplexColor.
Bug: 1467622
Reviewed-by: xidorn
MozReview-Commit-ID: 1bbQzOoOuBe
2018-07-16 19:43:50 +02:00
Emilio Cobos Álvarez
263d4258ea
style: Add a clone helper that works regardless of whether the property is logical.
Bug: 1473793
Reviewed-by: heycam
2018-07-09 03:04:36 +02:00
Emilio Cobos Álvarez
00b42fc6ef
style: Remove some cfgs. 2018-06-23 20:34:10 +02:00
Hiroyuki Ikezoe
238314e606
style: Double f64::EPSILON for calculation error.
It's possible that both this_weight and other_weght have calculation errors
which are approximately equal to f64::EPSILON.

Bug: 1468294
Reviewed-by: birtles
MozReview-Commit-ID: 8OddG9rI3qd
2018-06-18 19:14:46 +02:00
Emilio Cobos Álvarez
ab760033fd
style: Fix servo build. 2018-06-12 12:15:18 -07:00
Emilio Cobos Álvarez
90ef5607e4
style: Move TransitionProperty where it belongs.
Bug: 1419695
Reviewed-by: xidorn
MozReview-Commit-ID: 9PN6VfbDbLA
2018-06-12 12:15:05 -07:00
Emilio Cobos Álvarez
6940787916
style: Make the transition-property code make more sense.
We were working around the lack of alias support during parsing in
TransitionProperty by doing a Gecko lookup. That's a hack and is now gone.

Bug: 1419695
Reviewed-by: xidorn
MozReview-Commit-ID: EptUvJNTrZr
2018-06-12 12:15:04 -07:00
Emilio Cobos Álvarez
92e2adf45f
style: Cleanup transform animation.
Reviewed-by: hiro
But: 1465066
MozReview-Commit-ID: D9rq8CZIgf5
2018-06-02 12:06:22 +02:00
Hiroyuki Ikezoe
378fcc2b6a
style: Implement the smarter interporation for transform.
Corresponding to this spec change;
32812668df

The expected value in test_transitions_per_property.html can be calculated;

  'start' + ('end' - 'start') * 0.25

Bug: 1464647
Reviewed-by: birtles, emilio
MozReview-Commit-ID: NI9gOUuPnG
2018-06-02 12:05:11 +02:00
Emilio Cobos Álvarez
82e97b8ec5
style: The fix: scale and translate appropriately.
Loops are hard. This hasn't been the funniest Saturday evening.

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: I8rfuIRIsrY
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
b199ca864a
style: Move skew and rotation application to their own scope for clarity.
The skew resetting of temp I think fixes a bug in presence of skew in every
direction, but again haven't double-checked.

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: Bn93CoaG8Bu
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
66b8bd2829
style: Cleanup multiply().
We assign all the members, the result matrix doesn't really need to be any clone
of a.

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: 3NkhvyfqQL
2018-05-28 16:02:31 +02:00