fix: scale CSS transform translate by viewport scale factor - #622
Closed
jerry4718 wants to merge 1 commit into
Closed
fix: scale CSS transform translate by viewport scale factor#622jerry4718 wants to merge 1 commit into
jerry4718 wants to merge 1 commit into
Conversation
CSS transform values (translate, transform-origin) are in CSS pixels and must be multiplied by the viewport scale factor (hidpi_scale * zoom) when rendering to device pixels. Previously only layout positions were scaled while transform matrices were not, causing misalignment between layout coordinates and transformed elements on hidpi screens. Pass the viewport scale into resolve_2d_transform and multiply the translation components (translate property, transform function m41/m42, and transform-origin) by it. Scale factors and rotation angles are unitless and remain unchanged. Test: transform_viewport_scale.rs verifies translate is scaled at hidpi_scale=2 while scale(0.5) is not.
Member
|
Thanks for the PR. AI review found issues with it, and generated #623 as an alternative which should fix your issues without introducing regressions. I've merged that instead. |
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.
CSS transform values (translate, transform-origin) are in CSS pixels and must be multiplied by the viewport scale factor (hidpi_scale * zoom) when rendering to device pixels. Previously only layout positions were scaled while transform matrices were not, causing misalignment between layout coordinates and transformed elements on hidpi screens.
Pass the viewport scale into resolve_2d_transform and multiply the translation components (translate property, transform function m41/m42, and transform-origin) by it. Scale factors and rotation angles are unitless and remain unchanged.
Test: transform_viewport_scale.rs verifies translate is scaled at hidpi_scale=2 while scale(0.5) is not.
WPT results
No changes in test results compared to
main.Generated by the WPT workflow.