Skip to content

Make NumberOrPercentage and AngleOrNumber getters public. #357

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

Merged
merged 1 commit into from
Sep 1, 2023

Conversation

tiaanl
Copy link
Collaborator

@tiaanl tiaanl commented Aug 31, 2023

Because the structs are public it only make sense to make the getters public as well.

Because the structs are public it only make sense to make the getters
public as well.
@tiaanl tiaanl requested a review from emilio August 31, 2023 12:17
@@ -669,14 +669,17 @@ pub enum NumberOrPercentage {
}

impl NumberOrPercentage {
fn unit_value(&self) -> f32 {
/// Return the value as a percentage.
pub fn unit_value(&self) -> f32 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in the calc() code we call this unitless_value, maybe do the same for consistency?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit_value comes from Token::Percentage { unit_value, .. }. Consistency can go either way here, so without having to swap the two methods around, because unitless value will now be the "other" one, I'd rather keep it as is for now.

@tiaanl tiaanl added this pull request to the merge queue Sep 1, 2023
Merged via the queue into servo:master with commit 9c53e4f Sep 1, 2023
@tiaanl tiaanl deleted the public-getters branch September 1, 2023 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants