Bug 265326

Summary: Remove N^3 walk of the frame tree
Product: WebKit Reporter: Ahmad Saleem <ahmad.saleem792>
Component: ScrollingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: cdumez, mattwoodrow, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=48873
Attachments:
Description Flags
Local Patch - 1
none
Local Patch - 2 none

Description Ahmad Saleem 2023-11-24 15:10:44 PST
Hi Team,

I came across this potential optimization but I am not 100% sure, it would be applicable as is in Safari / WebKit but I notice same function and code, so I thought to raise it.

Blink Commit: https://chromium.googlesource.com/chromium/blink/+/d16821075540cf768b4bb812d4d518f70b12a413

"While walking the frame tree during layout, at every node of the walk, we'd
walk down the frame tree again to update the "can blit on scroll" bit.  At each
node of that recursive walk, we'd walk all the way back to the root to check
for being unable to blit-on-scroll in our parent frame.

This CL remove the eager computation of this state and instead just computes it
on demand when we're about to scroll. Computing the information on demand is
fast, we just need to walk up to the root of the frame tree.

The N^3 algorithm was added by Simon Fraser in
http://trac.webkit.org/changeset/71194"

WebKit Source: https://searchfox.org/wubkat/rev/aa809c03fded1f6f0c99d562ee397ee2f472fee9/Source/WebCore/page/LocalFrameView.cpp#418 , https://searchfox.org/wubkat/rev/aa809c03fded1f6f0c99d562ee397ee2f472fee9/Source/WebCore/page/LocalFrameView.cpp#1458 & https://searchfox.org/wubkat/rev/aa809c03fded1f6f0c99d562ee397ee2f472fee9/Source/WebCore/platform/ScrollView.h#167 etc.

Just wanted to raise to see, if it is worthwhile fix or in another shape or form to improve performance.

Thanks!
Comment 1 Radar WebKit Bug Importer 2023-12-01 15:11:13 PST
<rdar://problem/119052584>
Comment 2 Ahmad Saleem 2023-12-18 09:25:16 PST
Created attachment 469112 [details]
Local Patch - 1
Comment 3 Ahmad Saleem 2023-12-18 09:25:31 PST
Created attachment 469113 [details]
Local Patch - 2
Comment 4 Ahmad Saleem 2023-12-18 09:26:21 PST
NOTE - This patch adds 'FIXME', which was removed later in Blink to do normal fixes, so it does not need to be added.