Skip to content

Commit 03a2b8b

Browse files
Asun0204Loirooriol
authored andcommitted
Change conversion from float to appunits of percentage calcuation,
prevent the situation that child box size is calculated too large. Signed-off-by: asun0204 <[email protected]>
1 parent 7e529e8 commit 03a2b8b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

style/values/computed/length_percentage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ impl LengthPercentage {
514514
/// Returns the used value.
515515
#[inline]
516516
pub fn to_used_value(&self, containing_length: Au) -> Au {
517-
Au::from(self.to_pixel_length(containing_length))
517+
Au::from_f32_px_truncate(self.to_pixel_length(containing_length).px())
518518
}
519519

520520
/// Returns the used value as CSSPixelLength.
@@ -527,7 +527,7 @@ impl LengthPercentage {
527527
#[inline]
528528
pub fn maybe_to_used_value(&self, container_len: Option<Au>) -> Option<Au> {
529529
self.maybe_percentage_relative_to(container_len.map(Length::from))
530-
.map(Au::from)
530+
.map(|p| Au::from_f32_px_truncate(p.px()))
531531
}
532532

533533
/// If there are special rules for computing percentages in a value (e.g.

0 commit comments

Comments
 (0)