Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make transforms generic #18750

Merged
merged 21 commits into from Nov 2, 2017
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
337d48a
Add generic struct for transform
Manishearth Oct 3, 2017
dcefcc3
Add ToComputedValue and ToCss impls
Manishearth Oct 3, 2017
d6525e0
Add specified and computed variants of Transform/TransformOperation
Manishearth Oct 3, 2017
5449898
Add parsing support for transform
Manishearth Oct 3, 2017
5031d14
Use a generic Matrix3D type
Manishearth Oct 3, 2017
2de3464
Add ToAnimatedZero implementation
Manishearth Oct 3, 2017
5ce2966
Add utilities for converting Transform to euclid types
Manishearth Oct 4, 2017
6631594
Replace old transform code with new generic code
Manishearth Oct 4, 2017
079b25d
Share transform function lists between set_transform and clone_transform
Manishearth Oct 4, 2017
fc29de8
Add support for more functions in Gecko glue
Manishearth Oct 6, 2017
e20c508
Add support for 2D matrices in Gecko glue
Manishearth Oct 30, 2017
e156952
Add support for transform functions with an optional final argument i…
Manishearth Oct 30, 2017
aba00be
Add more operations to animation
Manishearth Oct 30, 2017
f699b8c
Handle animating 2D matrices
Manishearth Oct 31, 2017
9c9a181
Allow cross interpolation between differing translate/scale functions
Manishearth Oct 31, 2017
ca02785
Handle case of empty transform lists
Manishearth Oct 31, 2017
5098948
Handle distance calculation of new variants
Manishearth Oct 31, 2017
6415294
Fix unit tests
Manishearth Oct 31, 2017
1c12e0e
Rustfmt the new files
Manishearth Nov 1, 2017
123bc1d
Update test expectations
Manishearth Nov 2, 2017
cb9645c
Comments and minor fixes
Manishearth Nov 2, 2017
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Allow cross interpolation between differing translate/scale functions

See ToPrimitive() in StyleAnimationValue.cpp
  • Loading branch information
Manishearth committed Nov 2, 2017
commit 9c9a181f35280dabb5e089d9ae5df3fab1f6df1f
@@ -1226,7 +1226,12 @@ impl Animate for ComputedTransformOperation {
fd_matrix.animate(&td_matrix, procedure)?,
))
},
// XXXManishearth handle crossover between translate and scale functions
(ref f, ref t) if f.is_translate() && t.is_translate() => {

This comment has been minimized.

@emilio

emilio Nov 2, 2017

Member

Also needs comments, and ideally link to spec.

f.to_translate_3d().animate(&t.to_translate_3d(), procedure)
}
(ref f, ref t) if f.is_scale() && t.is_scale() => {
f.to_scale_3d().animate(&t.to_scale_3d(), procedure)
}
_ => Err(()),
}
}
@@ -706,6 +706,11 @@ impl CSSPixelLength {
pub fn abs(self) -> Self {
CSSPixelLength::new(self.0.abs())
}

/// Zero value
pub fn zero() -> Self {

This comment has been minimized.

@emilio

emilio Nov 2, 2017

Member

This seems totally unused in this patch. I guess it's used somewhere else.

CSSPixelLength::new(0.)
}
}

impl ToCss for CSSPixelLength {
@@ -249,7 +249,6 @@ pub struct Transform<T>(pub Vec<T>);

impl<Angle, Number, Length, Integer, LengthOrNumber, LengthOrPercentage, LoPoNumber>
TransformOperation<Angle, Number, Length, Integer, LengthOrNumber, LengthOrPercentage, LoPoNumber> {

/// Check if it is any translate function
pub fn is_translate(&self) -> bool {
use self::TransformOperation::*;
@@ -10,8 +10,8 @@ use selectors::parser::SelectorParseErrorKind;
use style_traits::{ParseError, StyleParseErrorKind};
use values::computed::{Context, LengthOrPercentage as ComputedLengthOrPercentage};
use values::computed::{Percentage as ComputedPercentage, ToComputedValue};
use values::generics::transform::{Matrix3D, Transform as GenericTransform};
use values::computed::transform::TimingFunction as ComputedTimingFunction;
use values::generics::transform::{Matrix3D, Transform as GenericTransform};
use values::generics::transform::{StepPosition, TimingFunction as GenericTimingFunction, Matrix};
use values::generics::transform::{TimingKeyword, TransformOrigin as GenericTransformOrigin};
use values::generics::transform::TransformOperation as GenericTransformOperation;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.