Changeset 237331 in webkit


Ignore:
Timestamp:
Oct 22, 2018 2:22:36 PM (6 years ago)
Author:
timothy_horton@apple.com
Message:

Don't waste time under -setupInteraction under -initWithFrame for unparented WKWebViews
https://bugs.webkit.org/show_bug.cgi?id=190801
<rdar://problem/43674361>

Reviewed by Megan Gardner.

  • UIProcess/ios/WKContentView.mm:

(-[WKContentView _commonInitializationWithProcessPool:configuration:]):
(-[WKContentView didMoveToWindow]):
Defer the first call to WKContentViewInteraction's -setupInteraction
until the view is parented. This avoids a few milliseconds of unnecessary
work for views that are never parented.

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

(-[WKContentView setupInteraction]):
(-[WKContentView cleanupInteraction]):
Keep track of the current state of WKContentViewInteraction's gestures.
Use this to make it OK to call -setupInteraction multiple times.

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r237329 r237331  
     12018-10-22  Tim Horton  <timothy_horton@apple.com>
     2
     3        Don't waste time under -setupInteraction under -initWithFrame for unparented WKWebViews
     4        https://bugs.webkit.org/show_bug.cgi?id=190801
     5        <rdar://problem/43674361>
     6
     7        Reviewed by Megan Gardner.
     8
     9        * UIProcess/ios/WKContentView.mm:
     10        (-[WKContentView _commonInitializationWithProcessPool:configuration:]):
     11        (-[WKContentView didMoveToWindow]):
     12        Defer the first call to WKContentViewInteraction's -setupInteraction
     13        until the view is parented. This avoids a few milliseconds of unnecessary
     14        work for views that are never parented.
     15
     16        * UIProcess/ios/WKContentViewInteraction.h:
     17        * UIProcess/ios/WKContentViewInteraction.mm:
     18        (-[WKContentView setupInteraction]):
     19        (-[WKContentView cleanupInteraction]):
     20        Keep track of the current state of WKContentViewInteraction's gestures.
     21        Use this to make it OK to call -setupInteraction multiple times.
     22
    1232018-10-22  Chris Dumez  <cdumez@apple.com>
    224
  • trunk/Source/WebKit/UIProcess/ios/WKContentView.mm

    r237266 r237331  
    219219    [_fixedClippingView addSubview:_rootContentView.get()];
    220220
    221     [self setupInteraction];
    222221    [self setUserInteractionEnabled:YES];
    223222
     
    276275        [self _updateForScreen:newWindow.screen];
    277276    }
     277}
     278
     279- (void)didMoveToWindow
     280{
     281    [super didMoveToWindow];
     282
     283    if (self.window)
     284        [self setupInteraction];
    278285}
    279286
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r237305 r237331  
    278278    BOOL _focusRequiresStrongPasswordAssistance;
    279279
     280    BOOL _hasSetUpInteractions;
     281
    280282#if ENABLE(DATA_INTERACTION)
    281283    WebKit::DragDropInteractionState _dragDropInteractionState;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r237305 r237331  
    626626- (void)setupInteraction
    627627{
     628    if (_hasSetUpInteractions)
     629        return;
     630
    628631    if (!_interactionViewsContainerView) {
    629632        _interactionViewsContainerView = adoptNS([[UIView alloc] init]);
     
    714717    _dataListTextSuggestions = nil;
    715718#endif
     719
     720    _hasSetUpInteractions = YES;
    716721}
    717722
    718723- (void)cleanupInteraction
    719724{
     725    if (!_hasSetUpInteractions)
     726        return;
     727
    720728    _webSelectionAssistant = nil;
    721729    _textSelectionAssistant = nil;
     
    814822    _dataListTextSuggestions = nil;
    815823#endif
     824
     825    _hasSetUpInteractions = NO;
    816826}
    817827
Note: See TracChangeset for help on using the changeset viewer.