Repository navigation
[WebGL] Round fractional character dimensions to the nearest device pixel - #6300
Open
nicolashenry wants to merge 2 commits into
Open
nicolashenry wants to merge 2 commits into
nicolashenry wants to merge 2 commits into
Conversation
…arity test(webgl): add test for rounding fractional character dimensions
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change to round WebGL character dimensions to the nearest device pixel.
No open issues 🎉
What changed in this PR
This PR addresses #6264 by rounding WebGL character dimensions to the nearest device pixel, avoiding the narrower cells caused by flooring fractional widths.
Changes:
- Uses
Math.roundfor both measured character width and height. - Adds a regression test verifying that, at DPR 1, width 6.5 becomes 7 and height 10.4 becomes 10.
| File | Description |
|---|---|
addons/addon-webgl/test/WebglRenderer.test.ts |
Adds fractional-dimension rounding coverage with measurement restoration and page cleanup. |
addons/addon-webgl/src/WebglRenderer.ts |
Replaces width flooring and height ceiling with nearest-pixel rounding. |
Review effort: Balanced
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.
Fixes #6264.
The WebGL renderer floors fractional character widths and ceils character heights when converting CSS dimensions to device pixels. At a device pixel ratio of 1, a measured width of 6.82 CSS pixels becomes 6 device pixels instead of 7.
Round both measured character dimensions to the nearest device pixel.
Adds a regression test using fractional character measurements to verify that width 6.5 rounds to 7 and height 10.4 rounds to 10.
Tests: the new Chromium regression test passes. The full WebGL integration file had 61 passed, 9 skipped, and 1 failure:
#4736(inactive selection background rendered white instead of red).