Bug 195749

Summary: REGRESSION (r242801): [iOS] preventDefault() on touchstart in a subframe does not prevent focusing the subframe
Product: WebKit Reporter: Wenson Hsieh <wenson_hsieh>
Component: HTML EditingAssignee: Wenson Hsieh <wenson_hsieh>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, commit-queue, dino, megan_gardner, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=198928
Attachments:
Description Flags
Patch none

Description Wenson Hsieh 2019-03-14 10:16:01 PDT
This began after r242801, but it's really due to an existing (long-standing) bug wherein position information requests will change the focused frame:

InteractionInformationAtPosition WebPage::positionInformation(const InteractionInformationRequest& request)
{
    …

    if (!elementIsLinkOrImage) {
        HitTestResult result = m_page->mainFrame().eventHandler().hitTestResultAtPoint(request.point, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::DisallowUserAgentShadowContent | HitTestRequest::AllowChildFrameContent);
        hitNode = result.innerNode();
        // Hit test could return HTMLHtmlElement that has no renderer, if the body is smaller than the document.
        if (hitNode && hitNode->renderer()) {
            RenderObject* renderer = hitNode->renderer();
            m_page->focusController().setFocusedFrame(result.innerNodeFrame());
                                      ^^^^^^^^^^^^^^^
                                      This line in particular

            info.bounds = renderer->absoluteBoundingBoxRect(true);
            // We don't want to select blocks that are larger than 97% of the visible area of the document.

            …
Comment 1 Wenson Hsieh 2019-03-14 10:17:11 PDT
(In reply to Wenson Hsieh from comment #0)
>
> m_page->focusController().setFocusedFrame(result.innerNodeFrame());
>                                       ^^^^^^^^^^^^^^^
>                                       This line in particular

...it was added to fix <https://bugs.webkit.org/show_bug.cgi?id=128264>.
Comment 2 Radar WebKit Bug Importer 2019-03-14 10:50:28 PDT
<rdar://problem/48892367>
Comment 3 Wenson Hsieh 2019-03-14 13:06:13 PDT
Created attachment 364677 [details]
Patch
Comment 4 Wenson Hsieh 2019-03-14 13:08:13 PDT
This will bring back <rdar://problem/48020610>, but I have a different plan to make that work.
Comment 5 WebKit Commit Bot 2019-03-14 15:07:13 PDT
Comment on attachment 364677 [details]
Patch

Clearing flags on attachment: 364677

Committed r242968: <https://trac.webkit.org/changeset/242968>
Comment 6 WebKit Commit Bot 2019-03-14 15:07:15 PDT
All reviewed patches have been landed.  Closing bug.