Bug 271457 - Incorrect clipping of elements on Shopify page
Summary: Incorrect clipping of elements on Shopify page
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Compositing (show other bugs)
Version: Safari 17
Hardware: Mac (Apple Silicon) Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2024-03-22 03:03 PDT by mic.gallego
Modified: 2024-03-26 20:17 PDT (History)
6 users (show)

See Also:


Attachments
Issue (590.38 KB, image/png)
2024-03-22 03:03 PDT, mic.gallego
no flags Details
Reduction (494 bytes, text/html)
2024-03-26 18:08 PDT, Simon Fraser (smfr)
no flags Details
Reduction (497 bytes, text/html)
2024-03-26 18:13 PDT, Simon Fraser (smfr)
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description mic.gallego 2024-03-22 03:03:25 PDT
Created attachment 470481 [details]
Issue

Hello,

I am experiencing another very odd issue with Safari on animations. The issue is not reproducible on Firefox nor Chrome. I have been unable to re-create a minimal example so it might be a combination of factors.

The issue is reproducible on Safari 16.5, 17.4 and TP.

To reproduce the issue, you need to use this page: https://stretch-theme-dev.myshopify.com
Enter into the store using the password rewblo

To reproduce the issue, click on the "Catalog" link in the header to open a dropdown menu. The code uses an animation to reveal the menu, and commit the final styles (opacity: 1). However, on Safari only, the menu completely disappears once the animation has ended, despite the style being properly applied on the element (see attached screenshot).

The only way I have found to solve the issue is by adding a `will-change: transform` on the element, but this seems like an odd fix.

Thanks.
Comment 1 mic.gallego 2024-03-22 03:39:17 PDT
I've been able to find the code causing the issue. It is actually the overflow-x: clip being applied on the "shopify-section" class. I am not sure though why this style prevent the animation to work correctly.
Comment 2 Simon Fraser (smfr) 2024-03-22 09:33:17 PDT
I have a hunch about what this might be (related to bug 266926).
Comment 3 Radar WebKit Bug Importer 2024-03-22 09:33:36 PDT
<rdar://problem/125239811>
Comment 4 mic.gallego 2024-03-25 00:39:40 PDT
Hello,

In order to continue our development we had to remove the code that caused the issue on Safari so you won't be able to reproduce it on the URL I gave.

To reproduce the issue again, please add the following code:

.shopify-section {
  overflow-x: clip;
}

This will allow to trigger again the issue explained in this ticket.
Comment 5 Simon Fraser (smfr) 2024-03-26 18:08:20 PDT
Created attachment 470616 [details]
Reduction

This is about `overflow-x: clip` also clipping in the Y axis in a compositing layer.
Comment 6 Simon Fraser (smfr) 2024-03-26 18:13:35 PDT
Created attachment 470617 [details]
Reduction
Comment 7 Simon Fraser (smfr) 2024-03-26 18:36:14 PDT
In `RenderLayer::calculateLayerBounds()` we hit the `UseLocalClipRectIfPossible` code path.

RenderLayer::clipRectRelativeToAncestor() calls `calculateRects()` which does the right thing for foregroundRect, but doesn't extend in Y for the backgroundRect.
Comment 8 Simon Fraser (smfr) 2024-03-26 18:52:55 PDT
I need to study foreground and background clip rects, first introduced in https://commits.webkit.org/4548@main