Skip to content

Commit

Permalink
Change conversion from float to appunits of percentage calcuation,
Browse files Browse the repository at this point in the history
prevent the situation that child box size is calculated too large.

Signed-off-by: asun0204 <[email protected]>
  • Loading branch information
Asun0204 authored and Loirooriol committed Jan 8, 2025
1 parent 7e529e8 commit 03a2b8b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions style/values/computed/length_percentage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ impl LengthPercentage {
/// Returns the used value.
#[inline]
pub fn to_used_value(&self, containing_length: Au) -> Au {
Au::from(self.to_pixel_length(containing_length))
Au::from_f32_px_truncate(self.to_pixel_length(containing_length).px())
}

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

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

0 comments on commit 03a2b8b

Please sign in to comment.