-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Fix shadow rendering using boxshadow due to webkit repaint area bug #23769
Conversation
…hen using filter CSS attribute
yjbanov
left a comment
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.
| /// Returns a color for box-shadow based on blur filter at sigma. | ||
| ui.Color blurColor(ui.Color color, double sigma) { | ||
| final double strength = math.max(math.min( | ||
| math.sqrt(sigma) / (math.pi * 2.0), 1.0), 0.0); |
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.
Do we need math.max? Presumably sigma is >= 0, and so math.min(math.sqrt(sigma) / (math.pi * 2.0), 1.0) is also >= 0.
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.
Thx. Done.
| } | ||
| await canvasScreenshot(rc, 'dom_mask_filter_blur', | ||
| region: screenRect, | ||
| maxDiffRatePercent: 0.01); |
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.
Why not 0 diff rate?
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.
blur & gradients typically are slightly off between mac and linux.

Description
Webkit fails to repaint correct area when filter: blur is used on a dom node.
This PR switches Dom rendering of blurred rectangles to use box shadow instead for webkit.
Related Issues
flutter/flutter#71835
Tests
Added dom_mask_filter test.
Pre-launch Checklist
writing and running engine tests.
///).