Bug 132657 - WK2: Programatic scroll requests during scroll or zoom animation to reveal focused element are ignored.
Summary: WK2: Programatic scroll requests during scroll or zoom animation to reveal fo...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Enrica Casucci
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-05-07 12:30 PDT by Enrica Casucci
Modified: 2014-05-07 15:43 PDT (History)
4 users (show)

See Also:


Attachments
Patch (7.92 KB, patch)
2014-05-07 13:44 PDT, Enrica Casucci
benjamin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enrica Casucci 2014-05-07 12:30:43 PDT
Given the asynchronous scrolling model of WK2 on iOS, we can receive a request to scroll from JavaScript while the UI process is still animating to reveal the focused input element.
This breaks the behavior of pages like www.amazon.co.jp on iOS.

<rdar://problem/16468462>
Comment 1 Enrica Casucci 2014-05-07 13:44:15 PDT
Created attachment 231018 [details]
Patch
Comment 2 Benjamin Poulain 2014-05-07 14:53:38 PDT
Comment on attachment 231018 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=231018&action=review

> Source/WebCore/dom/Element.cpp:1983
> -    if (document().page())
> -        document().page()->chrome().client().elementDidFocus(this);
> -
>      RefPtr<FocusEvent> event = FocusEvent::create(eventNames().focusEvent, false, false, document().defaultView(), 0, oldFocusedElement);
>      EventDispatcher::dispatchEvent(this, event.release());
> +    if (document().page())
> +        document().page()->chrome().client().elementDidFocus(this);
>  }

As discussed: let's move this on a separate patch, and handle the programmatic scroll.

> Source/WebCore/platform/ScrollableArea.h:72
> +    virtual bool inProgrammaticScroll() const { return false; }

Please move this to ScrollView.

You should also add override on FrameView's implementation.

> Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm:118
> +    BOOL _isAnimatingScrollOrZoom;

Let's try to remove this and stop the animations systematically.

We will need a more generic heuristic to solve conflicts between user gesture and animation origination from WebProcess's requests.
Comment 3 Enrica Casucci 2014-05-07 15:43:35 PDT
Committed revision 168447.