Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change conversion to appunit from float of percentage calcuation #102

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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