⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 259840 in webkit


Ignore:
Timestamp:
Apr 9, 2020, 4:58:49 PM (6 years ago)
Author:
Megan Gardner
Message:

Popovers are dismissed immediately when they try and bring up the keyboard.
https://bugs.webkit.org/show_bug.cgi?id=210230
<rdar://problem/60385504>

Reviewed by Darin Adler.

When popovers use keyboards we dismiss them because the
web view loses firstResponder. We already have ways of
retaining focus when we lose first responde, so extend that
code to cover the case where a keyboard comes up in a popover.

We are also callling controlBeginEditing twice on refocusing a
popover due to behaviour with touch and syntheticClick, so
keep up from presenting the popover twice, and allow for the focus
count to be correclty incremented and decremented.

  • UIProcess/ios/WKContentViewInteraction.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView preserveFocus]):
(-[WKContentView releaseFocus]):

  • UIProcess/ios/forms/WKFormInputControl.mm:

(-[WKDateTimePopover popoverWasDismissed:]):
(-[WKDateTimePopover controlBeginEditing]):
(-[WKDateTimePopover controlEndEditing]):

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r259833 r259840  
     12020-04-09  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Popovers are dismissed immediately when they try and bring up the keyboard.
     4        https://bugs.webkit.org/show_bug.cgi?id=210230
     5        <rdar://problem/60385504>
     6
     7        Reviewed by Darin Adler.
     8
     9        When popovers use keyboards we dismiss them because the
     10        web view loses firstResponder. We already have ways of
     11        retaining focus when we lose first responde, so extend that
     12        code to cover the case where a keyboard comes up in a popover.
     13
     14        We are also callling controlBeginEditing twice on refocusing a
     15        popover due to behaviour with touch and syntheticClick, so
     16        keep up from presenting the popover twice, and allow for the focus
     17        count to be correclty incremented and decremented.
     18
     19        * UIProcess/ios/WKContentViewInteraction.h:
     20        * UIProcess/ios/WKContentViewInteraction.mm:
     21        (-[WKContentView preserveFocus]):
     22        (-[WKContentView releaseFocus]):
     23        * UIProcess/ios/forms/WKFormInputControl.mm:
     24        (-[WKDateTimePopover popoverWasDismissed:]):
     25        (-[WKDateTimePopover controlBeginEditing]):
     26        (-[WKDateTimePopover controlEndEditing]):
     27
    1282020-04-09  David Kilzer  <ddkilzer@apple.com>
    229
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r259091 r259840  
    531531- (void)generateSyntheticEditingCommand:(WebKit::SyntheticEditingCommandType)command;
    532532
     533- (void)preserveFocus;
     534- (void)releaseFocus;
     535
    533536// UIWebFormAccessoryDelegate protocol
    534537- (void)accessoryDone;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r259669 r259840  
    66596659}
    66606660
     6661- (void)preserveFocus
     6662{
     6663    [_webView _incrementFocusPreservationCount];
     6664}
     6665
     6666- (void)releaseFocus
     6667{
     6668    [_webView _decrementFocusPreservationCount];
     6669}
     6670
    66616671- (void)_preserveFocusWithToken:(id <NSCopying, NSSecureCoding>)token destructively:(BOOL)destructively
    66626672{
  • trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm

    r259806 r259840  
    5151    RetainPtr<WKDateTimePopoverViewController> _viewController;
    5252    WKContentView *_view;
     53    BOOL _presenting;
     54    BOOL _preservingFocus;
    5355}
    5456- (id)initWithView:(WKContentView *)view datePickerMode:(UIDatePickerMode)mode;
     
    335337}
    336338
     339- (void)popoverWasDismissed:(WKRotatingPopover *)popover
     340{
     341    [super popoverWasDismissed:popover];
     342   
     343    if (popover == self) {
     344        if (_preservingFocus) {
     345            [_view releaseFocus];
     346            _preservingFocus = NO;
     347        }
     348    }
     349}
     350
    337351- (id)initWithView:(WKContentView *)view datePickerMode:(UIDatePickerMode)mode
    338352{
     
    378392- (void)controlBeginEditing
    379393{
    380     [self presentPopoverAnimated:NO];
    381     [_viewController.get().innerControl controlBeginEditing];
     394    if (!_presenting) {
     395        _presenting = YES;
     396        [self presentPopoverAnimated:NO];
     397        [_viewController.get().innerControl controlBeginEditing];
     398       
     399        if (_view.focusedElementInformation.elementType == InputType::Time || _view.focusedElementInformation.elementType == InputType::DateTimeLocal) {
     400            _preservingFocus = YES;
     401            [_view preserveFocus];
     402        }
     403    }
    382404}
    383405
    384406- (void)controlEndEditing
    385407{
     408    _presenting = NO;
    386409    [self dismissPopoverAnimated:NO];
    387410    [_viewController.get().innerControl controlEndEditing];
Note: See TracChangeset for help on using the changeset viewer.