Bug 264800

Summary: mask-mode breaks mask-size
Product: WebKit Reporter: Alex <alexander>
Component: ImagesAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, sabouhallawa, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari 17   
Hardware: Unspecified   
OS: macOS 14   
URL: https://codepen.io/waterplea/pen/ExrvOWK
See Also: https://github.com/web-platform-tests/wpt/pull/46478
Attachments:
Description Flags
Test none

Description Alex 2023-11-14 00:53:52 PST
When I switch mask-mode to luminance my mask-size: contain no longer works:
https://codepen.io/waterplea/pen/ExrvOWK
Comment 1 Radar WebKit Bug Importer 2023-11-14 08:36:35 PST
<rdar://problem/118396665>
Comment 2 Antoine Quint 2024-03-16 05:01:22 PDT
Created attachment 470396 [details]
Test
Comment 3 Antoine Quint 2024-03-16 14:51:35 PDT
The call to `context.setDrawLuminanceMask(bgLayer.maskMode() == MaskMode::Luminance)` in `BackgroundPainter::paintFillLayer()` causes the sizing issue. Will have to debug what goes on in the GraphicsContext when `BackgroundPainter::drawLuminanceMask()` return true.
Comment 4 Antoine Quint 2024-03-16 14:56:09 PDT
The functions where `BackgroundPainter::drawLuminanceMask()` is involved in this case are `Image::drawTiled()` and `BitmapImage::drawPattern()`.
Comment 5 Antoine Quint 2024-05-22 09:20:12 PDT
The parameters we receive in GraphicsContextCG::drawPattern() look correct.
Comment 6 Antoine Quint 2024-05-22 09:21:28 PDT
This appears to work as expected on a 1x display.
Comment 7 Antoine Quint 2024-05-22 09:29:59 PDT
Actually, zooming in and out of the page using the trackpad affects the way the mask is clipped.
Comment 8 Antoine Quint 2024-05-22 09:53:57 PDT
Actually, the trackpad zoom affecting the rendering only affects ToT and not macOS 14.5. So that's a change in behavior introduced since then which can be bisected.
Comment 9 Antoine Quint 2024-05-22 10:44:33 PDT
The trackpad zoom behavior was caused by 276827@main.
Comment 10 Antoine Quint 2024-05-24 07:51:13 PDT
Pull request: https://github.com/WebKit/WebKit/pull/29053
Comment 11 Antoine Quint 2024-05-24 07:53:49 PDT
Submitted web-platform-tests pull request: https://github.com/web-platform-tests/wpt/pull/46478
Comment 12 EWS 2024-05-25 00:09:04 PDT
Committed 279312@main (2e41b0f5e31e): <https://commits.webkit.org/279312@main>

Reviewed commits have been landed. Closing PR #29053 and removing active labels.