Title: [288178] trunk
Revision
288178
Author
wenson_hs...@apple.com
Date
2022-01-18 19:11:03 -0800 (Tue, 18 Jan 2022)

Log Message

REGRESSION (r264352): Mail compose body field does not avoid the keyboard when scrolling after focus
https://bugs.webkit.org/show_bug.cgi?id=235331
rdar://79296770

Reviewed by Tim Horton.

Source/WebKit:

After r264352 added the call to `_page->scheduleFullEditorStateUpdate();` during element focus, scrolling to
reveal the selection in the focused body field in Mail stopped working. This is because Mail:

1.  Sets `firstResponderKeyboardAvoidanceEnabled` to NO on the WKScrollView, which prevents automatic inset
    adjustment logic in UIKit from taking effect and adding the keyboard height to the bottom system content
    inset.

2.  Manually sets `-contentScrollInset` on the WKScrollView during a UIKeyboardDidShowNotification, which occurs
    after we've already attempted to zoom to the selection.

...combined with the fact that without the call to `scheduleFullEditorStateUpdate()`, the next EditorState
would've arrived only after the keyboard animation finished.

The end result is that we don't end up avoiding the keyboard at all when focusing the body field in Mail
compose. While rdar://87733414 tracks refactoring logic in WebKit2 Mail compose to ensure that the content
scroll insets on WKScrollView are applied during UIKeyboardWillShowNotification instead of after the keyboard
has finished animating in, this patch provides a short-term workaround by restoring pre-r264352 behavior, with
respect to when the element is scrolled into view.

Test: editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html

* Platform/spi/ios/UIKitSPI.h:

Add a declaration for the `-firstResponderKeyboardAvoidanceEnabled` SPI property on non-internal iOS SDKs.

* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _keyboardDidShow:]):

Plumb this through to the WKContentView, so we can zoom/scroll to the focused element if needed.

* UIProcess/WebPageProxy.h:
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView cleanUpInteraction]):
(-[WKContentView _keyboardDidShow]):

If we previously deferred the call to `-_zoomToRevealFocusedElement` due to the keyboard still animating in,
schedule a call to it now on a 0-delay timer; this delay is necessary to ensure that this zoom occurs *after*
Mail has already set the content inset, which also happens underneath a "KeyboardDidShow" notification.

(-[WKContentView _zoomToRevealFocusedElement]):

In the case where the (presumably internal) client has set `firstResponderKeyboardAvoidanceEnabled` to NO and
the keyboard is animating in, defer the actual call into the web view to `-_zoomToRevealFocusedElement` until
after the keyboard animation is finished. This ensures compatibility with existant logic in Mail for manually
setting the content scroll inset on the WKScrollView after the keyboard animation is complete.

(-[WKContentView resetShouldZoomToFocusRectAfterShowingKeyboard]):
(-[WKContentView _elementDidBlur]):

Tools:

Add support for a UIScriptController hook to override `firstResponderKeyboardAvoidanceEnabled` on WKScrollView.
See LayoutTests for more details.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::setScrollViewKeyboardAvoidanceEnabled):
* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::setScrollViewKeyboardAvoidanceEnabled):

LayoutTests:

Add a layout test that (at least) exercises the newly added codepath, where focusing an editor when the scroll
view has `firstResponderKeyboardAvoidanceEnabled` set to NO will still allow us to scroll to the selection.

* editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled-expected.txt: Added.
* editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html: Added.
* resources/ui-helper.js:
(window.UIHelper.setScrollViewKeyboardAvoidanceEnabled):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (288177 => 288178)


--- trunk/LayoutTests/ChangeLog	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/LayoutTests/ChangeLog	2022-01-19 03:11:03 UTC (rev 288178)
@@ -1,3 +1,19 @@
+2022-01-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        REGRESSION (r264352): Mail compose body field does not avoid the keyboard when scrolling after focus
+        https://bugs.webkit.org/show_bug.cgi?id=235331
+        rdar://79296770
+
+        Reviewed by Tim Horton.
+
+        Add a layout test that (at least) exercises the newly added codepath, where focusing an editor when the scroll
+        view has `firstResponderKeyboardAvoidanceEnabled` set to NO will still allow us to scroll to the selection.
+
+        * editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled-expected.txt: Added.
+        * editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html: Added.
+        * resources/ui-helper.js:
+        (window.UIHelper.setScrollViewKeyboardAvoidanceEnabled):
+
 2022-01-18  Chris Dumez  <cdu...@apple.com>
 
         When inserting a selected <option> in a <select> element, its selected state should remain

