-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix issues with nested gradients in html renderer. #31887
Conversation
flutter/flutter#99045 The DOM canvas does need to be able to handle gradient shaders, since if we are inside of a context that is affected by an SVG filter we can't fall back to the using canvas. This is because webkit doesn't apply the SVG filters to canvas elements for some reason. In these situations, just do a full GL render of the gradient and apply it as the background image on the DOM element.
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
Gold has detected about 1 new digest(s) on patchset 2. |
Gold has detected about 1 new digest(s) on patchset 3. |
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EngineImageShader imageShader) { | ||
final HtmlImage image = imageShader.image; | ||
targetElement.style.backgroundImage = image.imgElement.src; | ||
String _getBackgroundImage(ui.Shader? shader, ui.Rect bounds) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: _getBackgroundImageCssUrl
might be a better function name (since it's not returning the image, only the URL, albeit formatted to CSS' liking).
Gold has detected about 1 new digest(s) on patchset 4. |
Gold has detected about 1 new digest(s) on patchset 5. |
Gold has detected about 18 new digest(s) on patchset 6. |
Golden file changes are available for triage from new commit, Click here to view. |
* 09d7bcc Optionally specify the target dir in tools/gn (flutter/engine#32065) * a00ba24 Fix done button click not blur in iOS keyboard (flutter/engine#31718) * 81547d1 Add a display list op to clear to transformation stack. (flutter/engine#32050) * 2309bcc Add WASM target in gn (flutter/engine#31670) * 852e800 [web] Remove the --passfail flag when calling goldctl in post-submit (flutter/engine#32071) * eb1c50d Fix issues with nested gradients in html renderer. (flutter/engine#31887) * fb0fd74 Update the magic number for JPEG to just FF D8 FF. (flutter/engine#32076) * 233c17c Wrap the global timeline event handler callback in a std::atomic (flutter/engine#32073) * dfde2aa Roll Dart SDK from 24bf86f16411 to 5bc905e69609 (9 revisions) (flutter/engine#32075)
flutter/flutter#99045
The DOM canvas does need to be able to handle gradient shaders, since if we are
inside of a context that is affected by an SVG filter we can't fall back to the
using canvas. This is because webkit doesn't apply the SVG filters to canvas
elements for some reason. In these situations, just do a full GL render of the
gradient and apply it as the background image on the DOM element.