Bug 179927 - Text cursor blinks outside of input box after scrolling
Summary: Text cursor blinks outside of input box after scrolling
Status: RESOLVED DUPLICATE of bug 176896
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: Safari 11
Hardware: iPhone / iPad iOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-21 13:26 PST by Danyao Wang
Modified: 2018-02-15 10:24 PST (History)
5 users (show)

See Also:


Attachments
Screenshot showing cursor blinking outside of input box (49.97 KB, image/png)
2017-11-21 13:26 PST, Danyao Wang
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Danyao Wang 2017-11-21 13:26:42 PST
Created attachment 327427 [details]
Screenshot showing cursor blinking outside of input box

This bug was originally reported by folks from http://n26.com. See http://crbug.com/781297 for original repro steps.

I created a minimal example that reproduces the problem: http://output.jsbin.com/cabejez

Steps to reproduce:
1. On an iOS device, visit http://output.jsbin.com/cabejez in Safari
2. Tab on input box
3. Scroll the page up

Expected result:
Cursor blinks inside the input box

Actual result:
Cursor blinks below and outside the input box. See screenshot attached.

The key ingredient for exposing the bug seems to be the <div> that contains the input box having position:fixed. Normally this <div> is not scrollable. But when the <input> is focused, it seems that the view is scrolled in UIProcess, but the WebProcess didn't get the update.
Comment 1 Frédéric Wang (:fredw) 2017-11-24 08:52:44 PST
I can confirm the bug on trunk.

@Danyao: I've actually been studying stack traces to re-position the fixed node for other bugs and it is:

WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect
WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions
WebCore::AsyncScrollingCoordinator::reconcileScrollingState
WebKit::WebPage::updateVisibleContentRects

Also IIRC AsyncScrollingCoordinator::reconcileScrollingState is called 
from WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll if you perform a programmatic scroll of the main frame (instead of user interaction).

WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll is also called when doing user interaction in "overflow: auto; webkit-overflow-scrolling: touch" nodes and interestingly in that case we tell WebEditorClient that the overflow scroll position has changed.

Maybe you can try to compare your testcase using scrollingElement.scrollTop = ... or "overflow: auto; webkit-overflow-scrolling: touch" nodes and see whether you get the same issue?
Comment 2 Frédéric Wang (:fredw) 2018-02-15 08:33:20 PST
@Danyao: It seems that this bug is fixed in WebKit trunk (I tried the testcase with the simulator), can you please try again?
Comment 3 Simon Fraser (smfr) 2018-02-15 10:24:49 PST

*** This bug has been marked as a duplicate of bug 176896 ***