Added: trunk/LayoutTests/editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled-expected.txt (0 => 288178)


--- trunk/LayoutTests/editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled-expected.txt	2022-01-19 03:11:03 UTC (rev 288178)
@@ -0,0 +1,10 @@
+This test verifies that focusing an editable element causes us to scroll to reveal the selection, even if first responder keyboard avoidance is disabled on the web view's scroller. This test requires WebKitTestRunner.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.scrollingElement.scrollTop became different from 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html (0 => 288178)


--- trunk/LayoutTests/editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html	                        (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html	2022-01-19 03:11:03 UTC (rev 288178)
@@ -0,0 +1,34 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<script src=""
+<script src=""
+<script>
+jsTestIsAsync = true;
+
+addEventListener("load", async () => {
+    document.designMode = "on";
+    description("This test verifies that focusing an editable element causes us to scroll to reveal the selection, even if first responder keyboard avoidance is disabled on the web view's scroller. This test requires WebKitTestRunner.");
+
+    await UIHelper.setScrollViewKeyboardAvoidanceEnabled(false);
+    await UIHelper.setHardwareKeyboardAttached(false);
+    await UIHelper.activateAndWaitForInputSessionAt(160, innerHeight - 50);
+
+    shouldBecomeDifferent("document.scrollingElement.scrollTop", "0", () => {
+        document.getElementById("content").remove();
+        finishJSTest();
+    });
+});
+</script>
+</head>
+<body>
+<pre id="console"></pre>
+<div id="content" style="font-size: 24px;">
+    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
+    <p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
+    <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
+    <p>Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p>
+</div>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/LayoutTests/resources/ui-helper.js (288177 => 288178)


--- trunk/LayoutTests/resources/ui-helper.js	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/LayoutTests/resources/ui-helper.js	2022-01-19 03:11:03 UTC (rev 288178)
@@ -1154,6 +1154,14 @@
         return new Promise(resolve => testRunner.runUIScript(`uiController.setViewScale(${scale})`, resolve));
     }
 
