The renderer is already has a containingBlock() function which returns the correct containing block. This function is "let's pretend if the renderer was absolute/fixed/inflow positioned, what would the containing block be".
Created attachment 448547 [details] Patch
Committed r287744 (245814@main): <https://commits.webkit.org/245814@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 448547 [details].
<rdar://problem/87249623>