Changeset 176281 in webkit
- Timestamp:
- Nov 18, 2014, 1:28:10 PM (12 years ago)
- Location:
- branches/safari-600.3-branch/Source
- Files:
-
- 28 edited
- 1 copied
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.exp.in (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
WebCore/editing/mac/DictionaryLookup.mm (modified) (3 diffs)
-
WebCore/platform/mac/WebCoreSystemInterface.h (modified) (1 diff)
-
WebCore/platform/mac/WebCoreSystemInterface.mm (modified) (1 diff)
-
WebCore/platform/spi/mac/LookupSPI.h (copied) (copied from trunk/Source/WebCore/platform/spi/mac/LookupSPI.h )
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/WebCoreSupport/WebSystemInterface.mm (modified) (1 diff)
-
WebKit/mac/WebView/WebActionMenuController.mm (modified) (5 diffs)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/Configurations/BaseTarget.xcconfig (modified) (1 diff)
-
WebKit2/Shared/DictionaryPopupInfo.cpp (modified) (4 diffs)
-
WebKit2/Shared/DictionaryPopupInfo.h (modified) (2 diffs)
-
WebKit2/UIProcess/API/mac/WKView.mm (modified) (8 diffs)
-
WebKit2/UIProcess/API/mac/WKViewInternal.h (modified) (1 diff)
-
WebKit2/UIProcess/PageClient.h (modified) (1 diff)
-
WebKit2/UIProcess/WebPageProxy.h (modified) (1 diff)
-
WebKit2/UIProcess/WebPageProxy.messages.in (modified) (1 diff)
-
WebKit2/UIProcess/ios/WebPageProxyIOS.mm (modified) (1 diff)
-
WebKit2/UIProcess/mac/PageClientImpl.h (modified) (1 diff)
-
WebKit2/UIProcess/mac/PageClientImpl.mm (modified) (3 diffs)
-
WebKit2/UIProcess/mac/TextIndicatorWindow.h (modified) (3 diffs)
-
WebKit2/UIProcess/mac/TextIndicatorWindow.mm (modified) (3 diffs)
-
WebKit2/UIProcess/mac/WKActionMenuController.mm (modified) (4 diffs)
-
WebKit2/UIProcess/mac/WebPageProxyMac.mm (modified) (1 diff)
-
WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm (modified) (1 diff)
-
WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (modified) (1 diff)
-
WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-600.3-branch/Source/WebCore/ChangeLog
r176280 r176281 1 2014-11-18 Dana Burkart <dburkart@apple.com> 2 3 Merge r176164. rdar://problem/18953982 4 5 2014-11-16 Tim Horton <timothy_horton@apple.com> 6 7 Use TextIndicator instead of the built in Lookup highlight 8 https://bugs.webkit.org/show_bug.cgi?id=138775 9 <rdar://problem/18953982> 10 11 Reviewed by Anders Carlsson. 12 13 * WebCore.exp.in: 14 * platform/mac/WebCoreSystemInterface.h: 15 * platform/mac/WebCoreSystemInterface.mm: 16 Remove a WKSI import/export that we don't need anymore. 17 18 * platform/spi/mac/LookupSPI.h: Added. 19 (WebCore::canDisableLookupIndicator): 20 Add Lookup SPI header. 21 Add a 'canDisableLookupIndicator', which must be called in any translation 22 unit that wants to use either of the soft-linked constants related to 23 that functionality, before calling the get* function. 24 25 * WebCore.xcodeproj/project.pbxproj: 26 * editing/mac/DictionaryLookup.mm: 27 (WebCore::rangeForDictionaryLookupForSelection): 28 (WebCore::rangeForDictionaryLookupAtHitTestResult): 29 Adopt the Lookup SPI header. 30 1 31 2014-11-18 Dana Burkart <dburkart@apple.com> 2 32 -
branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in
r176249 r176281 2421 2421 _wkDrawTextFieldCellFocusRing 2422 2422 _wkExecutableWasLinkedOnOrBeforeSnowLeopard 2423 _wkExtractWordDefinitionTokenRangeFromContextualString2424 2423 _wkGetAXTextMarkerRangeTypeID 2425 2424 _wkGetAXTextMarkerTypeID -
branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r176249 r176281 1084 1084 2D3EF44A1917915C00034184 /* WebCoreCALayerExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3EF4461917915C00034184 /* WebCoreCALayerExtras.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1085 1085 2D3EF44B1917915C00034184 /* WebCoreCALayerExtras.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4471917915C00034184 /* WebCoreCALayerExtras.mm */; }; 1086 2D413F611A187A3F0041A521 /* LookupSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D413F601A187A3F0041A521 /* LookupSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1086 1087 2D46F04E17B96FBD005647F0 /* IntPoint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04D17B96FBD005647F0 /* IntPoint.cpp */; }; 1087 1088 2D46F05017B96FD2005647F0 /* IntSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D46F04F17B96FD2005647F0 /* IntSize.cpp */; }; … … 8107 8108 2D3EF4461917915C00034184 /* WebCoreCALayerExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreCALayerExtras.h; sourceTree = "<group>"; }; 8108 8109 2D3EF4471917915C00034184 /* WebCoreCALayerExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreCALayerExtras.mm; sourceTree = "<group>"; }; 8110 2D413F601A187A3F0041A521 /* LookupSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LookupSPI.h; sourceTree = "<group>"; }; 8109 8111 2D46F04D17B96FBD005647F0 /* IntPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntPoint.cpp; sourceTree = "<group>"; }; 8110 8112 2D46F04F17B96FD2005647F0 /* IntSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntSize.cpp; sourceTree = "<group>"; }; … … 17630 17632 children = ( 17631 17633 2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */, 17634 2D413F601A187A3F0041A521 /* LookupSPI.h */, 17632 17635 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */, 17633 17636 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */, … … 23627 23630 A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */, 23628 23631 2D29ECC8192ECC8300984B78 /* DisplayRefreshMonitorManager.h in Headers */, 23632 2D413F611A187A3F0041A521 /* LookupSPI.h in Headers */, 23629 23633 6550B6A2099DF0270090D781 /* Comment.h in Headers */, 23630 23634 E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */, -
branches/safari-600.3-branch/Source/WebCore/editing/mac/DictionaryLookup.mm
r176249 r176281 35 35 #import "HTMLConverter.h" 36 36 #import "HitTestResult.h" 37 #import "LookupSPI.h" 37 38 #import "Page.h" 38 39 #import "Range.h" … … 116 117 117 118 // Since we already have the range we want, we just need to grab the returned options. 118 wkExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options); 119 119 if (Class luLookupDefinitionModule = getLULookupDefinitionModuleClass()) 120 [luLookupDefinitionModule tokenRangeForString:fullPlainTextString range:rangeToPass options:options]; 121 120 122 return selectedRange.release(); 121 123 } … … 156 158 String fullPlainTextString = plainText(fullCharacterRange.get()); 157 159 158 NSRange extractedRange = wkExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options); 160 NSRange extractedRange = NSMakeRange(rangeToPass.location, 0); 161 if (Class luLookupDefinitionModule = getLULookupDefinitionModuleClass()) 162 extractedRange = [luLookupDefinitionModule tokenRangeForString:fullPlainTextString range:rangeToPass options:options]; 159 163 160 164 // This function sometimes returns {NSNotFound, 0} if it was unable to determine a good string. -
branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.h
r176249 r176281 289 289 extern bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void); 290 290 291 extern NSRange (*wkExtractWordDefinitionTokenRangeFromContextualString)(NSString *contextString, NSRange range, NSDictionary **options);292 293 291 extern CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void); 294 292 -
branches/safari-600.3-branch/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
r176249 r176281 147 147 bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void); 148 148 149 NSRange (*wkExtractWordDefinitionTokenRangeFromContextualString)(NSString *contextString, NSRange range, NSDictionary **options);150 151 149 CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void); 152 150 void (*wkSetCrashReportApplicationSpecificInformation)(CFStringRef); -
branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog
r176249 r176281 1 2014-11-18 Dana Burkart <dburkart@apple.com> 2 3 Merge r176164. rdar://problem/18953982 4 5 2014-11-16 Tim Horton <timothy_horton@apple.com> 6 7 Use TextIndicator instead of the built in Lookup highlight 8 https://bugs.webkit.org/show_bug.cgi?id=138775 9 <rdar://problem/18953982> 10 11 Reviewed by Anders Carlsson. 12 13 * WebCoreSupport/WebSystemInterface.mm: 14 (InitWebCoreSystemInterface): 15 Remove a WKSI import. 16 17 * WebView/WebActionMenuController.mm: 18 (-[WebActionMenuController _lookupText:]): 19 (-[WebActionMenuController _createActionMenuItemForTag:]): 20 Make use of the new Lookup SPI header. 21 Disable the Lookup item if lookup is not available. 22 1 23 2014-11-17 Dana Burkart <dburkart@apple.com> 2 24 -
branches/safari-600.3-branch/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
r176249 r176281 164 164 INIT(RecommendedScrollerStyle); 165 165 INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard); 166 INIT(ExtractWordDefinitionTokenRangeFromContextualString);167 166 INIT(CopyDefaultSearchProviderDisplayName); 168 167 INIT(Cursor); -
branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm
r176249 r176281 49 49 #import <WebCore/HTMLConverter.h> 50 50 #import <WebCore/LocalizedStrings.h> 51 #import <WebCore/LookupSPI.h> 51 52 #import <WebCore/NSSharingServicePickerSPI.h> 52 53 #import <WebCore/NSSharingServiceSPI.h> … … 565 566 textBaselineOrigin = [_webView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin; 566 567 567 WKShowWordDefinitionWindow(popupInfo.attributedString.get(), textBaselineOrigin, popupInfo.options.get());568 [getLULookupDefinitionModuleClass() showDefinitionForTerm:popupInfo.attributedString.get() atLocation:textBaselineOrigin options:popupInfo.options.get()]; 568 569 } 569 570 … … 691 692 NSString *title = nil; 692 693 NSImage *image = nil; 694 bool enabled = true; 693 695 694 696 switch (tag) { … … 721 723 title = WEB_UI_STRING_KEY("Look Up", "Look Up (action menu item)", "action menu item"); 722 724 image = [NSImage imageNamed:@"NSActionMenuLookup"]; 725 enabled = getLULookupDefinitionModuleClass(); 723 726 break; 724 727 … … 783 786 [item setTarget:self]; 784 787 [item setTag:tag]; 788 [item setEnabled:enabled]; 785 789 return item; 786 790 } -
branches/safari-600.3-branch/Source/WebKit2/ChangeLog
r176280 r176281 1 2014-11-18 Dana Burkart <dburkart@apple.com> 2 3 Merge r176164. rdar://problem/18953982 4 5 2014-11-16 Tim Horton <timothy_horton@apple.com> 6 7 Use TextIndicator instead of the built in Lookup highlight 8 https://bugs.webkit.org/show_bug.cgi?id=138775 9 <rdar://problem/18953982> 10 11 Reviewed by Anders Carlsson. 12 13 In order to make the yellow highlight for Lookup more accurately match the 14 painted content of the web page (in light of e.g. Web fonts, and interesting 15 text features that only WebKit implements and cannot round-trip through 16 NSAttributedString), use a TextIndicator instead of the built-in Lookup 17 highlight where possible. 18 19 * Configurations/BaseTarget.xcconfig: 20 Make it possible to include headers from private frameworks. This matches WebCore. 21 22 * Shared/DictionaryPopupInfo.cpp: 23 (WebKit::DictionaryPopupInfo::encode): 24 (WebKit::DictionaryPopupInfo::decode): 25 * Shared/DictionaryPopupInfo.h: 26 Include the attributed string inside the DictionaryPopupInfo, instead of 27 as a secondary argument to DidPerformDictionaryLookup. 28 Add a TextIndicator to DictionaryPopupInfo, which can be used to highlight 29 the text in the UI process. 30 31 * UIProcess/API/mac/WKView.mm: 32 (-[WKView dealloc]): 33 (-[WKView viewDidMoveToWindow]): 34 (-[WKView _dictionaryLookupPopoverWillClose:]): 35 (-[WKView _setTextIndicator:fadeOut:animate:animationCompletionHandler:]): 36 (-[WKView _setTextIndicator:fadeOut:animate:]): 37 (-[WKView initWithFrame:context:configuration:webView:]): 38 (+[WKView hideWordDefinitionWindow]): 39 * UIProcess/API/mac/WKViewInternal.h: 40 Adopt the Lookup SPI header. 41 If we have the requisite API, register the notification that Lookup sends 42 when the popover closes, and hook that up to hide the text indicator. 43 Add a version of _setTextIndicator: that takes an animation completion handler. 44 45 * UIProcess/PageClient.h: 46 * UIProcess/WebPageProxy.h: 47 * UIProcess/WebPageProxy.messages.in: 48 * UIProcess/ios/WebPageProxyIOS.mm: 49 (WebKit::WebPageProxy::didPerformDictionaryLookup): 50 * UIProcess/mac/WebPageProxyMac.mm: 51 (WebKit::WebPageProxy::didPerformDictionaryLookup): 52 Adjust to the new didPerformDictionaryLookup signature. 53 54 * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: 55 (InitWebCoreSystemInterface): 56 Remove a WKSI import. 57 58 * UIProcess/mac/PageClientImpl.h: 59 * UIProcess/mac/PageClientImpl.mm: 60 (WebKit::PageClientImpl::didPerformDictionaryLookup): 61 If we have the requisite API, disable Lookup's built-in highlight and 62 present a TextIndicator instead. 63 We currently have to run the animations serially (first bounce the TextIndicator, 64 then animate in the Lookup popover) because the act of adding the Lookup popover 65 blocks us from getting any animation events for the TextIndicator, and breaks 66 the bounce. We could also fix this by using a threaded animation for the TextIndicator, 67 but it's not clear that it's safe to do so. 68 69 (WebKit::PageClientImpl::dismissDictionaryLookupPanel): 70 When explicitly dismissing the Lookup panel, also hide the text indicator. 71 72 * UIProcess/mac/TextIndicatorWindow.h: 73 * UIProcess/mac/TextIndicatorWindow.mm: 74 (WebKit::TextIndicatorWindow::setTextIndicator): 75 Store the completion handler. 76 77 (WebKit::TextIndicatorWindow::bounceAnimationDidEnd): 78 Call the completion handler when the animation completes. 79 80 * UIProcess/mac/WKActionMenuController.mm: 81 (-[WKActionMenuController _createActionMenuItemForTag:]): 82 Disable the Lookup item if lookup is not available. 83 84 * WebProcess/Plugins/PDF/PDFPlugin.mm: 85 (WebKit::PDFPlugin::showDefinitionForAttributedString): 86 Adjust to the new didPerformDictionaryLookup signature. 87 Since PDFPlugin can't trivially repaint the required part of the PDF, 88 we don't build a TextIndicator. This will result in PDFPlugin continuing 89 to use Lookup's built-in highlight. 90 91 * WebProcess/WebPage/mac/WebPageMac.mm: 92 (WebKit::WebPage::performDictionaryLookupForRange): 93 Build a TextIndicator from the Lookup range and pass it along with 94 the DictionaryPopupInfo. 95 1 96 2014-11-18 Dana Burkart <dburkart@apple.com> 2 97 -
branches/safari-600.3-branch/Source/WebKit2/Configurations/BaseTarget.xcconfig
r176249 r176281 30 30 HEADER_SEARCH_PATHS = $(BUILT_PRODUCTS_DIR)/usr/local/include $(WEBCORE_PRIVATE_HEADERS_DIR)/ForwardingHeaders $(WEBCORE_PRIVATE_HEADERS_DIR)/icu $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2 $(HEADER_SEARCH_PATHS); 31 31 32 OTHER_CFLAGS = $(inherited) -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks ;32 OTHER_CFLAGS = $(inherited) -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/ApplicationServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/Quartz.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/Frameworks/CoreServices.framework/Frameworks -iframework $(SDKROOT)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks; 33 33 OTHER_CPLUSPLUSFLAGS = $(OTHER_CFLAGS); 34 34 -
branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
r176249 r176281 38 38 { 39 39 encoder << origin; 40 encoder << textIndicator; 40 41 41 42 #if PLATFORM(COCOA) … … 44 45 if (hadOptions) 45 46 IPC::encode(encoder, options.get()); 47 48 encoder << attributedString; 46 49 #endif 47 50 } … … 51 54 if (!decoder.decode(result.origin)) 52 55 return false; 56 57 if (!decoder.decode(result.textIndicator)) 58 return false; 59 53 60 #if PLATFORM(COCOA) 54 61 bool hadOptions; … … 59 66 return false; 60 67 } 68 69 if (!decoder.decode(result.attributedString)) 70 return false; 61 71 #endif 62 72 return true; -
branches/safari-600.3-branch/Source/WebKit2/Shared/DictionaryPopupInfo.h
r176249 r176281 27 27 #define DictionaryPopupInfo_h 28 28 29 #include "TextIndicator.h" 29 30 #include <WebCore/FloatPoint.h> 30 31 31 32 #if PLATFORM(COCOA) 33 #include "AttributedString.h" 32 34 #include <wtf/RetainPtr.h> 33 35 #endif 34 36 35 37 namespace IPC { 36 class ArgumentDecoder;37 class ArgumentEncoder;38 class ArgumentDecoder; 39 class ArgumentEncoder; 38 40 } 39 41 … … 45 47 46 48 WebCore::FloatPoint origin; 49 TextIndicator::Data textIndicator; 47 50 #if PLATFORM(COCOA) 48 51 RetainPtr<CFDictionaryRef> options; 52 AttributedString attributedString; 49 53 #endif 50 54 }; -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm
r176249 r176281 89 89 #import <WebCore/KeyboardEvent.h> 90 90 #import <WebCore/LocalizedStrings.h> 91 #import <WebCore/LookupSPI.h> 91 92 #import <WebCore/NSViewSPI.h> 92 93 #import <WebCore/PlatformEventFactoryMac.h> … … 325 326 326 327 [[NSNotificationCenter defaultCenter] removeObserver:self name:NSApplicationWillTerminateNotification object:NSApp]; 328 329 if (canDisableLookupIndicator()) 330 [[NSNotificationCenter defaultCenter] removeObserver:self name:getLUNotificationPopoverWillClose() object:nil]; 327 331 328 332 WebContext::statistics().wkViewCount--; … … 2554 2558 _data->_flagsChangedEventMonitor = nil; 2555 2559 2556 WKHideWordDefinitionWindow(); 2560 if (getLULookupDefinitionModuleClass()) 2561 [getLULookupDefinitionModuleClass() hideDefinition]; 2557 2562 [self _dismissActionMenuPopovers]; 2558 2563 } … … 2688 2693 { 2689 2694 _data->_page->process().context().applicationWillTerminate(); 2695 } 2696 2697 - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification 2698 { 2699 [self _setTextIndicator:nil fadeOut:NO animate:NO]; 2690 2700 } 2691 2701 … … 3058 3068 } 3059 3069 3060 - (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate 3070 - (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate animationCompletionHandler:(std::function<void ()>)completionHandler 3061 3071 { 3062 3072 if (!textIndicator) { … … 3068 3078 _data->_textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self); 3069 3079 3070 _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, animate); 3080 _data->_textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, animate, WTF::move(completionHandler)); 3081 } 3082 3083 - (void)_setTextIndicator:(PassRefPtr<TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate 3084 { 3085 [self _setTextIndicator:textIndicator fadeOut:fadeOut animate:animate animationCompletionHandler:[] {}]; 3071 3086 } 3072 3087 … … 3560 3575 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate:) name:NSApplicationWillTerminateNotification object:NSApp]; 3561 3576 3577 if (canDisableLookupIndicator()) 3578 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil]; 3579 3562 3580 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 3563 3581 if ([self respondsToSelector:@selector(setActionMenu:)]) { … … 3802 3820 + (void)hideWordDefinitionWindow 3803 3821 { 3804 WKHideWordDefinitionWindow(); 3822 if (!getLULookupDefinitionModuleClass()) 3823 return; 3824 [getLULookupDefinitionModuleClass() hideDefinition]; 3805 3825 } 3806 3826 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h
r176249 r176281 82 82 - (NSRect)_convertToUserSpace:(NSRect)rect; 83 83 - (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate; 84 - (void)_setTextIndicator:(PassRefPtr<WebKit::TextIndicator>)textIndicator fadeOut:(BOOL)fadeOut animate:(BOOL)animate animationCompletionHandler:(std::function<void ()>)completionHandler; 84 85 85 86 - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer; -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h
r176249 r176281 224 224 virtual void pluginFocusOrWindowFocusChanged(uint64_t pluginComplexTextInputIdentifier, bool pluginHasFocusAndWindowHasFocus) = 0; 225 225 virtual void setPluginComplexTextInputState(uint64_t pluginComplexTextInputIdentifier, PluginComplexTextInputState) = 0; 226 virtual void didPerformDictionaryLookup(const AttributedString&, constDictionaryPopupInfo&) = 0;226 virtual void didPerformDictionaryLookup(const DictionaryPopupInfo&) = 0; 227 227 virtual void dismissDictionaryLookupPanel() = 0; 228 228 virtual void dismissActionMenuPopovers() = 0; -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.h
r176249 r176281 1149 1149 1150 1150 // Dictionary. 1151 void didPerformDictionaryLookup(const AttributedString&, constDictionaryPopupInfo&);1151 void didPerformDictionaryLookup(const DictionaryPopupInfo&); 1152 1152 #endif 1153 1153 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r176249 r176281 288 288 #if PLATFORM(COCOA) 289 289 # Dictionary support. 290 DidPerformDictionaryLookup(WebKit:: AttributedString text, WebKit::DictionaryPopupInfo dictionaryPopupInfo)290 DidPerformDictionaryLookup(WebKit::DictionaryPopupInfo dictionaryPopupInfo) 291 291 292 292 # Keyboard input support messages -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm
r176249 r176281 751 751 } 752 752 753 void WebPageProxy::didPerformDictionaryLookup(const AttributedString&, constDictionaryPopupInfo&)753 void WebPageProxy::didPerformDictionaryLookup(const DictionaryPopupInfo&) 754 754 { 755 755 notImplemented(); -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h
r176249 r176281 137 137 virtual void makeFirstResponder(); 138 138 139 virtual void didPerformDictionaryLookup(const AttributedString&, constDictionaryPopupInfo&);139 virtual void didPerformDictionaryLookup(const DictionaryPopupInfo&); 140 140 virtual void dismissDictionaryLookupPanel(); 141 141 virtual void dismissActionMenuPopovers(); -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm
r176249 r176281 59 59 #import <WebCore/Image.h> 60 60 #import <WebCore/KeyboardEvent.h> 61 #import <WebCore/LookupSPI.h> 61 62 #import <WebCore/NotImplemented.h> 62 63 #import <WebCore/SharedBuffer.h> … … 530 531 } 531 532 532 void PageClientImpl::didPerformDictionaryLookup(const AttributedString& text, const DictionaryPopupInfo& dictionaryPopupInfo) 533 { 534 RetainPtr<NSAttributedString> attributedString = text.string; 533 void PageClientImpl::didPerformDictionaryLookup(const DictionaryPopupInfo& dictionaryPopupInfo) 534 { 535 if (!getLULookupDefinitionModuleClass()) 536 return; 537 535 538 NSPoint textBaselineOrigin = dictionaryPopupInfo.origin; 536 539 … … 539 542 textBaselineOrigin = [m_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin; 540 543 541 WKShowWordDefinitionWindow(attributedString.get(), textBaselineOrigin, (NSDictionary *)dictionaryPopupInfo.options.get()); 544 RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([(NSDictionary *)dictionaryPopupInfo.options.get() mutableCopy]); 545 546 if (canDisableLookupIndicator() && dictionaryPopupInfo.textIndicator.contentImage) { 547 // Run the animations serially because attaching another subwindow breaks the bounce animation. 548 // We could consider making the bounce NSAnimationNonblockingThreaded instead, which seems 549 // to work, but need to consider all of the implications. 550 [m_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO animate:YES animationCompletionHandler:[dictionaryPopupInfo, textBaselineOrigin, mutableOptions] { 551 [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()]; 552 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()]; 553 }]; 554 } else 555 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()]; 542 556 } 543 557 544 558 void PageClientImpl::dismissDictionaryLookupPanel() 545 559 { 560 if (!getLULookupDefinitionModuleClass()) 561 return; 562 546 563 // FIXME: We don't know which panel we are dismissing, it may not even be in the current page (see <rdar://problem/13875766>). 547 WKHideWordDefinitionWindow(); 564 [getLULookupDefinitionModuleClass() hideDefinition]; 565 setTextIndicator(nil, false, true); 548 566 } 549 567 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.h
r176249 r176281 30 30 31 31 #import "WebKitSystemInterface.h" 32 #import <functional> 32 33 #import <wtf/Noncopyable.h> 33 34 #import <wtf/RefPtr.h> … … 49 50 ~TextIndicatorWindow(); 50 51 51 void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate );52 void setTextIndicator(PassRefPtr<TextIndicator>, bool fadeOut, bool animate, std::function<void ()> animationCompletionHandler); 52 53 53 54 private: … … 71 72 RunLoop::Timer<TextIndicatorWindow> m_startFadeOutTimer; 72 73 RetainPtr<WKTextIndicatorWindowAnimation> m_fadeOutAnimation; 74 75 std::function<void ()> m_bounceAnimationCompletionHandler; 73 76 }; 74 77 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/TextIndicatorWindow.mm
r176249 r176281 121 121 } 122 122 123 void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate )123 void TextIndicatorWindow::setTextIndicator(PassRefPtr<TextIndicator> textIndicator, bool fadeOut, bool animate, std::function<void ()> animationCompletionHandler) 124 124 { 125 125 if (m_textIndicator == textIndicator) … … 155 155 156 156 if (animate) { 157 m_bounceAnimationCompletionHandler = WTF::move(animationCompletionHandler); 157 158 // Start the bounce animation. 158 159 m_bounceAnimationContext = WKWindowBounceAnimationContextCreate(m_textIndicatorWindow.get()); … … 231 232 WKWindowBounceAnimationContextDestroy(m_bounceAnimationContext); 232 233 m_bounceAnimationContext = 0; 234 m_bounceAnimationCompletionHandler(); 233 235 } 234 236 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm
r176249 r176281 46 46 #import <WebCore/GeometryUtilities.h> 47 47 #import <WebCore/LocalizedStrings.h> 48 #import <WebCore/LookupSPI.h> 48 49 #import <WebCore/NSSharingServiceSPI.h> 49 50 #import <WebCore/NSSharingServicePickerSPI.h> … … 757 758 NSString *title = nil; 758 759 NSImage *image = nil; 760 bool enabled = true; 759 761 760 762 switch (tag) { … … 812 814 title = WEB_UI_STRING_KEY("Look Up", "Look Up (action menu item)", "action menu item"); 813 815 image = [NSImage imageNamed:@"NSActionMenuLookup"]; 816 enabled = getLULookupDefinitionModuleClass(); 814 817 break; 815 818 … … 851 854 [item setTarget:self]; 852 855 [item setTag:tag]; 856 [item setEnabled:enabled]; 853 857 return item; 854 858 } -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm
r176249 r176281 451 451 } 452 452 453 void WebPageProxy::didPerformDictionaryLookup(const AttributedString& text, constDictionaryPopupInfo& dictionaryPopupInfo)454 { 455 m_pageClient.didPerformDictionaryLookup( text,dictionaryPopupInfo);453 void WebPageProxy::didPerformDictionaryLookup(const DictionaryPopupInfo& dictionaryPopupInfo) 454 { 455 m_pageClient.didPerformDictionaryLookup(dictionaryPopupInfo); 456 456 } 457 457 -
branches/safari-600.3-branch/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
r176249 r176281 1701 1701 DictionaryPopupInfo dictionaryPopupInfo; 1702 1702 dictionaryPopupInfo.origin = convertFromPDFViewToRootView(IntPoint(point)); 1703 1704 AttributedString attributedString; 1705 attributedString.string = string; 1706 1707 webFrame()->page()->send(Messages::WebPageProxy::DidPerformDictionaryLookup(attributedString, dictionaryPopupInfo)); 1703 dictionaryPopupInfo.attributedString.string = string; 1704 1705 webFrame()->page()->send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfo)); 1708 1706 } 1709 1707 -
branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
r176249 r176281 154 154 INIT(RecommendedScrollerStyle); 155 155 INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard); 156 INIT(ExtractWordDefinitionTokenRangeFromContextualString);157 156 INIT(CopyDefaultSearchProviderDisplayName); 158 157 INIT(Cursor); -
branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
r176249 r176281 544 544 }]; 545 545 546 AttributedString attributedString; 547 attributedString.string = scaledNSAttributedString; 548 549 send(Messages::WebPageProxy::DidPerformDictionaryLookup(attributedString, dictionaryPopupInfo)); 546 RefPtr<TextIndicator> textIndicator = TextIndicator::createWithRange(range); 547 if (!textIndicator) 548 return; 549 550 dictionaryPopupInfo.textIndicator = textIndicator->data(); 551 dictionaryPopupInfo.attributedString.string = scaledNSAttributedString; 552 553 send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfo)); 550 554 } 551 555
Note:
See TracChangeset
for help on using the changeset viewer.