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

Changeset 271445 in webkit


Ignore:
Timestamp:
Jan 13, 2021, 11:05:44 AM (6 years ago)
Author:
Megan Gardner
Message:

Defer setting up app highlight menus until needed to not delay launch time.
https://bugs.webkit.org/show_bug.cgi?id=220577
rdar://72940219

Delay adding the app highlight menus to the callout bar until a selection happens,
as the creation of these menus is expensive, and they are only needed if a selection is
made on the page, which is not guaranteed to happen.

Reviewed by Tim Horton.

  • UIProcess/ios/WKContentView.mm:

(-[WKContentView _processDidExit]):

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

(-[WKContentView setUpInteraction]):
(-[WKContentView _selectionChanged]):
(-[WKContentView setupAppHighlightMenus]):

Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r271440 r271445  
     12021-01-13  Megan Gardner  <megan_gardner@apple.com>
     2
     3        Defer setting up app highlight menus until needed to not delay launch time.
     4        https://bugs.webkit.org/show_bug.cgi?id=220577
     5        rdar://72940219
     6
     7        Delay adding the app highlight menus to the callout bar until a selection happens,
     8        as the creation of these menus is expensive, and they are only needed if a selection is
     9        made on the page, which is not guaranteed to happen.
     10
     11        Reviewed by Tim Horton.
     12
     13        * UIProcess/ios/WKContentView.mm:
     14        (-[WKContentView _processDidExit]):
     15        * UIProcess/ios/WKContentViewInteraction.h:
     16        * UIProcess/ios/WKContentViewInteraction.mm:
     17        (-[WKContentView setUpInteraction]):
     18        (-[WKContentView _selectionChanged]):
     19        (-[WKContentView setupAppHighlightMenus]):
     20
    1212021-01-13  Commit Queue  <commit-queue@webkit.org>
    222
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h

    r271193 r271445  
    441441#endif
    442442
     443#if ENABLE(APP_HIGHLIGHTS)
     444    BOOL _hasSetUpAppHighlightMenus;
     445#endif
     446
    443447#if PLATFORM(WATCHOS)
    444448    RetainPtr<WKFocusedFormControlView> _focusedFormControlView;
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r271201 r271445  
    843843#endif
    844844
    845 #if ENABLE(APP_HIGHLIGHTS)
    846     [self setupAppHighlightMenus];
    847 #endif
    848 
    849845    _twoFingerSingleTapGestureRecognizer = adoptNS([[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_twoFingerSingleTapGestureRecognized:)]);
    850846    [_twoFingerSingleTapGestureRecognizer setAllowableMovement:60];
     
    66596655- (void)_selectionChanged
    66606656{
     6657#if ENABLE(APP_HIGHLIGHTS)
     6658    [self setUpAppHighlightMenus];
     6659#endif
     6660
    66616661    [self _updateSelectionAssistantSuppressionState];
    66626662
     
    86858685
    86868686#if ENABLE(APP_HIGHLIGHTS)
    8687 - (void)setupAppHighlightMenus
    8688 {
     8687- (void)setUpAppHighlightMenus
     8688{
     8689    if (_hasSetUpAppHighlightMenus)
     8690        return;
     8691
    86898692    if (_page->preferences().appHighlightsEnabled()) {
    86908693        auto addHighlightCurrentGroupItem = adoptNS([[UIMenuItem alloc] initWithTitle:WebCore::contextMenuItemTagAddHighlightToCurrentGroup() action:@selector(createHighlightInCurrentGroupWithRange:)]);
    86918694        auto addHighlightNewGroupItem = adoptNS([[UIMenuItem alloc] initWithTitle:WebCore::contextMenuItemTagAddHighlightToNewGroup() action:@selector(createHighlightInNewGroupWithRange:)]);
    86928695        [[UIMenuController sharedMenuController] setMenuItems:@[ addHighlightCurrentGroupItem.get(), addHighlightNewGroupItem.get() ]];
     8696        _hasSetUpAppHighlightMenus = YES;
    86938697    }
    86948698}
Note: See TracChangeset for help on using the changeset viewer.