If the point passed to WebPage::selectPositionAtPoint() hits an element in a non-focused frame then it does nothing. This is ultimately because FrameSelection::setFocusedElementIfNeeded() early returns if the new focus element is not in a focused frame by [1] even though it is more than capable of accommodating the request: focusing the frame of the target element + focusing the target element (by way of calling FocusController::setFocusedElement()). [1] <https://trac.webkit.org/browser/trunk/Source/WebCore/editing/FrameSelection.cpp?rev=258233#L2246>
<rdar://problem/60887055>
Created attachment 394539 [details] For the bots
There is an existing WebPage::setFocusedFrameBeforeSelectingTextAtLocation() that other functions use 😐
Created attachment 394551 [details] Patch and test
Created attachment 394632 [details] Patch and test
Comment on attachment 394632 [details] Patch and test Clearing flags on attachment: 394632 Committed r259078: <https://trac.webkit.org/changeset/259078>
All reviewed patches have been landed. Closing bug.