Title: [183978] trunk/Source/WebKit2
- Revision
- 183978
- Author
- [email protected]
- Date
- 2015-05-07 21:23:41 -0700 (Thu, 07 May 2015)
Log 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.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (183977 => 183978)
--- trunk/Source/WebKit2/ChangeLog 2015-05-08 03:27:11 UTC (rev 183977)
+++ trunk/Source/WebKit2/ChangeLog 2015-05-08 04:23:41 UTC (rev 183978)
@@ -1,3 +1,28 @@
+2015-05-07 Conrad Shultz <[email protected]>
+
+ 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.
+
2015-05-07 Commit Queue <[email protected]>
Unreviewed, rolling out r183961.
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (183977 => 183978)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-05-08 03:27:11 UTC (rev 183977)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2015-05-08 04:23:41 UTC (rev 183978)
@@ -280,6 +280,8 @@
CGFloat _overrideDeviceScaleFactor;
+ BOOL _didRegisterForLookupPopoverCloseNotifications;
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
BOOL _automaticallyAdjustsContentInsets;
RetainPtr<WKActionMenuController> _actionMenuController;
@@ -2888,6 +2890,17 @@
_data->_page->viewStateDidChange(ViewState::IsVisible);
}
+- (void)_prepareForDictionaryLookup
+{
+ if (_data->_didRegisterForLookupPopoverCloseNotifications)
+ return;
+
+ _data->_didRegisterForLookupPopoverCloseNotifications = YES;
+
+ if (canLoadLUNotificationPopoverWillClose())
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
+}
+
- (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
{
[self _clearTextIndicatorWithAnimation:TextIndicatorDismissalAnimation::None];
@@ -3832,9 +3845,6 @@
NSNotificationCenter* workspaceNotificationCenter = [[NSWorkspace sharedWorkspace] notificationCenter];
[workspaceNotificationCenter addObserver:self selector:@selector(_activeSpaceDidChange:) name:NSWorkspaceActiveSpaceDidChangeNotification object:nil];
- if (canLoadLUNotificationPopoverWillClose())
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
-
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
if ([self respondsToSelector:@selector(_setActionMenu:)]) {
RetainPtr<NSMenu> menu = adoptNS([[NSMenu alloc] init]);
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (183977 => 183978)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2015-05-08 03:27:11 UTC (rev 183977)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h 2015-05-08 04:23:41 UTC (rev 183978)
@@ -140,6 +140,8 @@
@property (readonly) WKFullScreenWindowController *_fullScreenWindowController;
- (void)_closeFullScreenWindowController;
+- (void)_prepareForDictionaryLookup;
+
#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
- (void)_didPerformActionMenuHitTest:(const WebKit::WebHitTestResult::Data&)hitTestResult forImmediateAction:(BOOL)forImmediateAction contentPreventsDefault:(BOOL)contentPreventsDefault userData:(API::Object*)userData;
#endif
Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (183977 => 183978)
--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2015-05-08 03:27:11 UTC (rev 183977)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2015-05-08 04:23:41 UTC (rev 183978)
@@ -593,6 +593,8 @@
RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([(NSDictionary *)dictionaryPopupInfo.options.get() mutableCopy]);
+ [m_wkView _prepareForDictionaryLookup];
+
if (canLoadLUTermOptionDisableSearchTermIndicator() && dictionaryPopupInfo.textIndicator.contentImage) {
[m_wkView _setTextIndicator:*TextIndicator::create(dictionaryPopupInfo.textIndicator) withLifetime:TextIndicatorLifetime::Permanent];
[mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (183977 => 183978)
--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm 2015-05-08 03:27:11 UTC (rev 183977)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm 2015-05-08 04:23:41 UTC (rev 183978)
@@ -467,6 +467,8 @@
if (!dictionaryPopupInfo.attributedString.string)
return nil;
+ [_wkView _prepareForDictionaryLookup];
+
// Convert baseline to screen coordinates.
NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
textBaselineOrigin = [_wkView convertPoint:textBaselineOrigin toView:nil];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes