Repository navigation
Conversation
parse_rgb_channel used ceil(), so rgb(255, 200.09, 90) became 201 and rgb(99% 0% 0%) became 253, while Chrome gives 200 and 252. Round to the nearest integer with halfway values going up, per CSS Values 4. Scale percentages from the parsed value directly so 90% is exactly 229.5. Refs Automattic#2339
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
parse_rgb_channelusesceil(), so non-integer channels always round up:rgb(255, 200.09, 90)gives 201 andrgb(99% 0% 0%)gives 253. Chrome gives 200 and 252. CSS Values 4 says to round to nearest, with halfway values going up.This PR rounds to nearest, and scales percentages from the parsed value directly so
90%is exactly 229.5 → 230. Three existing assertions that expected the old round-up values are updated. New cases cover 127.4, 127.5, 0.2,99%, and the repro from #2339 (decimal parsing itself was fixed in #2398, so #2339 can probably be closed).