+    static setScrollViewKeyboardAvoidanceEnabled(enabled)
+    {
+        if (!this.isWebKit2())
+            return Promise.resolve();
+
+        return new Promise(resolve => testRunner.runUIScript(`uiController.setScrollViewKeyboardAvoidanceEnabled(${enabled})`, resolve));
+    }
+
     static resignFirstResponder()
     {
         if (!this.isWebKit2())

Modified: trunk/Source/WebKit/ChangeLog (288177 => 288178)


--- trunk/Source/WebKit/ChangeLog	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Source/WebKit/ChangeLog	2022-01-19 03:11:03 UTC (rev 288178)
@@ -1,3 +1,61 @@
+2022-01-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        REGRESSION (r264352): Mail compose body field does not avoid the keyboard when scrolling after focus
+        https://bugs.webkit.org/show_bug.cgi?id=235331
+        rdar://79296770
+
+        Reviewed by Tim Horton.
+
+        After r264352 added the call to `_page->scheduleFullEditorStateUpdate();` during element focus, scrolling to
+        reveal the selection in the focused body field in Mail stopped working. This is because Mail:
+
+        1.  Sets `firstResponderKeyboardAvoidanceEnabled` to NO on the WKScrollView, which prevents automatic inset
+            adjustment logic in UIKit from taking effect and adding the keyboard height to the bottom system content
+            inset.
+
+        2.  Manually sets `-contentScrollInset` on the WKScrollView during a UIKeyboardDidShowNotification, which occurs
+            after we've already attempted to zoom to the selection.
+
+        ...combined with the fact that without the call to `scheduleFullEditorStateUpdate()`, the next EditorState
+        would've arrived only after the keyboard animation finished.
+
+        The end result is that we don't end up avoiding the keyboard at all when focusing the body field in Mail
+        compose. While rdar://87733414 tracks refactoring logic in WebKit2 Mail compose to ensure that the content
+        scroll insets on WKScrollView are applied during UIKeyboardWillShowNotification instead of after the keyboard
+        has finished animating in, this patch provides a short-term workaround by restoring pre-r264352 behavior, with
+        respect to when the element is scrolled into view.
+
+        Test: editing/selection/ios/scroll-to-reveal-selection-with-keyboard-avoidance-disabled.html
+
+        * Platform/spi/ios/UIKitSPI.h:
+
+        Add a declaration for the `-firstResponderKeyboardAvoidanceEnabled` SPI property on non-internal iOS SDKs.
+
+        * UIProcess/API/ios/WKWebViewIOS.mm:
+        (-[WKWebView _keyboardDidShow:]):
+
+        Plumb this through to the WKContentView, so we can zoom/scroll to the focused element if needed.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/ios/WKContentViewInteraction.h:
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView cleanUpInteraction]):
+        (-[WKContentView _keyboardDidShow]):
+
+        If we previously deferred the call to `-_zoomToRevealFocusedElement` due to the keyboard still animating in,
+        schedule a call to it now on a 0-delay timer; this delay is necessary to ensure that this zoom occurs *after*
+        Mail has already set the content inset, which also happens underneath a "KeyboardDidShow" notification.
+
+        (-[WKContentView _zoomToRevealFocusedElement]):
+
+        In the case where the (presumably internal) client has set `firstResponderKeyboardAvoidanceEnabled` to NO and
+        the keyboard is animating in, defer the actual call into the web view to `-_zoomToRevealFocusedElement` until
+        after the keyboard animation is finished. This ensures compatibility with existant logic in Mail for manually
+        setting the content scroll inset on the WKScrollView after the keyboard animation is complete.
+
+        (-[WKContentView resetShouldZoomToFocusRectAfterShowingKeyboard]):
+        (-[WKContentView _elementDidBlur]):
+
 2022-01-18  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, reverting r288019.

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (288177 => 288178)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2022-01-19 03:11:03 UTC (rev 288178)
@@ -515,6 +515,7 @@
 @property (nonatomic, readonly) UIEdgeInsets _systemContentInset;
 @property (nonatomic, readonly) UIEdgeInsets _effectiveContentInset;
 @property (nonatomic, getter=_allowsAsyncScrollEvent, setter=_setAllowsAsyncScrollEvent:) BOOL _allowsAsyncScrollEvent;
