Created attachment 375790 [details]
Screenshot of Safari showing the bug
The following example contains an SVG consisting of a JPEG with a luminance mask (also JPEG). Using this technique, images that contain alpha channels can be dramatically reduced in size.
The bug prevents this method to be used in conjunction with animations or layouting (rotation).
When switching between matrix and matrix3d transforms, especially rotation, the SVG mask gets messed up. When applying an identity matrix3d before transforming it, it renders fine. Though, resizing the window after a successful 3D transform, it breaks again.
See this codepen for further explanation and an example:
The attached screenshots show chrome (works) and Safari (fails).
- Always apply an identity matrix3d on elements that should be rotated
- Attach a resize handler to the window
- On resize, stash the element's matrix3d, hide the element, apply transform:none, apply an identity matrix3d, re-apply the element's matrix3d transform
Created attachment 375792 [details]
Screenshot showing chrome rendering correctly
The bug can be reproduced with simple SVG masks which is not necessarily related to images. See the attached reduced test case.
Created attachment 375816 [details]
reduced test case