Skip to content

Commit 2e235b1

Browse files
committed
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 098f1be commit 2e235b1

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
@@ -509,7 +509,7 @@ impl LengthPercentage {
509509
/// Returns the used value.
510510
#[inline]
511511
pub fn to_used_value(&self, containing_length: Au) -> Au {
512-
Au::from(self.to_pixel_length(containing_length))
512+
Au::from_f32_px_truncate(self.to_pixel_length(containing_length).px())
513513
}
514514

515515
/// Returns the used value as CSSPixelLength.
@@ -522,7 +522,7 @@ impl LengthPercentage {
522522
#[inline]
523523
pub fn maybe_to_used_value(&self, container_len: Option<Au>) -> Option<Au> {
524524
self.maybe_percentage_relative_to(container_len.map(Length::from))
525-
.map(Au::from)
525+
.map(|p| Au::from_f32_px_truncate(p.px()))
526526
}
527527

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

0 commit comments

Comments
 (0)