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

Changeset 183978 in webkit


Ignore:
Timestamp:
May 7, 2015, 9:23:41 PM (11 years ago)
Author:
Conrad Shultz
Message:

Don't register for Lookup notifications until needed
https://bugs.webkit.org/show_bug.cgi?id=144783

Reviewed by Tim Horton.

  • UIProcess/API/mac/WKView.mm:

Add a WKViewData ivar to track whether we've already registered for popover notifications.
(-[WKView _prepareForDictionaryLookup]):
Added; moved notification registration from -[WKView initWithFrame:processPool:configuration:webView:.
(-[WKView initWithFrame:processPool:configuration:webView:]):
Move notification registration to -_prepareForDictionaryLookup.

  • UIProcess/API/mac/WKViewInternal.h:

Expose -_prepareForDictionaryLookup.

  • UIProcess/mac/PageClientImpl.mm:

(WebKit::PageClientImpl::didPerformDictionaryLookup):
Send -[WKView _prepareForDictionaryLookup].

  • UIProcess/mac/WKImmediateActionController.mm:

(-[WKImmediateActionController _animationControllerForText]):
Ditto.

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r183977 r183978  
     12015-05-07  Conrad Shultz  <conrad_shultz@apple.com>
     2
     3        Don't register for Lookup notifications until needed
     4        https://bugs.webkit.org/show_bug.cgi?id=144783
     5
     6        Reviewed by Tim Horton.
     7
     8        * UIProcess/API/mac/WKView.mm:
     9        Add a WKViewData ivar to track whether we've already registered for popover notifications.
     10        (-[WKView _prepareForDictionaryLookup]):
     11        Added; moved notification registration from -[WKView initWithFrame:processPool:configuration:webView:.
     12        (-[WKView initWithFrame:processPool:configuration:webView:]):
     13        Move notification registration to -_prepareForDictionaryLookup.
     14
     15        * UIProcess/API/mac/WKViewInternal.h:
     16        Expose -_prepareForDictionaryLookup.
     17
     18        * UIProcess/mac/PageClientImpl.mm:
     19        (WebKit::PageClientImpl::didPerformDictionaryLookup):
     20        Send -[WKView _prepareForDictionaryLookup].
     21
     22        * UIProcess/mac/WKImmediateActionController.mm:
     23        (-[WKImmediateActionController _animationControllerForText]):
     24        Ditto.
     25
    1262015-05-07  Commit Queue  <commit-queue@webkit.org>
    227
  • trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm

    r183976 r183978  
    280280
    281281    CGFloat _overrideDeviceScaleFactor;
     282
     283    BOOL _didRegisterForLookupPopoverCloseNotifications;
    282284
    283285#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
     
    28892891}
    28902892
     2893- (void)_prepareForDictionaryLookup
     2894{
     2895    if (_data->_didRegisterForLookupPopoverCloseNotifications)
     2896        return;
     2897
     2898    _data->_didRegisterForLookupPopoverCloseNotifications = YES;
     2899
     2900    if (canLoadLUNotificationPopoverWillClose())
     2901        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
     2902}
     2903
    28912904- (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
    28922905{
     
    38333846    [workspaceNotificationCenter addObserver:self selector:@selector(_activeSpaceDidChange:) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
    38343847
    3835     if (canLoadLUNotificationPopoverWillClose())
    3836         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
    3837 
    38383848#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
    38393849    if ([self respondsToSelector:@selector(_setActionMenu:)]) {
  • trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h

    r183841 r183978  
    141141- (void)_closeFullScreenWindowController;
    142142
     143- (void)_prepareForDictionaryLookup;
     144
    143145#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
    144146- (void)_didPerformActionMenuHitTest:(const WebKit::WebHitTestResult::Data&)hitTestResult forImmediateAction:(BOOL)forImmediateAction contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
  • trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm

    r183517 r183978  
    594594    RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([(NSDictionary *)dictionaryPopupInfo.options.get() mutableCopy]);
    595595
     596    [m_wkView _prepareForDictionaryLookup];
     597
    596598    if (canLoadLUTermOptionDisableSearchTermIndicator() && dictionaryPopupInfo.textIndicator.contentImage) {
    597599        [m_wkView _setTextIndicator:*TextIndicator::create(dictionaryPopupInfo.textIndicator) withLifetime:TextIndicatorLifetime::Permanent];
  • trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm

    r183517 r183978  
    468468        return nil;
    469469
     470    [_wkView _prepareForDictionaryLookup];
     471
    470472    // Convert baseline to screen coordinates.
    471473    NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
Note: See TracChangeset for help on using the changeset viewer.