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 committed Dec 26, 2024
1 parent 098f1be commit 2e235b1
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 @@ -509,7 +509,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 @@ -522,7 +522,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 2e235b1

Please sign in to comment.