REGRESSION (iOS 12): Can't scroll to the bottom of the page in WKWebView while keyboa...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2018 03:50:12 +0000 (03:50 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Jul 2018 03:50:12 +0000 (03:50 +0000)
commitbb123f8eb092259f830cc3a37266f8da0264c3ed
treea8bd8517dbc3a7b5dd370c594f50bc05d0b383d1
parent62a326770cbd353421b9c10a8e433e3f79b2c2c8
REGRESSION (iOS 12): Can't scroll to the bottom of the page in WKWebView while keyboard is up on pages with viewport-fit=cover
https://bugs.webkit.org/show_bug.cgi?id=187743
<rdar://problem/41651546>

Reviewed by Simon Fraser.

UIScrollView's _systemContentInset no longer includes keyboard insets
in apps linked on iOS 12+ when contentInsetAdjustmentBehavior is None.

We use contentInsetAdjustmentBehavior to control adjustment of other
sources of insets, but expect the keyboard inset to always be applied.

For now, barring a more comprehensive way to separate insets, re-add
the keyboard inset in cases where UIKit does not.

* Platform/spi/ios/UIKitSPI.h:
Move some IPI to the SPI header.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _haveSetObscuredInsets]):
* UIProcess/API/Cocoa/WKWebViewInternal.h:
Make it possible for WKScrollView to check whether the client is overriding insets.

* UIProcess/Cocoa/VersionChecks.h:
Add a linkedOnOrAfter() version for this new UIScrollView behavior.

* UIProcess/ios/WKScrollView.mm:
(-[WKScrollView initWithFrame:]):
Force WKScrollView's scroll indicator to always respect insets. We always
want the scroll bars in a sensible place, even if the page sets
viewport-fit=cover.

(-[WKScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:]):
Store the bottom inset due to the keyboard.

(-[WKScrollView _systemContentInset]):
Add the bottom inset due to the keyboard to the systemContentInset
in all cases where UIKit does not. Also avoid adding it if the client takes
full control of the insets, because the only client that does (MobileSafari)
includes insets-due-to-keyboard in their custom insets.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233905 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/Platform/spi/ios/UIKitSPI.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebViewInternal.h
Source/WebKit/UIProcess/Cocoa/VersionChecks.h
Source/WebKit/UIProcess/ios/WKScrollView.mm