This seems like the cleaner approach to fix bug 229317, since top layers already have the right stacking context set.
Created attachment 436025 [details] Patch
<rdar://problem/82186659>
Committed r281364 (240779@main): <https://commits.webkit.org/240779@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 436025 [details].