Skip to content

Use Gecko's behavior for calculating percent colors #142

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
May 11, 2017

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented May 4, 2017

@Manishearth
Copy link
Member Author

r? @SimonSapin

@Manishearth Manishearth force-pushed the pc-color branch 3 times, most recently from 74b8701 to 3f76d1f Compare May 4, 2017 22:47
@emilio
Copy link
Member

emilio commented May 5, 2017

Needs tests update.

@Manishearth
Copy link
Member Author

Gecko also computes rgb(254.5, 254.6, 254.4) as rgb(254, 254, 254), i.e. it rounds float colors down. It's really nonsensical to specify float colors anyway but I made us match Gecko here too.

@Manishearth Manishearth force-pushed the pc-color branch 3 times, most recently from 2652b52 to 49a2e63 Compare May 9, 2017 19:16
@Manishearth
Copy link
Member Author

(tests updated)

@SimonSapin
Copy link
Member

It's really nonsensical to specify float colors anyway

Only in impls that store components as u8 :) I’m told that Safari uses f64. (They support high-gamut displays where 8 bits is insufficient. I don’t know if 64 useful or excessive.)


Reviewed 5 of 5 files at r1.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


src/color.rs, line 406 at r1 (raw file):

}

fn clamp_256_f32(val: f32) -> u8 {

Maybe this function should be renamed now?


Comments from Reviewable

@SimonSapin
Copy link
Member

r=me with that

@Manishearth
Copy link
Member Author

@bors-servo r=SimonSapin

@bors-servo
Copy link
Contributor

📌 Commit 43162c1 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

⌛ Testing commit 43162c1 with merge 1ea913d...

bors-servo pushed a commit that referenced this pull request May 11, 2017
Use Gecko's behavior for calculating percent colors

https://bugzilla.mozilla.org/show_bug.cgi?id=1340484

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/142)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-travis
Approved by: SimonSapin
Pushing 1ea913d to master...

@bors-servo bors-servo merged commit 43162c1 into servo:master May 11, 2017
@Manishearth Manishearth deleted the pc-color branch May 11, 2017 19:14
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.

4 participants