[css-transforms-1] Correct translation calculation in recomposition of decomposed transform #4446
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.
As far as I can tell, this calculation for recomposing the transform is incorrect.
If you apply the given pseudocode description of decomposing and recomposing to the following matrix:
(where
(t_x, t_y) = (10, 20))Then you'd expect to get back the same matrix (decompose & recompose should be inverse functions).
However, if you follow the specification as given, then I think you get back the following instead:
More generally, you can see that the spec is wrong from inspection.
The decomposition logic does the following:
And nothing changes these
translatevalues after-the-fact.The recomposition logic (before this PR) then does:
Where
mNNare as specified in the decomposition logic.Which, by substitution, could alternatively be stated as:
Which I'm reasonably confident is incorrect.
As far as I can tell, browsers' implementations are more or less correct, but I suspect are correct by not following this specification.
See: https://codepen.io/jlfwong/pen/ZEEedwN. If they used the specified interpolation logic, there would be a sudden change in translation at some point during the transition. Note that the above codepen seems to behave the same in Chrome & Firefox, but differently in Safari.