Bug 262192

Summary: A GitHub project page with embedded SVG takes an extremely long time to load
Product: WebKit Reporter: cueball045
Component: SVGAssignee: Nobody <webkit-unassigned>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: ahmad.saleem792, ap, karlcow, mmaxfield, rniwa, sabouhallawa, simon.fraser, webkit-bug-importer, zimmermann
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 17   
Hardware: All   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=262343
https://bugs.webkit.org/show_bug.cgi?id=264076

Description cueball045 2023-09-27 09:07:41 PDT
Website: https://github.com/facebookincubator/below

The website takes a long time to load, the page hangs. Navigating to sub-links is also slow. This is a WebKit specific behavior, the website loads fine on Chrome. I also tried disabling all the extensions but this looks like a bug with WebKit.
Comment 1 Alexey Proskuryakov 2023-09-27 17:56:52 PDT
Thsnk you for the report! As this is reported against Safari 17, do you happen to know if this was happening with Safari 16.x before?

It's taking time under LegacyRenderSVGRoot::layout -> SVGTextMetricsBuilder::walkTree -> WebCore::Font::applyTransforms.
Comment 2 cueball045 2023-09-27 18:15:41 PDT
Thanks for the prompt response. Yes, this was happening in Safari 16.x as well.
I had reported this for Safari 16 using Feedback Assistant but I should have known better.
Comment 3 Simon Fraser (smfr) 2023-09-28 09:49:09 PDT
Lots of time under:
     2404 WebCore::RenderBlockFlow::layoutBlockChildren(bool, WebCore::LayoutUnit&)  (in WebCore) + 4960  [0x61767b2b0]
       2404 WebCore::LegacyRenderSVGRoot::layout()  (in WebCore) + 1094  [0x6178bfe86]
         2404 WebCore::SVGRenderSupport::layoutChildren(WebCore::RenderElement&, bool)  (in WebCore) + 706  [0x6178a03d2]
           2404 WebCore::LegacyRenderSVGContainer::layout()  (in WebCore) + 269  [0x6178b5a6d]
             2404 WebCore::SVGRenderSupport::layoutChildren(WebCore::RenderElement&, bool)  (in WebCore) + 706  [0x6178a03d2]
               2402 WebCore::RenderSVGText::layout()  (in WebCore) + 1309  [0x61558439d]
               ! 2398 WebCore::SVGTextMetricsBuilder::walkTree(WebCore::RenderElement&, WebCore::RenderSVGInlineText*, WebCore::MeasureTextData*)  (in WebCore) + 127  [0x6178b3b4f]
               ! : 2329 WebCore::SVGTextMetricsBuilder::walkTree(WebCore::RenderElement&, WebCore::RenderSVGInlineText*, WebCore::MeasureTextData*)  (in WebCore) + 127  [0x6178b3b4f]
               ! : | 2279 WebCore::SVGTextMetricsBuilder::walkTree(WebCore::RenderElement&, WebCore::RenderSVGInlineText*, WebCore::MeasureTextData*)  (in WebCore) + 92  [0x6178b3b2c]
               ! : | + 1997 WebCore::SVGTextMetricsBuilder::measureTextRenderer(WebCore::RenderSVGInlineText&, WebCore::MeasureTextData*)  (in WebCore) + 1358  [0x6178b31ce]
               ! : | + ! 1404 WebCore::WidthIterator::advance(unsigned int, WebCore::GlyphBuffer&)  (in WebCore) + 188  [0x6174737cc]
               ! : | + ! : 1098 WebCore::WidthIterator::advanceInternal<WebCore::Latin1TextIterator>(WebCore::Latin1TextIterator&, WebCore::GlyphBuffer&)  (in WebCore) + 4011  [0x617474c7b]
               ! : | + ! : | 1054 WebCore::WidthIterator::commitCurrentFontRange(WebCore::AdvanceInternalState&)  (in WebCore) + 963  [0x6174722d3]
Comment 4 Radar WebKit Bug Importer 2023-09-28 09:49:20 PDT
<rdar://problem/116188712>
Comment 5 Ahmad Saleem 2023-09-28 10:27:49 PDT
One potential merge: https://src.chromium.org/viewvc/blink?view=revision&revision=168005

> Eliminate recursion in SVGTextMetricsBuilder::walkTree
Comment 6 Ahmad Saleem 2023-11-02 14:42:37 PDT
I think it is fixed on WebKit ToT (270133@main).
Comment 7 cueball045 2023-11-02 14:50:37 PDT
Is there a way to verify this, maybe in Safari TP? I am not sure which commit fixed it, so cannot check in release notes.
Comment 8 Ahmad Saleem 2023-11-02 14:52:02 PDT
(In reply to cueball045 from comment #7)
> Is there a way to verify this, maybe in Safari TP? I am not sure which
> commit fixed it, so cannot check in release notes.

I think it might be fixed because of following commit:

https://commits.webkit.org/270110@main

Which is not in Safari Technology Preview. It might be in STP183 or STP184 or even STP185.
Comment 9 cueball045 2023-11-02 14:53:09 PDT
That's super helpful. Thanks a lot!
Comment 10 Ryosuke Niwa 2023-11-03 01:45:28 PDT
Yeah, this appears to be fixed on trunk.