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

Reduce the size of AnimationValue code #18414

Merged
merged 3 commits into from Oct 3, 2017
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Remove 5k from AnimationValue::compute_squared_distance.

  • Loading branch information
jdm committed Oct 3, 2017
commit 01c35f99cdd296e65d97199186f0ea0d241a04b5
@@ -568,17 +568,23 @@ impl Animate for AnimationValue {

impl ComputeSquaredDistance for AnimationValue {
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
match *self {
% for i, prop in enumerate([p for p in data.longhands if p.animatable and p.animation_value_type == "discrete"]):
% if i > 0:
|
% endif
AnimationValue::${prop.camel_case}(..)
% endfor
=> return Err(()),
_ => (),
}
match (self, other) {
% for prop in data.longhands:
% if prop.animatable:
% if prop.animation_value_type != "discrete":
(&AnimationValue::${prop.camel_case}(ref this), &AnimationValue::${prop.camel_case}(ref other)) => {
this.compute_squared_distance(other)
},
% else:
(&AnimationValue::${prop.camel_case}(_), &AnimationValue::${prop.camel_case}(_)) => {
Err(())
},
% endif
% endif
% endfor
@@ -40,6 +40,8 @@ packages = [
]
# Files that are ignored for all tidy and lint checks.
files = [
# Mako does not lend itself easily to splitting long lines
"./components/style/properties/helpers/animated_properties.mako.rs",
# Helper macro where actually a pseudo-element per line makes sense.
"./components/style/gecko/non_ts_pseudo_class_list.rs",
# Generated and upstream code combined with our own. Could use cleanup
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.