+@property (nonatomic, getter=_isFirstResponderKeyboardAvoidanceEnabled, setter=_setFirstResponderKeyboardAvoidanceEnabled:) BOOL firstResponderKeyboardAvoidanceEnabled;
 @end
 
 typedef NS_ENUM(NSUInteger, UIScrollPhase) {

Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (288177 => 288178)


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2022-01-19 03:11:03 UTC (rev 288178)
@@ -2492,6 +2492,7 @@
 - (void)_keyboardDidShow:(NSNotification *)notification
 {
     _page->setIsKeyboardAnimatingIn(false);
+    [_contentView _keyboardDidShow];
 }
 
 - (void)_keyboardWillHide:(NSNotification *)notification

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (288177 => 288178)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2022-01-19 03:11:03 UTC (rev 288178)
@@ -1616,6 +1616,7 @@
 
 #if PLATFORM(IOS_FAMILY)
     void setIsKeyboardAnimatingIn(bool isKeyboardAnimatingIn) { m_isKeyboardAnimatingIn = isKeyboardAnimatingIn; }
+    bool isKeyboardAnimatingIn() const { return m_isKeyboardAnimatingIn; }
 
     void setWaitingForPostLayoutEditorStateUpdateAfterFocusingElement(bool waitingForPostLayoutEditorStateUpdateAfterFocusingElement) { m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement = waitingForPostLayoutEditorStateUpdateAfterFocusingElement; }
     bool waitingForPostLayoutEditorStateUpdateAfterFocusingElement() const { return m_waitingForPostLayoutEditorStateUpdateAfterFocusingElement; }

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (288177 => 288178)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2022-01-19 03:11:03 UTC (rev 288178)
@@ -462,6 +462,7 @@
     BOOL _isRelinquishingFirstResponderToFocusedElement;
     BOOL _unsuppressSoftwareKeyboardAfterNextAutocorrectionContextUpdate;
     BOOL _isUnsuppressingSoftwareKeyboardUsingLastAutocorrectionContext;
+    BOOL _shouldZoomToFocusRectAfterShowingKeyboard;
 
     BOOL _focusRequiresStrongPasswordAssistance;
     BOOL _waitingForEditDragSnapshot;
@@ -600,6 +601,8 @@
 - (BOOL)_hasFocusedElement;
 - (void)_zoomToRevealFocusedElement;
 
+- (void)_keyboardDidShow;
+
 - (void)cancelPointersForGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
 - (std::optional<unsigned>)activeTouchIdentifierForGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer;
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (288177 => 288178)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2022-01-19 03:11:03 UTC (rev 288178)
@@ -1216,6 +1216,8 @@
     _pointerInteraction = nil;
 #endif
 
+    [self resetShouldZoomToFocusRectAfterShowingKeyboard];
+
 #if HAVE(PENCILKIT_TEXT_INPUT)
     [self cleanUpScribbleInteraction];
 #endif
@@ -2344,11 +2346,32 @@
     return boundingRect;
 }
 
+- (void)_keyboardDidShow
+{
+    if (!_shouldZoomToFocusRectAfterShowingKeyboard)
+        return;
+
+    // FIXME: This deferred call to -_zoomToRevealFocusedElement works around the fact that Mail compose
+    // disables automatic content inset adjustment using the keyboard height, and instead has logic to
+    // explicitly set WKScrollView's contentScrollInset after receiving UIKeyboardDidShowNotification.
+    // This means that if we -_zoomToRevealFocusedElement immediately after focusing the body field in
+    // Mail, we won't take the keyboard height into account when scrolling.
+    // Mitigate this by deferring the call to -_zoomToRevealFocusedElement in this case until after the
+    // keyboard has finished animating. We can revert this once rdar://87733414 is fixed.
+    [self resetShouldZoomToFocusRectAfterShowingKeyboard];
+    [self performSelector:@selector(_zoomToRevealFocusedElement) withObject:nil afterDelay:0];
+}
+
 - (void)_zoomToRevealFocusedElement
 {
     if (_suppressSelectionAssistantReasons || _activeTextInteractionCount)
         return;
 
+    if (!self._scroller.firstResponderKeyboardAvoidanceEnabled && _page->isKeyboardAnimatingIn()) {
+        _shouldZoomToFocusRectAfterShowingKeyboard = YES;
+        return;
+    }
+
     // In case user scaling is force enabled, do not use that scaling when zooming in with an input field.
     // Zooming above the page's default scale factor should only happen when the user performs it.
     [self _zoomToFocusRect:_focusedElementInformation.interactionRect
@@ -2360,6 +2383,12 @@
         forceScroll:[self requiresAccessoryView]];
 }
 
