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

Changeset 243302 in webkit


Ignore:
Timestamp:
Mar 21, 2019, 11:14:57 AM (7 years ago)
Author:
dbates@webkit.org
Message:

[iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
https://bugs.webkit.org/show_bug.cgi?id=196021

Reviewed by Wenson Hsieh.

Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately follows the call
with a call to -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory
view and inline the implementation of -_ensureFormAccessoryView into -formAccessoryView so we can
remove one method.

  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView inputView]): Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
the equivalent work for us.
(-[WKContentView formAccessoryView]): Moved implementation of -_ensureFormAccessoryView into here.
(-[WKContentView _updateAccessory]): Call self.formAccessoryView to ensure we have a form accessory view.
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
the equivalent work for us.
(-[WKContentView _ensureFormAccessoryView]): Deleted.

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r243292 r243302  
     12019-03-21  Daniel Bates  <dabates@apple.com>
     2
     3        [iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
     4        https://bugs.webkit.org/show_bug.cgi?id=196021
     5
     6        Reviewed by Wenson Hsieh.
     7
     8        Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately follows the call
     9        with a call to -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory
     10        view and inline the implementation of -_ensureFormAccessoryView into -formAccessoryView so we can
     11        remove one method.
     12
     13        * UIProcess/ios/WKContentViewInteraction.mm:
     14        (-[WKContentView inputView]): Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
     15        the equivalent work for us.
     16        (-[WKContentView formAccessoryView]): Moved implementation of -_ensureFormAccessoryView into here.
     17        (-[WKContentView _updateAccessory]): Call self.formAccessoryView to ensure we have a form accessory view.
     18        (-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
     19        Remove call to -_ensureFormAccessoryView, -_updateAccessory will do
     20        the equivalent work for us.
     21        (-[WKContentView _ensureFormAccessoryView]): Deleted.
     22
    1232019-03-21  Shawn Roberts  <sroberts@apple.com>
    224
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r243221 r243302  
    16661666        // rotation, when a select element is focused. See <https://webkit.org/b/192878> for more information.
    16671667        [self _zoomToRevealFocusedElement];
    1668         [self _ensureFormAccessoryView];
    16691668        [self _updateAccessory];
    16701669    }
     
    24752474{
    24762475    return [super inputAssistantItem];
    2477 }
    2478 
    2479 - (void)_ensureFormAccessoryView
    2480 {
    2481     if (_formAccessoryView)
    2482         return;
    2483 
    2484     _formAccessoryView = adoptNS([[UIWebFormAccessory alloc] initWithInputAssistantItem:self.inputAssistantItem]);
    2485     [_formAccessoryView setDelegate:self];
    24862476}
    24872477
     
    37853775}
    37863776
     3777- (UIWebFormAccessory *)formAccessoryView
     3778{
     3779    if (_formAccessoryView)
     3780        return _formAccessoryView.get();
     3781    _formAccessoryView = adoptNS([[UIWebFormAccessory alloc] initWithInputAssistantItem:self.inputAssistantItem]);
     3782    [_formAccessoryView setDelegate:self];
     3783    return _formAccessoryView.get();
     3784}
     3785
    37873786- (void)_updateAccessory
    37883787{
    3789     [_formAccessoryView setNextEnabled:_focusedElementInformation.hasNextNode];
    3790     [_formAccessoryView setPreviousEnabled:_focusedElementInformation.hasPreviousNode];
     3788    auto* accessoryView = self.formAccessoryView; // Creates one, if needed.
     3789
     3790    [accessoryView setNextEnabled:_focusedElementInformation.hasNextNode];
     3791    [accessoryView setPreviousEnabled:_focusedElementInformation.hasPreviousNode];
    37913792
    37923793    if (currentUserInterfaceIdiomIsPad()) {
    3793         [_formAccessoryView setClearVisible:NO];
     3794        [accessoryView setClearVisible:NO];
    37943795        return;
    37953796    }
     
    38003801    case WebKit::InputType::DateTimeLocal:
    38013802    case WebKit::InputType::Time:
    3802         [_formAccessoryView setClearVisible:YES];
     3803        [accessoryView setClearVisible:YES];
    38033804        return;
    38043805    default:
    3805         [_formAccessoryView setClearVisible:NO];
     3806        [accessoryView setClearVisible:NO];
    38063807        return;
    38073808    }
     
    47964797}
    47974798
    4798 - (UIWebFormAccessory *)formAccessoryView
    4799 {
    4800     [self _ensureFormAccessoryView];
    4801     return _formAccessoryView.get();
    4802 }
    4803 
    48044799static bool shouldDeferZoomingToSelectionWhenRevealingFocusedElement(WebKit::InputType type)
    48054800{
     
    49874982        [self _zoomToRevealFocusedElement];
    49884983
    4989     [self _ensureFormAccessoryView];
    49904984    [self _updateAccessory];
    49914985
Note: See TracChangeset for help on using the changeset viewer.