Bug 237898 - REGRESSION (r282737): `text-shadow` is clipped
Summary: REGRESSION (r282737): `text-shadow` is clipped
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 15
Hardware: Unspecified macOS 12
: P2 Major
Assignee: zalan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-03-15 09:12 PDT by Benoît Rouleau
Modified: 2022-05-16 15:40 PDT (History)
13 users (show)

See Also:


Attachments
slightly more visible (test reduction) (347 bytes, text/html)
2022-03-15 13:03 PDT, zalan
no flags Details
Patch (5.97 KB, patch)
2022-03-15 16:31 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (5.97 KB, patch)
2022-03-15 16:39 PDT, zalan
no flags Details | Formatted Diff | Diff
Patch (5.43 KB, patch)
2022-03-15 18:47 PDT, zalan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benoît Rouleau 2022-03-15 09:12:21 PDT
In Safari 15.4, the `text-shadow` of an element can be clipped when an absolute-positioned element with `will-change: transform` appears behind it.

This worked fine in Safari 15.3, and continues to work fine in other browsers.

Simple reproduction here: https://codepen.io/benface/pen/yLpNpeG
Comment 1 Radar WebKit Bug Importer 2022-03-15 11:52:41 PDT
<rdar://problem/90320701>
Comment 2 zalan 2022-03-15 12:50:18 PDT
This has regressed at r282737.
Comment 3 zalan 2022-03-15 13:03:42 PDT
Created attachment 454745 [details]
slightly more visible (test reduction)
Comment 4 zalan 2022-03-15 13:37:18 PDT
we are missing some visual overflow here.
Comment 5 zalan 2022-03-15 16:31:55 PDT
Created attachment 454772 [details]
Patch
Comment 6 zalan 2022-03-15 16:39:59 PDT
Created attachment 454774 [details]
Patch
Comment 7 Darin Adler 2022-03-15 17:27:51 PDT
Comment on attachment 454774 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454774&action=review

> Source/WebCore/ChangeLog:9
> +        Inflate the ink overflow rect with the text shadow values (note that here, in the display builder we works with physical coordinates).

works -> work

> Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:146
> +        auto addTextShadowInkOverflow = [&] {

Not sure we need to name this lambda. Could just make it and call it.

> Source/WebCore/rendering/style/RenderStyle.h:508
> +    void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }

Should return a struct rather than using “get” style

> Source/WebCore/rendering/style/RenderStyle.h:509
> +    void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }

Ditto.
Comment 8 zalan 2022-03-15 18:47:57 PDT
Created attachment 454784 [details]
Patch
Comment 9 zalan 2022-03-15 19:30:26 PDT
(In reply to Darin Adler from comment #7)
> Comment on attachment 454774 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454774&action=review
> 
> > Source/WebCore/ChangeLog:9
> > +        Inflate the ink overflow rect with the text shadow values (note that here, in the display builder we works with physical coordinates).
> 
> works -> work
> 
> > Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:146
> > +        auto addTextShadowInkOverflow = [&] {
> 
> Not sure we need to name this lambda. Could just make it and call it.
> 
> > Source/WebCore/rendering/style/RenderStyle.h:508
> > +    void getTextShadowHorizontalExtent(LayoutUnit& left, LayoutUnit& right) const { getShadowHorizontalExtent(textShadow(), left, right); }
> 
> Should return a struct rather than using “get” style
> 
> > Source/WebCore/rendering/style/RenderStyle.h:509
> > +    void getTextShadowVerticalExtent(LayoutUnit& top, LayoutUnit& bottom) const { getShadowVerticalExtent(textShadow(), top, bottom); }
> 
> Ditto.
Thanks for the review! Changed the patch a bit.
Comment 10 EWS 2022-03-15 21:12:53 PDT
Committed r291330 (248469@main): <https://commits.webkit.org/248469@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 454784 [details].
Comment 11 Benoît Rouleau 2022-03-16 11:04:57 PDT
Wow, fixed within 12 hours of reporting. Thanks everyone!
Comment 12 zalan 2022-03-16 11:54:27 PDT
(In reply to Benoît Rouleau from comment #11)
> Wow, fixed within 12 hours of reporting. Thanks everyone!
Thank you for reporting it!
Comment 13 Darin Adler 2022-03-16 12:29:16 PDT
Comment on attachment 454784 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=454784&action=review

> Source/WebCore/rendering/style/RenderStyle.h:508
> +    LayoutBoxExtent textShadowExtent() const { return shadowExtent(textShadow()); }

Oh, that came out nicer than the "get" version!
Comment 14 zalan 2022-03-16 12:48:05 PDT
(In reply to Darin Adler from comment #13)
> Comment on attachment 454784 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=454784&action=review
> 
> > Source/WebCore/rendering/style/RenderStyle.h:508
> > +    LayoutBoxExtent textShadowExtent() const { return shadowExtent(textShadow()); }
> 
> Oh, that came out nicer than the "get" version!
It really did. I got blinded by get_BoxShadow_HorizontalExtent/get_BoxShadow_VerticalExtent pair a few lines below. Thanks for commenting on it.
Comment 15 Sam Sneddon [:gsnedders] 2022-05-16 15:40:25 PDT
Just to let everyone know, for those who care about Safari, the fix for this has shipped in Safari 15.5.