+- (void)resetShouldZoomToFocusRectAfterShowingKeyboard
+{
+    _shouldZoomToFocusRectAfterShowingKeyboard = NO;
+    [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(_zoomToRevealFocusedElement) object:nil];
+}
+
 - (UIView *)inputView
 {
     return [_webView inputView];
@@ -6575,6 +6604,8 @@
     _focusRequiresStrongPasswordAssistance = NO;
     _additionalContextForStrongPasswordAssistance = nil;
 
+    [self resetShouldZoomToFocusRectAfterShowingKeyboard];
+
     // When defocusing an editable element reset a seen keydown before calling -_hideKeyboard so that we
     // re-evaluate whether we still need a keyboard when UIKit calls us back in -_requiresKeyboardWhenFirstResponder.
     if (editableChanged)

Modified: trunk/Tools/ChangeLog (288177 => 288178)


--- trunk/Tools/ChangeLog	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Tools/ChangeLog	2022-01-19 03:11:03 UTC (rev 288178)
@@ -1,3 +1,23 @@
+2022-01-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        REGRESSION (r264352): Mail compose body field does not avoid the keyboard when scrolling after focus
+        https://bugs.webkit.org/show_bug.cgi?id=235331
+        rdar://79296770
+
+        Reviewed by Tim Horton.
+
+        Add support for a UIScriptController hook to override `firstResponderKeyboardAvoidanceEnabled` on WKScrollView.
+        See LayoutTests for more details.
+
+        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
+        * TestRunnerShared/UIScriptContext/UIScriptController.h:
+        (WTR::UIScriptController::setScrollViewKeyboardAvoidanceEnabled):
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformResetStateToConsistentValues):
+        * WebKitTestRunner/ios/UIScriptControllerIOS.h:
+        * WebKitTestRunner/ios/UIScriptControllerIOS.mm:
+        (WTR::UIScriptControllerIOS::setScrollViewKeyboardAvoidanceEnabled):
+
 2022-01-18  Don Olmstead  <don.olmst...@sony.com>
 
         Replace all uses of HAVE_ACCESSIBILITY with ENABLE_ACCESSIBILITY

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl (288177 => 288178)


--- trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl	2022-01-19 03:11:03 UTC (rev 288178)
@@ -285,6 +285,8 @@
     undefined setMinimumEffectiveWidth(double effectiveWidth);
     undefined setAllowsViewportShrinkToFit(boolean allows);
 
+    undefined setScrollViewKeyboardAvoidanceEnabled(boolean enabled);
+
     undefined becomeFirstResponder();
     undefined resignFirstResponder();
     readonly attribute boolean isPresentingModally;

Modified: trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h (288177 => 288178)


--- trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h	2022-01-19 03:11:03 UTC (rev 288178)
@@ -97,6 +97,8 @@
     virtual void setMinimumEffectiveWidth(double) { notImplemented(); }
     virtual void setAllowsViewportShrinkToFit(bool) { notImplemented(); }
 
+    virtual void setScrollViewKeyboardAvoidanceEnabled(bool) { notImplemented(); }
+
     virtual std::optional<bool> stableStateOverride() const { notImplemented(); return std::nullopt; }
     virtual void setStableStateOverride(std::optional<bool>) { notImplemented(); }
 

Modified: trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm (288177 => 288178)


--- trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm	2022-01-19 03:11:03 UTC (rev 288178)
@@ -227,6 +227,7 @@
         UIScrollView *scrollView = webView.scrollView;
         [scrollView _removeAllAnimations:YES];
         [scrollView setZoomScale:1 animated:NO];
+        scrollView.firstResponderKeyboardAvoidanceEnabled = YES;
 
         auto currentContentInset = scrollView.contentInset;
         auto contentInsetTop = options.contentInsetTop();

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h (288177 => 288178)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.h	2022-01-19 03:11:03 UTC (rev 288178)
@@ -146,6 +146,7 @@
     void copyText(JSStringRef) override;
     void installTapGestureOnWindow(JSValueRef) override;
     void setSpellCheckerResults(JSValueRef) override { }
+    void setScrollViewKeyboardAvoidanceEnabled(bool) override;
 
     bool mayContainEditableElementsInRect(unsigned x, unsigned y, unsigned width, unsigned height) override;
 

Modified: trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm (288177 => 288178)


--- trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2022-01-19 02:37:00 UTC (rev 288177)
+++ trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm	2022-01-19 03:11:03 UTC (rev 288178)
@@ -1272,6 +1272,11 @@
     webView()._allowsViewportShrinkToFit = allows;
 }
 
+void UIScriptControllerIOS::setScrollViewKeyboardAvoidanceEnabled(bool enabled)
+{
+    webView().scrollView.firstResponderKeyboardAvoidanceEnabled = enabled;
+}
+
 void UIScriptControllerIOS::doAfterDoubleTapDelay(JSValueRef callback)
 {
     unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to