[iOS][WK2] Distant focusable element may not be scrolled into view when focused using...
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jun 2014 04:31:25 +0000 (04:31 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Jun 2014 04:31:25 +0000 (04:31 +0000)
commiteeb0e4155b377f4d5402ea39e09591bcb8a1842e
tree6f82ba4e87c658841003ecc9f790189c4feef2b0
parentc782def42ef2dc4ecdb625b233feae8a3bd2b1ac
[iOS][WK2] Distant focusable element may not be scrolled into view when focused using keyboard
https://bugs.webkit.org/show_bug.cgi?id=134309
<rdar://problem/17427385>

Reviewed by Darin Adler.

.:
Add a manual test to ensure that we scroll to a distant focused text field when it's focused
using the keyboard.

* ManualTests/ios/scroll-to-distant-keyboard-focused-text-field.html: Added.

Source/WebKit2:
Fixes an issue where the focusable element may not be scrolled into view when it's focused by
using the keyboard accessory (i.e. the < and > buttons). In particular, we don't scroll a
keyboard focused text field into view when it's positioned significantly outside the visible region.

* UIProcess/ios/WKContentViewInteraction.h: Added an instance variable called _didAccessoryTabInitiateFocus
to track whether an accessory tab initiated the focus of the focusable element.
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanupInteraction]): Clear _didAccessoryTabInitiateFocus so that we're in a good state
should the WebProcess crash between the time the UIProcess receives the accessory tab request and the
WebProcess calls back to the UIProcess to zoom/scroll to the newly focused element.
(-[WKContentView _displayFormNodeInputView]): Modified to pass an empty rectangle for the selection
rectangle to -_zoomToFocusRect to avoid constraining the scroll to the newly focused element when it
was focused using the keyboard accessory tab buttons
(-[WKContentView accessoryTab:]): Modified to set _didAccessoryTabInitiateFocus to YES. We'll set
this boolean to NO in -_displayFormNodeInputView.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170518 268f45cc-cd09-0410-ab3c-d52691b4dbfc
ChangeLog
ManualTests/ios/scroll-to-distant-keyboard-focused-text-field.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.h
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm