Skip to content

Commit

Permalink
[fixbug] change conversion to appunit from float of percentage calcua…
Browse files Browse the repository at this point in the history
…tion,

prevent 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 2784f36
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(self.to_pixel_length(containing_length).px().floor())
}

/// 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(p.px().floor()))
}

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

0 comments on commit 2784f36

Please sign in to comment.