mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Auto merge of #18081 - hiikezoe:interpolation-with-auto, r=birtles,boris,mantaroh
Fix interpolation between auto and other values <!-- Please describe your changes on the following line: --> https://bugzilla.mozilla.org/show_bug.cgi?id=1387939 --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- 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/18081) <!-- Reviewable:end -->
This commit is contained in:
commit
87c872a7f7
4 changed files with 11 additions and 10 deletions
|
@ -5434,10 +5434,10 @@ clip-path
|
|||
${impl_simple_copy('column_count', 'mColumnCount')}
|
||||
|
||||
pub fn clone_column_count(&self) -> longhands::column_count::computed_value::T {
|
||||
use gecko_bindings::structs::NS_STYLE_COLUMN_COUNT_AUTO;
|
||||
use gecko_bindings::structs::{NS_STYLE_COLUMN_COUNT_AUTO, nsStyleColumn_kMaxColumnCount};
|
||||
if self.gecko.mColumnCount != NS_STYLE_COLUMN_COUNT_AUTO {
|
||||
debug_assert!((self.gecko.mColumnCount as i32) >= 0 &&
|
||||
(self.gecko.mColumnCount as i32) < i32::max_value());
|
||||
debug_assert!(self.gecko.mColumnCount >= 1 &&
|
||||
self.gecko.mColumnCount <= nsStyleColumn_kMaxColumnCount);
|
||||
Either::First((self.gecko.mColumnCount as i32).into())
|
||||
} else {
|
||||
Either::Second(Auto)
|
||||
|
|
|
@ -863,7 +863,7 @@ impl Animatable for f64 {
|
|||
impl Animatable for i32 {
|
||||
#[inline]
|
||||
fn add_weighted(&self, other: &i32, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
|
||||
Ok((*self as f64 * self_portion + *other as f64 * other_portion).round() as i32)
|
||||
Ok((*self as f64 * self_portion + *other as f64 * other_portion + 0.5).floor() as i32)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2410,10 +2410,7 @@ impl<T, U> Animatable for Either<T, U>
|
|||
(Either::Second(ref this), Either::Second(ref other)) => {
|
||||
this.add_weighted(&other, self_portion, other_portion).map(Either::Second)
|
||||
},
|
||||
_ => {
|
||||
let result = if self_portion > other_portion {*self} else {*other};
|
||||
Ok(result)
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue