Bug 209559 - WebPage::selectPositionAtPoint() does not focus an element in a non-focused frame
Summary: WebPage::selectPositionAtPoint() does not focus an element in a non-focused f...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-03-25 13:28 PDT by Daniel Bates
Modified: 2020-03-26 14:10 PDT (History)
4 users (show)

See Also:


Attachments
For the bots (1.08 KB, patch)
2020-03-25 13:30 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and test (4.15 KB, patch)
2020-03-25 15:26 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch and test (4.24 KB, patch)
2020-03-26 11:23 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.