Rollup merge of #16939 - Manishearth:bool, r=nox

Use boolean instead of float to avoid nightly warning

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16939)
<!-- Reviewable:end -->
This commit is contained in:
Anthony Ramine 2017-05-23 14:14:15 +02:00 committed by GitHub
commit 46099db015

View file

@ -2432,16 +2432,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)
}); });
@ -2452,13 +2454,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.
@ -2587,7 +2588,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);
} }
@ -2596,7 +2597,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);
} }