Changeset 243791 in webkit
- Timestamp:
- Apr 2, 2019, 11:23:48 PM (7 years ago)
- Location:
- tags/Safari-608.1.13.5/Source/WebKit
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/ios/WKContentViewInteraction.mm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tags/Safari-608.1.13.5/Source/WebKit/ChangeLog
r243790 r243791 1 2019-04-02 Babak Shafiei <bshafiei@apple.com> 2 3 Cherry-pick r243606. rdar://problem/49229632 4 5 [iPad] Tapping on a popup form control may not show a popover 6 https://bugs.webkit.org/show_bug.cgi?id=196322 7 <rdar://problem/49229632> 8 9 Reviewed by Wenson Hsieh. 10 11 Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews 12 to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only 13 needs to call -inputView when it actually needs to display the input view (the keyboard). For 14 popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral 15 as part of the logic in the UI process to focus a new element before we call -reloadInputViews. 16 17 * UIProcess/ios/WKContentViewInteraction.mm: 18 (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView(). 19 (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to 20 end the input sessions and nullify the input peripheral before we tell the web process to switch 21 focus as opposed to letting this happen after the web process tells us it focused a new element. 22 (createInputPeripheralWithView): Added. 23 (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): 24 Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming 25 first responder because creating the peripheral has known side-effects: for popup buttons it 26 tells the popup controller to present the popover. For key input to popovers to work from the get-go, 27 the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272> 28 for more details. 29 30 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243606 268f45cc-cd09-0410-ab3c-d52691b4dbfc 31 32 2019-03-28 Daniel Bates <dabates@apple.com> 33 34 [iPad] Tapping on a popup form control may not show a popover 35 https://bugs.webkit.org/show_bug.cgi?id=196322 36 <rdar://problem/49229632> 37 38 Reviewed by Wenson Hsieh. 39 40 Stop taking advantage of -[WKContentView inputView] being called when we invoke -reloadInputViews 41 to "lazily" allocate the input peripheral for the currently focused element. In theory, UIKit only 42 needs to call -inputView when it actually needs to display the input view (the keyboard). For 43 popup menu buttons, like <select>, no keyboard is needed. Instead we should create the peripheral 44 as part of the logic in the UI process to focus a new element before we call -reloadInputViews. 45 46 * UIProcess/ios/WKContentViewInteraction.mm: 47 (-[WKContentView inputView]): Extract logic to allocate the peripheral from here and moved it to createInputPeripheralWithView(). 48 (-[WKContentView accessoryTab:]): While I am here, add a FIXME comment to explain why we need to 49 end the input sessions and nullify the input peripheral before we tell the web process to switch 50 focus as opposed to letting this happen after the web process tells us it focused a new element. 51 (createInputPeripheralWithView): Added. 52 (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]): 53 Write in terms of createInputPeripheralWithView(). Create the input peripheral after becoming 54 first responder because creating the peripheral has known side-effects: for popup buttons it 55 tells the popup controller to present the popover. For key input to popovers to work from the get-go, 56 the content view must be the first responder. See <https://bugs.webkit.org/show_bug.cgi?id=196272> 57 for more details. 58 1 59 2019-04-02 Babak Shafiei <bshafiei@apple.com> 2 60 -
tags/Safari-608.1.13.5/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r243543 r243791 1644 1644 return nil; 1645 1645 1646 if (!_inputPeripheral) { 1647 switch (_focusedElementInformation.elementType) { 1648 case WebKit::InputType::Select: 1649 _inputPeripheral = adoptNS([[WKFormSelectControl alloc] initWithView:self]); 1650 break; 1651 #if ENABLE(INPUT_TYPE_COLOR) 1652 case WebKit::InputType::Color: 1653 _inputPeripheral = adoptNS([[WKFormColorControl alloc] initWithView:self]); 1654 break; 1655 #endif 1656 default: 1657 _inputPeripheral = adoptNS([[WKFormInputControl alloc] initWithView:self]); 1658 break; 1659 } 1660 } else { 1646 if (_inputPeripheral) { 1661 1647 // FIXME: UIKit may invoke -[WKContentView inputView] at any time when WKContentView is the first responder; 1662 1648 // as such, it doesn't make sense to change the enclosing scroll view's zoom scale and content offset to reveal … … 1668 1654 // rotation, when a select element is focused. See <https://webkit.org/b/192878> for more information. 1669 1655 [self _zoomToRevealFocusedElement]; 1656 1670 1657 [self _updateAccessory]; 1671 1658 } … … 3764 3751 - (void)accessoryTab:(BOOL)isNext 3765 3752 { 3753 // The input peripheral may need to update the focused DOM node before we switch focus. The UI process does 3754 // not maintain a handle to the actual focused DOM node – only the web process has such a handle. So, we need 3755 // to end the editing session now before we tell the web process to switch focus. Once the web process tells 3756 // us the newly focused element we are no longer are in a position to effect the previously focused element. 3757 // See <https://bugs.webkit.org/show_bug.cgi?id=134409>. 3766 3758 [self _endEditing]; 3767 _inputPeripheral = nil; 3759 _inputPeripheral = nil; // Nullify so that we don't tell the input peripheral to end editing again in -_elementDidBlur. 3768 3760 3769 3761 _isChangingFocusUsingAccessoryTab = YES; … … 4853 4845 } 4854 4846 4847 static RetainPtr<NSObject <WKFormPeripheral>> createInputPeripheralWithView(WebKit::InputType type, WKContentView *view) 4848 { 4849 switch (type) { 4850 case WebKit::InputType::Select: 4851 return adoptNS([[WKFormSelectControl alloc] initWithView:view]); 4852 #if ENABLE(INPUT_TYPE_COLOR) 4853 case WebKit::InputType::Color: 4854 return adoptNS([[WKFormColorControl alloc] initWithView:view]); 4855 #endif 4856 default: 4857 return adoptNS([[WKFormInputControl alloc] initWithView:view]); 4858 } 4859 } 4860 4855 4861 - (void)_elementDidFocus:(const WebKit::FocusedElementInformation&)information userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode changingActivityState:(BOOL)changingActivityState userObject:(NSObject <NSSecureCoding> *)userObject 4856 4862 { … … 4953 4959 BOOL editableChanged = [self setIsEditable:YES]; 4954 4960 _focusedElementInformation = information; 4955 _inputPeripheral = nil;4956 4961 _traits = nil; 4957 4962 4958 4963 if (![self isFirstResponder]) 4959 4964 [self becomeFirstResponder]; 4965 4966 _inputPeripheral = createInputPeripheralWithView(_focusedElementInformation.elementType, self); 4960 4967 4961 4968 #if PLATFORM(WATCHOS)
Note:
See TracChangeset
for help on using the changeset viewer.