Bug 209559

Summary: WebPage::selectPositionAtPoint() does not focus an element in a non-focused frame
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebCore Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: ews-watchlist, mifenton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
For the bots
none
Patch and test
none
Patch and test none

Description Daniel Bates 2020-03-25 13:28:35 PDT
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>
Comment 1 Radar WebKit Bug Importer 2020-03-25 13:28:46 PDT
<rdar://problem/60887055>
Comment 2 Daniel Bates 2020-03-25 13:30:37 PDT
Created attachment 394539 [details]
For the bots
Comment 3 Daniel Bates 2020-03-25 15:11:35 PDT
There is an existing WebPage::setFocusedFrameBeforeSelectingTextAtLocation() that other functions use 😐
Comment 4 Daniel Bates 2020-03-25 15:26:09 PDT
Created attachment 394551 [details]
Patch and test
Comment 5 Daniel Bates 2020-03-26 11:23:08 PDT
Created attachment 394632 [details]
Patch and test
Comment 6 Daniel Bates 2020-03-26 14:10:13 PDT
Comment on attachment 394632 [details]
Patch and test

Clearing flags on attachment: 394632

Committed r259078: <https://trac.webkit.org/changeset/259078>
Comment 7 Daniel Bates 2020-03-26 14:10:15 PDT
All reviewed patches have been landed.  Closing bug.