Use boolean instead of float to avoid nightly warning

This commit is contained in:
Manish Goregaokar 2017-05-16 14:19:38 -07:00
parent a42df6dd30
commit 7f1794bb5c

View file

@ -2197,16 +2197,18 @@ fn append_computed_property_value(keyframe: *mut structs::Keyframe,
} }
} }
enum Offset {
Zero,
One
}
fn fill_in_missing_keyframe_values(all_properties: &[TransitionProperty], fn fill_in_missing_keyframe_values(all_properties: &[TransitionProperty],
timing_function: nsTimingFunctionBorrowed, timing_function: nsTimingFunctionBorrowed,
style: &ComputedValues, style: &ComputedValues,
properties_set_at_offset: &LonghandIdSet, properties_set_at_offset: &LonghandIdSet,
offset: f32, offset: Offset,
keyframes: RawGeckoKeyframeListBorrowedMut, keyframes: RawGeckoKeyframeListBorrowedMut,
shared_lock: &SharedRwLock) { shared_lock: &SharedRwLock) {
debug_assert!(offset == 0. || offset == 1.,
"offset should be 0. or 1.");
let needs_filling = all_properties.iter().any(|ref property| { let needs_filling = all_properties.iter().any(|ref property| {
!properties_set_at_offset.has_transition_property_bit(property) !properties_set_at_offset.has_transition_property_bit(property)
}); });
@ -2217,13 +2219,12 @@ fn fill_in_missing_keyframe_values(all_properties: &[TransitionProperty],
} }
let keyframe = match offset { let keyframe = match offset {
0. => unsafe { Offset::Zero => unsafe {
Gecko_GetOrCreateInitialKeyframe(keyframes, timing_function) Gecko_GetOrCreateInitialKeyframe(keyframes, timing_function)
}, },
1. => unsafe { Offset::One => unsafe {
Gecko_GetOrCreateFinalKeyframe(keyframes, timing_function) Gecko_GetOrCreateFinalKeyframe(keyframes, timing_function)
}, },
_ => unreachable!("offset should be 0. or 1."),
}; };
// Append properties that have not been set at this offset. // Append properties that have not been set at this offset.
@ -2352,7 +2353,7 @@ pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetB
inherited_timing_function, inherited_timing_function,
style, style,
&properties_set_at_start, &properties_set_at_start,
0., Offset::Zero,
keyframes, keyframes,
&global_style_data.shared_lock); &global_style_data.shared_lock);
} }
@ -2361,7 +2362,7 @@ pub extern "C" fn Servo_StyleSet_GetKeyframesForName(raw_data: RawServoStyleSetB
inherited_timing_function, inherited_timing_function,
style, style,
&properties_set_at_end, &properties_set_at_end,
1., Offset::One,
keyframes, keyframes,
&global_style_data.shared_lock); &global_style_data.shared_lock);
} }