mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Auto merge of #18007 - BorisChiou:stylo/animation/interpolation/font_weight, r=xidorn
stylo: Fix the computation of the interpolation of FontWeight. Interpolated result of FontWeight is wrong because clamping code is incorrect. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [Bug 1387948](https://bugzilla.mozilla.org/show_bug.cgi?id=1387948). - [X] These changes do not require tests because Gecko has tests
This commit is contained in:
commit
48b7e6d27c
1 changed files with 1 additions and 1 deletions
|
@ -1421,7 +1421,7 @@ impl Animatable for FontWeight {
|
|||
let b = other.0 as f64;
|
||||
const NORMAL: f64 = 400.;
|
||||
let weight = (a - NORMAL) * self_portion + (b - NORMAL) * other_portion + NORMAL;
|
||||
let weight = (weight.min(100.).max(900.) / 100.).round() * 100.;
|
||||
let weight = (weight.max(100.).min(900.) / 100.).round() * 100.;
|
||||
Ok(FontWeight(weight as u16))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue