Changeset 247651 in webkit
- Timestamp:
- Jul 19, 2019 12:55:20 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r247650 r247651 1 2019-07-19 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Entering 2FA code on idmsa.apple.com causes unexpected scrolling 4 https://bugs.webkit.org/show_bug.cgi?id=199949 5 <rdar://problem/49944428> 6 7 Reviewed by Tim Horton and Megan Gardner. 8 9 Add a new layout test to verify that moving focus between horizontally adjacent form controls doesn't induce 10 vertical scrolling. 11 12 * fast/forms/ios/no-scrolling-when-moving-focus-between-adjacent-fields-expected.txt: Added. 13 * fast/forms/ios/no-scrolling-when-moving-focus-between-adjacent-fields.html: Added. 14 1 15 2019-07-19 Antoine Quint <graouts@apple.com> 2 16 -
trunk/Source/WebKit/ChangeLog
r247635 r247651 1 2019-07-19 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 [iOS] Entering 2FA code on idmsa.apple.com causes unexpected scrolling 4 https://bugs.webkit.org/show_bug.cgi?id=199949 5 <rdar://problem/49944428> 6 7 Reviewed by Tim Horton and Megan Gardner. 8 9 Since at least iOS 11, -[UIScrollView _adjustForAutomaticKeyboardInfo:animated:lastAdjustment:] adjusts the 10 scroll view's content offset to account for updated keyboard bottom insets. In WebKit, we call this method 11 whenever keyboard geometry changes (based on system notifications, such as UIKeyboardWillHideNotification). 12 13 When switching between focused form fields, we hide the keyboard for the previous focused element prior to 14 showing the keyboard for the newly focused element. This means that we will actually dismiss the keyboard in the 15 process of changing the focused element, which posts keyboard geometry notifications, which causes us to scroll 16 WKScrollView. 17 18 On iOS 12, this would be immediately followed by re-presenting the keyboard for the new focused element, which 19 causes us to adjust the scroll view back to its original position right away; this means that the scrolling that 20 happens as a result of adjusting for the keyboard insets after dismissal doesn't result in any visible change. 21 22 However, on iOS 13, after r239441 and r244546, we now defer scrolling and zooming to reveal the focused element 23 until later; this means the scrolling that happens as a result of initially dismissing the keyboard now causes a 24 consistent jump in the scroll view's scroll position (whereas on iOS 12, this only happens rarely, and the jump 25 is also less noticeable). 26 27 To mitigate this, we detect the case where we're moving focus from one element to another; if we're about to 28 show a keyboard for the newly focused element, then we should avoid scrolling as a result of the impending 29 "keyboard will hide" notification. 30 31 Test: fast/forms/ios/no-scrolling-when-moving-focus-between-adjacent-fields.html 32 33 * UIProcess/API/Cocoa/WKWebView.mm: 34 (-[WKWebView _keyboardChangedWithInfo:adjustScrollView:]): 35 (-[WKWebView _keyboardWillHide:]): 36 * UIProcess/ios/WKContentViewInteraction.h: 37 * UIProcess/ios/WKContentViewInteraction.mm: 38 (shouldShowKeyboardForElement): 39 40 Add a helper to determine whether we're focusing an element which presents a "keyboard" (i.e. a UIKit input 41 view, as opposed to modal select pickers, modal date pickers, or fields with inputmode="none", for which we 42 don't show an input view). 43 44 (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:]): 45 (-[WKContentView shouldIgnoreKeyboardWillHideNotification]): 46 1 47 2019-07-18 Alex Christensen <achristensen@webkit.org> 2 48 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r247490 r247651 3330 3330 [_scrollView _adjustForAutomaticKeyboardInfo:keyboardInfo animated:YES lastAdjustment:&_lastAdjustmentForScroller]; 3331 3331 CGFloat bottomInsetAfterAdjustment = [_scrollView contentInset].bottom; 3332 // FIXME: This "total bottom content inset adjustment" mechanism hasn't worked since iOS 11, since -_adjustForAutomaticKeyboardInfo:animated:lastAdjustment: 3333 // no longer sets -[UIScrollView contentInset] for apps linked on or after iOS 11. We should consider removing this logic, since the original bug this was 3334 // intended to fix, <rdar://problem/23202254>, remains fixed through other means. 3332 3335 if (bottomInsetBeforeAdjustment != bottomInsetAfterAdjustment) 3333 3336 _totalScrollViewBottomInsetAdjustmentForKeyboard += bottomInsetAfterAdjustment - bottomInsetBeforeAdjustment; … … 3372 3375 - (void)_keyboardWillHide:(NSNotification *)notification 3373 3376 { 3374 // Ignore keyboard will hide notifications sent during rotation. They're just there for 3375 // backwards compatibility reasons and processing the will hide notification would 3376 // temporarily screw up the unobscured view area. 3377 if ([[UIPeripheralHost sharedInstance] rotationState]) 3377 if ([_contentView shouldIgnoreKeyboardWillHideNotification]) 3378 3378 return; 3379 3379 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h
r247197 r247651 346 346 BOOL _needsDeferredEndScrollingSelectionUpdate; 347 347 BOOL _isChangingFocus; 348 BOOL _isFocusingElementWithKeyboard; 348 349 BOOL _isBlurringFocusedElement; 349 350 … … 398 399 @property (nonatomic, readonly) BOOL isEditable; 399 400 @property (nonatomic, readonly) BOOL shouldHideSelectionWhenScrolling; 401 @property (nonatomic, readonly) BOOL shouldIgnoreKeyboardWillHideNotification; 400 402 @property (nonatomic, readonly) const WebKit::InteractionInformationAtPosition& positionInformation; 401 403 @property (nonatomic, readonly) const WebKit::WKAutoCorrectionData& autocorrectionData; -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r247559 r247651 5160 5160 } 5161 5161 5162 static bool shouldShowKeyboardForElement(const WebKit::FocusedElementInformation& information) 5163 { 5164 if (information.inputMode == WebCore::InputMode::None) 5165 return false; 5166 5167 if (information.elementType == WebKit::InputType::Drawing) 5168 return false; 5169 5170 if (mayContainSelectableText(information.elementType)) 5171 return true; 5172 5173 return !currentUserInterfaceIdiomIsPad(); 5174 } 5175 5162 5176 static WebCore::FloatRect rectToRevealWhenZoomingToFocusedElement(const WebKit::FocusedElementInformation& elementInfo, const WebKit::EditorState& editorState) 5163 5177 { … … 5206 5220 { 5207 5221 SetForScope<BOOL> isChangingFocusForScope { _isChangingFocus, hasFocusedElement(_focusedElementInformation) }; 5222 SetForScope<BOOL> isFocusingElementWithKeyboardForScope { _isFocusingElementWithKeyboard, shouldShowKeyboardForElement(information) }; 5223 5208 5224 auto inputViewUpdateDeferrer = std::exchange(_inputViewUpdateDeferrer, nullptr); 5209 5225 … … 5399 5415 if (!_isChangingFocus) 5400 5416 _didAccessoryTabInitiateFocus = NO; 5417 } 5418 5419 - (BOOL)shouldIgnoreKeyboardWillHideNotification 5420 { 5421 // Ignore keyboard will hide notifications sent during rotation. They're just there for 5422 // backwards compatibility reasons and processing the will hide notification would 5423 // temporarily screw up the unobscured view area. 5424 if (UIPeripheralHost.sharedInstance.rotationState) 5425 return YES; 5426 5427 if (_isChangingFocus && _isFocusingElementWithKeyboard) 5428 return YES; 5429 5430 return NO; 5401 5431 } 5402 5432
Note: See TracChangeset
for help on using the changeset viewer.