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 all commits
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

@@ -291,7 +291,7 @@ pub trait Flow: HasBaseFlow + fmt::Debug + Sync + Send + 'static {
}

if !self.as_block().fragment.establishes_stacking_context() ||
self.as_block().fragment.style.get_box().transform.0.is_none() {
self.as_block().fragment.style.get_box().transform.0.is_empty() {
overflow.translate(&position.origin.to_vector());
return overflow;
}
@@ -2500,7 +2500,7 @@ impl Fragment {

/// Returns true if this fragment has a filter, transform, or perspective property set.
pub fn has_filter_transform_or_perspective(&self) -> bool {
self.style().get_box().transform.0.is_some() ||
!self.style().get_box().transform.0.is_empty() ||
!self.style().get_effects().filter.0.is_empty() ||
self.style().get_box().perspective != Either::Second(values::None_)
}
@@ -2560,7 +2560,7 @@ impl Fragment {
_ => return self.style().get_position().z_index.integer_or(0),
}

if self.style().get_box().transform.0.is_some() {
if !self.style().get_box().transform.0.is_empty() {
return self.style().get_position().z_index.integer_or(0);
}

@@ -13,7 +13,7 @@ use std::marker::PhantomData;
use std::mem;
use std::ops::{Index, IndexMut};
use std::slice;
use values::computed::{Angle, LengthOrPercentage, Percentage};
use values::computed::{Angle, Length, LengthOrPercentage, Percentage};
use values::specified::url::SpecifiedUrl;

impl nsCSSValue {
@@ -104,7 +104,6 @@ impl nsCSSValue {

/// Returns LengthOrPercentage value.
pub unsafe fn get_lop(&self) -> LengthOrPercentage {
use values::computed::Length;
match self.mUnit {
nsCSSUnit::eCSSUnit_Pixel => {
LengthOrPercentage::Length(Length::new(bindings::Gecko_CSSValue_GetNumber(self)))
@@ -119,6 +118,16 @@ impl nsCSSValue {
}
}

/// Returns Length value.
pub unsafe fn get_length(&self) -> Length {
match self.mUnit {
nsCSSUnit::eCSSUnit_Pixel => {
Length::new(bindings::Gecko_CSSValue_GetNumber(self))
},
x => panic!("The unit should not be {:?}", x),
}
}

fn set_valueless_unit(&mut self, unit: nsCSSUnit) {
debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_Null);
debug_assert!(unit as u32 <= nsCSSUnit::eCSSUnit_DummyInherit as u32, "Not a valueless unit");

Large diffs are not rendered by default.

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.