зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #9341 - Fix to issue 9338 (from askalski:issue9338); r=KiChjang
Fixes #9338. Source-Repo: https://github.com/servo/servo Source-Revision: 8f7f7e11b72a59271c3dccf54d9f4959a6992929
This commit is contained in:
Родитель
dde4fcf0e7
Коммит
db185a6817
|
@ -1927,22 +1927,14 @@ struct StopRun {
|
|||
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 {
|
||||
match position {
|
||||
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::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)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче