-
Notifications
You must be signed in to change notification settings - Fork 136
Use a more compact RGBA color representation. #118
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
Conversation
This builds on servo/rust-cssparser#118.
This builds on servo/rust-cssparser#118.
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
This builds on servo/rust-cssparser#118.
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
Reviewed 3 of 3 files at r1, 1 of 1 files at r2. Cargo.toml, line 4 at r1 (raw file):
@nox would like this to go after the serde upgrade. So… please find an agreement between you :) src/color.rs, line 18 at r1 (raw file):
Please avoid one-letter names in public APIs src/color.rs, line 33 at r1 (raw file):
The range of unclamped floats that map to 0_u8 or 255_u8 is half of that for other u8 values. I think we can make this more uniform by replacing 255 with 256 and src/color.rs, line 54 at r1 (raw file):
Rename this src/color.rs, line 361 at r1 (raw file):
Remove extra parens here src/color.rs, line 383 at r1 (raw file):
Use src/color.rs, line 394 at r1 (raw file):
Note that only CSS Color Level 3 says this, it was removed in Level 4 which says to clamp. So this comment can be removed. src/tests.rs, line 325 at r1 (raw file):
Use the src/tests.rs, line 400 at r1 (raw file):
Use src/tests.rs, line 407 at r1 (raw file):
Use src/tests.rs, line 65 at r2 (raw file):
I don’t really like this… I’ll look into changing the test data to use 0...255 integers so that Comments from Reviewable |
I can't address the review comments right now (will do tomorrow probably). I wanted to leave a few replies though. Review status: all files reviewed at latest revision, 11 unresolved discussions. Cargo.toml, line 4 at r1 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
We discussed and I'll do the CSSParser rebase if needed :) src/color.rs, line 18 at r1 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
I tend to agree with this, but I think in this case is justified. I think it'd be nice to keep these for the byte access, and the accessors for the float access. See the Servo PR, I thought replacing src/color.rs, line 33 at r1 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
We were using src/color.rs, line 54 at r1 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
See above, happy to concede here, but I'd like you to look at the Servo PR before. src/color.rs, line 361 at r1 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
Sure src/color.rs, line 383 at r1 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
Will update to use src/color.rs, line 394 at r1 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
Will do :) Comments from Reviewable |
Regarding the adjustment of the test error, I can also look at it :) Review status: all files reviewed at latest revision, 11 unresolved discussions. Comments from Reviewable |
Review status: all files reviewed at latest revision, 11 unresolved discussions. src/tests.rs, line 65 at r2 (raw file): Previously, SimonSapin (Simon Sapin) wrote…
After same IEEE 754 wrangling, I managed to make the tests pass: emilio/rust-cssparser@color...servo:u8-color Comments from Reviewable |
This builds on servo/rust-cssparser#118.
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
Review status: all files reviewed at latest revision, 10 unresolved discussions. src/color.rs, line 18 at r1 (raw file): Previously, emilio (Emilio Cobos Álvarez) wrote…
I agree with keeping fields public rather than adding more accessors. It’s the single-letter names that I don’t like. I counted a single occurrence of For the accessors that convert to float, I think the name should show that a conversion is going on. src/color.rs, line 33 at r1 (raw file): Previously, emilio (Emilio Cobos Álvarez) wrote…
I spent some time thinking about this, see the code comment in emilio/rust-cssparser@color...servo:u8-color#diff-7b45540eaa2c29585a26a36f03a754adR369 Comments from Reviewable |
fdedb48
to
cf423f8
Compare
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
Last few changes (including some I forgot in the previous commit): r=me with that applied and a when there’s a green servo try build (to avoid blocking nox too long :)) Reviewed 5 of 5 files at r3. Comments from Reviewable |
Also contains some changes from Simon Sapin <[email protected]>, including fixups and: * Change test data to use 0...255 integers for all color values.
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
Reviewed 4 of 4 files at r4. Comments from Reviewable |
… roundtrips instead of three.
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
Reviewed 2 of 2 files at r5. Comments from Reviewable |
@bors-servo r+ |
📌 Commit 173ef5f has been approved by |
Use a more compact RGBA color representation. r? @SimonSapin <!-- 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/118) <!-- Reviewable:end -->
☀️ Test successful - status-travis |
This builds on servo/rust-cssparser#118.
style: Unbox a bunch of color properties. This builds on servo/rust-cssparser#118. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15518) <!-- Reviewable:end -->
…emilio:color); r=SimonSapin This builds on servo/rust-cssparser#118. Source-Repo: https://github.com/servo/servo Source-Revision: 357bf3b85a1b548ba012f95a97853b34035c89ab --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : af82ad1d14fefde10323d92f1b7ad75768436aec
…emilio:color); r=SimonSapin This builds on servo/rust-cssparser#118. Source-Repo: https://github.com/servo/servo Source-Revision: 357bf3b85a1b548ba012f95a97853b34035c89ab
…emilio:color); r=SimonSapin This builds on servo/rust-cssparser#118. Source-Repo: https://github.com/servo/servo Source-Revision: 357bf3b85a1b548ba012f95a97853b34035c89ab
…emilio:color); r=SimonSapin This builds on servo/rust-cssparser#118. Source-Repo: https://github.com/servo/servo Source-Revision: 357bf3b85a1b548ba012f95a97853b34035c89ab UltraBlame original commit: b7a288e4586f396e7bab629763ca8aa9877a535e
…emilio:color); r=SimonSapin This builds on servo/rust-cssparser#118. Source-Repo: https://github.com/servo/servo Source-Revision: 357bf3b85a1b548ba012f95a97853b34035c89ab UltraBlame original commit: b7a288e4586f396e7bab629763ca8aa9877a535e
…emilio:color); r=SimonSapin This builds on servo/rust-cssparser#118. Source-Repo: https://github.com/servo/servo Source-Revision: 357bf3b85a1b548ba012f95a97853b34035c89ab UltraBlame original commit: b7a288e4586f396e7bab629763ca8aa9877a535e
r? @SimonSapin
This change is