<select> menu on iPad causes shifting of hit-testing areas
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Aug 2016 18:02:03 +0000 (18:02 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Aug 2016 18:02:03 +0000 (18:02 +0000)
commit92b3fb94196d91f542c88be24a5e596ef88239f1
tree98a008fce41c8f89ef2a981e2b159ea3773d9e2d
parent0f837db0dc42496b592adbf3cc42b59d72626d24
<select> menu on iPad causes shifting of hit-testing areas
https://bugs.webkit.org/show_bug.cgi?id=150079

Reviewed by Tim Horton.

Source/WebKit2:

-isAssistingNode (aka the poorly named isEditable) is input into WebPageProxy::computeCustomFixedPositionRect(),
so when it changes we have to update visible rects. We were doing this on focus, but failing
to do it on blur.

Added the ability to test by:
1. Making it possible to initiate an animated scroll in the UI process
2. Adding callbacks for starting and ending interaction with a form control. Sadly
the "ending interaction" for <select> popovers on iPad isn't late enough, since we
have no way currently to know when the dimming view behind the popover animates out,
so for now the test keeps trying to tap a button.

Test: fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _zoomToPoint:atScale:animated:]):
(-[WKWebView _scrollToRect:origin:minimumScrollDistance:]):
(-[WKWebView _scrollByContentOffset:]):
(-[WKWebView _zoomToFocusRect:selectionRect:fontSize:minimumScale:maximumScale:allowScaling:forceScroll:]):
(-[WKWebView didStartFormControlInteraction]):
(-[WKWebView didEndFormControlInteraction]):
* UIProcess/API/Cocoa/WKWebViewPrivate.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:unobscuredRectInScrollViewCoordinates:obscuredInset:scale:minimumScale:inStableState:isChangingObscuredInsetsInteractively:enclosedInScrollableAncestorView:]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView setIsEditable:]):
(-[WKContentView _startAssistingNode:userIsInteracting:blurPreviousNode:userObject:]):
(-[WKContentView _stopAssistingNode]):

Tools:

-isAssistingNode (aka the poorly named isEditable) is input into WebPageProxy::computeCustomFixedPositionRect(),
so when it changes we have to update visible rects. We were doing this on focus, but failing
to do it on blur.

Added the ability to test by:
1. Making it possible to initiate an animated scroll in the UI process
2. Adding callbacks for starting and ending interaction with a form control. Sadly
the "ending interaction" for <select> popovers on iPad isn't late enough, since we
have no way currently to know when the dimming view behind the popover animates out,
so for now the test keeps trying to tap a button.

* WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl:
* WebKitTestRunner/UIScriptContext/UIScriptContext.h:
* WebKitTestRunner/UIScriptContext/UIScriptController.cpp:
(WTR::UIScriptController::setDidStartFormControlInteractionCallback):
(WTR::UIScriptController::didStartFormControlInteractionCallback):
(WTR::UIScriptController::setDidEndFormControlInteractionCallback):
(WTR::UIScriptController::didEndFormControlInteractionCallback):
(WTR::UIScriptController::scrollToOffset):
(WTR::UIScriptController::platformSetDidStartFormControlInteractionCallback):
(WTR::UIScriptController::platformSetDidEndFormControlInteractionCallback):
* WebKitTestRunner/UIScriptContext/UIScriptController.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.h:
* WebKitTestRunner/cocoa/TestRunnerWKWebView.mm:
(-[TestRunnerWKWebView dealloc]):
(-[TestRunnerWKWebView didStartFormControlInteraction]):
(-[TestRunnerWKWebView didEndFormControlInteraction]):
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::contentOffsetBoundedInValidRange):
(WTR::UIScriptController::scrollToOffset):
(WTR::UIScriptController::platformSetDidStartFormControlInteractionCallback):
(WTR::UIScriptController::platformSetDidEndFormControlInteractionCallback):

LayoutTests:

This test:
1. Scrolls in the ui process, so that position:fixed kicks in
2. Taps on a <select>, which disabled position:fixed behavior
3. Chooses a <select> option, dismissing the <select>, which restores position:fixed behavior
4. Tries to tap a button inside position:fixed.

* fast/forms/ios/ipad/unfocus-inside-fixed-hittest-expected.txt: Added.
* fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204728 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/ipad/unfocus-inside-fixed-hittest-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/ios/ipad/unfocus-inside-fixed-hittest.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebViewPrivate.h
Source/WebKit2/UIProcess/ios/WKContentView.mm
Source/WebKit2/UIProcess/ios/WKContentViewInteraction.mm
Tools/ChangeLog
Tools/WebKitTestRunner/UIScriptContext/Bindings/UIScriptController.idl
Tools/WebKitTestRunner/UIScriptContext/UIScriptContext.h
Tools/WebKitTestRunner/UIScriptContext/UIScriptController.cpp
Tools/WebKitTestRunner/UIScriptContext/UIScriptController.h
Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.h
Tools/WebKitTestRunner/cocoa/TestRunnerWKWebView.mm
Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm