mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Auto merge of #9341 - askalski:issue9338, r=KiChjang
Fix to issue 9338 Fixes #9338. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9341) <!-- Reviewable:end -->
This commit is contained in:
commit
8f7f7e11b7
1 changed files with 2 additions and 10 deletions
|
@ -1927,22 +1927,14 @@ struct StopRun {
|
||||||
stop_count: usize,
|
stop_count: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn fmin(a: f32, b: f32) -> f32 {
|
|
||||||
if a < b {
|
|
||||||
a
|
|
||||||
} else {
|
|
||||||
b
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn position_to_offset(position: LengthOrPercentage, Au(total_length): Au) -> f32 {
|
fn position_to_offset(position: LengthOrPercentage, Au(total_length): Au) -> f32 {
|
||||||
match position {
|
match position {
|
||||||
LengthOrPercentage::Length(Au(length)) => {
|
LengthOrPercentage::Length(Au(length)) => {
|
||||||
fmin(1.0, (length as f32) / (total_length as f32))
|
(1.0f32).min(length as f32 / total_length as f32)
|
||||||
}
|
}
|
||||||
LengthOrPercentage::Percentage(percentage) => percentage as f32,
|
LengthOrPercentage::Percentage(percentage) => percentage as f32,
|
||||||
LengthOrPercentage::Calc(calc) =>
|
LengthOrPercentage::Calc(calc) =>
|
||||||
fmin(1.0, calc.percentage() + (calc.length().0 as f32) / (total_length as f32)),
|
(1.0f32).min(calc.percentage() + (calc.length().0 as f32) / (total_length as f32)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue