Skip to content

Make NumberOrPercentage and AngleOrNumber getters public.#357

Merged
tiaanl merged 1 commit intoservo:masterfrom
tiaanl:public-getters
Sep 1, 2023
Merged

Make NumberOrPercentage and AngleOrNumber getters public.#357
tiaanl merged 1 commit intoservo:masterfrom
tiaanl:public-getters

Conversation

@tiaanl
Copy link
Copy Markdown
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
Comment thread src/color.rs
impl NumberOrPercentage {
fn unit_value(&self) -> f32 {
/// Return the value as a percentage.
pub fn unit_value(&self) -> f32 {
Copy link
Copy Markdown
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
Copy Markdown
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