Changeset 176737 in webkit
- Timestamp:
- Dec 3, 2014, 12:15:51 PM (12 years ago)
- Location:
- branches/safari-600.3-branch/Source/WebKit
- Files:
-
- 1 added
- 7 edited
-
ChangeLog (modified) (1 diff)
-
WebKit.xcodeproj/project.pbxproj (modified) (4 diffs)
-
mac/ChangeLog (modified) (1 diff)
-
mac/WebView/DictionaryPopupInfo.h (added)
-
mac/WebView/WebActionMenuController.mm (modified) (5 diffs)
-
mac/WebView/WebHTMLView.mm (modified) (3 diffs)
-
mac/WebView/WebView.mm (modified) (7 diffs)
-
mac/WebView/WebViewInternal.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-600.3-branch/Source/WebKit/ChangeLog
r175302 r176737 1 2014-12-03 Dana Burkart <dburkart@apple.com> 2 3 Merge r176680. <rdar://problem/19067172> 4 5 2014-12-02 Tim Horton <timothy_horton@apple.com> 6 7 Implement Lookup transition from selection for Legacy WebKit 8 https://bugs.webkit.org/show_bug.cgi?id=139180 9 <rdar://problem/19067172> 10 11 Reviewed by Beth Dakin. 12 13 * WebKit.xcodeproj/project.pbxproj: 14 Add mac/WebView/DictionaryPopupInfo.h. 15 16 1 17 2014-10-28 Dana Burkart <dburkart@apple.com> 2 18 -
branches/safari-600.3-branch/Source/WebKit/WebKit.xcodeproj/project.pbxproj
r175306 r176737 86 86 2DD632C219E5D1F0002E9C7B /* WebSelectionServiceController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD632C019E5D1F0002E9C7B /* WebSelectionServiceController.h */; }; 87 87 2DD632C319E5D1F0002E9C7B /* WebSelectionServiceController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DD632C119E5D1F0002E9C7B /* WebSelectionServiceController.mm */; }; 88 2DF064A91A2DD53C00DBB354 /* DictionaryPopupInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DF064A81A2DD53C00DBB354 /* DictionaryPopupInfo.h */; }; 88 89 312E2FE514E48182007CCA18 /* WebNotification.h in Headers */ = {isa = PBXBuildFile; fileRef = 312E2FE314E48182007CCA18 /* WebNotification.h */; settings = {ATTRIBUTES = (Private, ); }; }; 89 90 312E2FE614E48182007CCA18 /* WebNotification.mm in Sources */ = {isa = PBXBuildFile; fileRef = 312E2FE414E48182007CCA18 /* WebNotification.mm */; }; … … 542 543 2DD632C019E5D1F0002E9C7B /* WebSelectionServiceController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSelectionServiceController.h; sourceTree = "<group>"; }; 543 544 2DD632C119E5D1F0002E9C7B /* WebSelectionServiceController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSelectionServiceController.mm; sourceTree = "<group>"; }; 545 2DF064A81A2DD53C00DBB354 /* DictionaryPopupInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryPopupInfo.h; sourceTree = "<group>"; }; 544 546 312E2FE314E48182007CCA18 /* WebNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNotification.h; sourceTree = "<group>"; }; 545 547 312E2FE414E48182007CCA18 /* WebNotification.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebNotification.mm; sourceTree = "<group>"; }; … … 1295 1297 51E94C0706C02CA300A9B09E /* PDF */, 1296 1298 A10C1D79182030190036883A /* ios */, 1299 2DF064A81A2DD53C00DBB354 /* DictionaryPopupInfo.h */, 1297 1300 935D44E219F9AFF000FB5306 /* WebActionMenuController.h */, 1298 1301 935D44E319F9AFF000FB5306 /* WebActionMenuController.mm */, … … 1815 1818 9398106D0824BF01008DF038 /* WebKitErrorsPrivate.h in Headers */, 1816 1819 CD8BFCE815531224005AFB25 /* WebKitFullScreenListener.h in Headers */, 1820 2DF064A91A2DD53C00DBB354 /* DictionaryPopupInfo.h in Headers */, 1817 1821 9398101D0824BF01008DF038 /* WebKitLogging.h in Headers */, 1818 1822 9398101E0824BF01008DF038 /* WebKitNSStringExtras.h in Headers */, -
branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog
r176663 r176737 1 2014-12-03 Dana Burkart <dburkart@apple.com> 2 3 Merge r176680. <rdar://problem/19067172> 4 5 2014-12-02 Tim Horton <timothy_horton@apple.com> 6 7 Implement Lookup transition from selection for Legacy WebKit 8 https://bugs.webkit.org/show_bug.cgi?id=139180 9 <rdar://problem/19067172> 10 11 Reviewed by Beth Dakin. 12 13 * WebView/DictionaryPopupInfo.h: Added. 14 Split DictionaryPopupInfo out into its own file. 15 16 * WebView/WebActionMenuController.mm: 17 (-[WebActionMenuController _lookupText:]): 18 Hand the DictionaryPopupInfo to WebView, which will show the TextIndicator and invoke Lookup. 19 20 (performDictionaryLookupForSelection): 21 (performDictionaryLookupForRange): 22 Plumb the transition style through these helpers. 23 Create a TextIndicator from the selection range. 24 25 * WebView/WebHTMLView.mm: 26 (-[WebHTMLView _lookUpInDictionaryFromMenu:]): 27 Make use of TextIndicator (and DictionaryPopupInfo, and the new 28 _showDictionaryLookupPopup on WebView) to add a transition from blue 29 when performing Lookup from the context menu. 30 31 (-[WebHTMLView quickLookWithEvent:]): 32 Remove our TextIndicator whenever a normal three-finger-tap event 33 comes through, as it will have its own indication. 34 35 * WebView/WebView.mm: 36 (-[WebView _commonInitializationWithFrameName:groupName:]): 37 (-[WebView _dictionaryLookupPopoverWillClose:]): 38 Register for the LUNotificationPopoverWillClose notification and remove 39 our TextIndicator when it is called, just like in WebKit2. 40 Deregistration is already handled in _close. 41 42 (-[WebView _showDictionaryLookupPopup:]): 43 Just like WebKit2, show our TextIndicator and tell Lookup not to show its own, 44 if the relevant API is available. 45 46 * WebView/WebViewInternal.h: 47 48 1 49 2014-12-02 Dana Burkart <dburkart@apple.com> 2 50 -
branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm
r176662 r176737 31 31 #import "DOMNodeInternal.h" 32 32 #import "DOMRangeInternal.h" 33 #import "DictionaryPopupInfo.h" 33 34 #import "WebDocumentInternal.h" 34 35 #import "WebElementDictionary.h" … … 88 89 using namespace WebCore; 89 90 90 struct DictionaryPopupInfo {91 NSPoint origin;92 RetainPtr<NSDictionary> options;93 RetainPtr<NSAttributedString> attributedString;94 };95 96 91 @implementation WebActionMenuController 97 92 … … 635 630 636 631 DictionaryPopupInfo popupInfo = performDictionaryLookupForSelection(frame, frame->selection().selection()); 637 if (!popupInfo.attributedString) 638 return; 639 640 NSPoint textBaselineOrigin = popupInfo.origin; 641 642 // Convert to screen coordinates. 643 textBaselineOrigin = [_webView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin; 644 645 [getLULookupDefinitionModuleClass() showDefinitionForTerm:popupInfo.attributedString.get() atLocation:textBaselineOrigin options:popupInfo.options.get()]; 632 [_webView _showDictionaryLookupPopup:popupInfo]; 646 633 } 647 634 … … 683 670 RefPtr<Range> selectedRange = rangeForDictionaryLookupForSelection(selection, &options); 684 671 if (selectedRange) 685 popupInfo = performDictionaryLookupForRange(frame, *selectedRange, options );672 popupInfo = performDictionaryLookupForRange(frame, *selectedRange, options, TextIndicatorPresentationTransition::BounceAndCrossfade); 686 673 return popupInfo; 687 674 } 688 675 689 static DictionaryPopupInfo performDictionaryLookupForRange(Frame* frame, Range& range, NSDictionary *options )676 static DictionaryPopupInfo performDictionaryLookupForRange(Frame* frame, Range& range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition) 690 677 { 691 678 DictionaryPopupInfo popupInfo; … … 723 710 724 711 popupInfo.attributedString = scaledNSAttributedString.get(); 712 popupInfo.textIndicator = TextIndicator::createWithRange(range, presentationTransition); 725 713 return popupInfo; 726 714 } -
branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebHTMLView.mm
r176662 r176737 35 35 #import "DOMNodeInternal.h" 36 36 #import "DOMRangeInternal.h" 37 #import "DictionaryPopupInfo.h" 37 38 #import "WebActionMenuController.h" 38 39 #import "WebArchive.h" … … 115 116 #import <WebCore/Text.h> 116 117 #import <WebCore/TextAlternativeWithRange.h> 118 #import <WebCore/TextIndicator.h> 117 119 #import <WebCore/TextUndoInsertionMarkupMac.h> 118 120 #import <WebCore/WebCoreObjCExtras.h> … … 5683 5685 NSRect rect = coreFrame->selection().selectionBounds(); 5684 5686 5685 NSDictionary *attributes = [attrString fontAttributesInRange:NSMakeRange(0, 1)];5687 NSDictionary *attributes = [attrString fontAttributesInRange:NSMakeRange(0, 1)]; 5686 5688 NSFont *font = [attributes objectForKey:NSFontAttributeName]; 5687 5689 if (font) 5688 rect.origin.y += [font ascender]; 5689 5690 [self showDefinitionForAttributedString:attrString atPoint:rect.origin]; 5690 rect.origin.y += [font descender]; 5691 5692 DictionaryPopupInfo info; 5693 info.attributedString = attrString; 5694 info.origin = coreFrame->view()->contentsToWindow(enclosingIntRect(rect)).location(); 5695 info.textIndicator = TextIndicator::createWithSelectionInFrame(*coreFrame, TextIndicatorPresentationTransition::BounceAndCrossfade); 5696 [[self _webView] _showDictionaryLookupPopup:info]; 5697 } 5698 5699 - (void)quickLookWithEvent:(NSEvent *)event 5700 { 5701 [[self _webView] _setTextIndicator:nullptr fadeOut:NO animationCompletionHandler:[] { }]; 5702 [super quickLookWithEvent:event]; 5691 5703 } 5692 5704 #endif // !PLATFORM(IOS) -
branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm
r176663 r176737 36 36 #import "DOMNodeInternal.h" 37 37 #import "DOMRangeInternal.h" 38 #import "DictionaryPopupInfo.h" 38 39 #import "WebAlternativeTextClient.h" 39 40 #import "WebApplicationCache.h" … … 209 210 #import "WebNSPrintOperationExtras.h" 210 211 #import "WebPDFView.h" 212 #import <WebCore/LookupSPI.h> 211 213 #import <WebCore/NSViewSPI.h> 214 #import <WebCore/SoftLinking.h> 212 215 #import <WebCore/TextIndicator.h> 213 216 #import <WebCore/TextIndicatorWindow.h> … … 291 294 #if ENABLE(GAMEPAD) 292 295 #import <WebCore/HIDGamepadProvider.h> 296 #endif 297 298 #if PLATFORM(MAC) 299 SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *) 300 SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUTermOptionDisableSearchTermIndicator, NSString *) 293 301 #endif 294 302 … … 1025 1033 #if !PLATFORM(IOS) 1026 1034 [self _registerDraggedTypes]; 1035 1036 if (canLoadLUNotificationPopoverWillClose()) 1037 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil]; 1027 1038 #endif 1028 1039 … … 8555 8566 } 8556 8567 8557 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 8568 #if PLATFORM(MAC) 8569 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 8558 8570 - (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event 8559 8571 { … … 8579 8591 [_private->actionMenuController didCloseMenu:menu withEvent:event]; 8580 8592 } 8593 8594 - (WebActionMenuController *)_actionMenuController 8595 { 8596 return _private->actionMenuController; 8597 } 8598 #endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 8581 8599 8582 8600 - (void)_setTextIndicator:(TextIndicator *)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function<void ()>)completionHandler … … 8598 8616 } 8599 8617 8600 - (WebActionMenuController *)_actionMenuController 8601 { 8602 return _private->actionMenuController; 8603 } 8604 #endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 8618 - (void)_showDictionaryLookupPopup:(const DictionaryPopupInfo&)dictionaryPopupInfo 8619 { 8620 if (!dictionaryPopupInfo.attributedString) 8621 return; 8622 8623 NSPoint textBaselineOrigin = dictionaryPopupInfo.origin; 8624 8625 // Convert to screen coordinates. 8626 textBaselineOrigin = [self.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin; 8627 8628 if (canLoadLUTermOptionDisableSearchTermIndicator()) { 8629 RetainPtr<NSMutableDictionary> mutableOptions = adoptNS([dictionaryPopupInfo.options mutableCopy]); 8630 if (!mutableOptions) 8631 mutableOptions = adoptNS([[NSMutableDictionary alloc] init]); 8632 [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()]; 8633 [self _setTextIndicator:dictionaryPopupInfo.textIndicator.get() fadeOut:NO animationCompletionHandler:[dictionaryPopupInfo, textBaselineOrigin, mutableOptions] { 8634 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()]; 8635 }]; 8636 } else 8637 [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:dictionaryPopupInfo.options.get()]; 8638 } 8639 8640 - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification 8641 { 8642 [self _setTextIndicator:nullptr fadeOut:NO animationCompletionHandler:[] { }]; 8643 } 8644 #endif // PLATFORM(MAC) 8605 8645 8606 8646 @end -
branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h
r176662 r176737 59 59 } 60 60 61 struct DictionaryPopupInfo; 61 62 class WebSelectionServiceController; 62 63 #endif … … 259 260 - (void)_setTextIndicator:(WebCore::TextIndicator*)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function<void ()>)completionHandler; 260 261 - (void)_clearTextIndicator; 262 - (void)_showDictionaryLookupPopup:(const DictionaryPopupInfo&)dictionaryPopupInfo; 261 263 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 262 264 - (WebActionMenuController *)_actionMenuController;
Note:
See TracChangeset
for help on using the changeset viewer.