Changeset 176740 in webkit
- Timestamp:
- Dec 3, 2014, 12:35:24 PM (12 years ago)
- Location:
- branches/safari-600.3-branch/Source
- Files:
-
- 2 added
- 8 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (5 diffs)
-
WebCore/platform/spi/mac/NSMenuSPI.h (added)
-
WebCore/platform/spi/mac/QuickLookMacSPI.h (added)
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/WebView/WebActionMenuController.mm (modified) (5 diffs)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (modified) (1 diff)
-
WebKit2/UIProcess/API/mac/WKView.mm (modified) (1 diff)
-
WebKit2/UIProcess/mac/WKActionMenuController.mm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-600.3-branch/Source/WebCore/ChangeLog
r176735 r176740 1 2014-12-03 Dana Burkart <dburkart@apple.com> 2 3 Merge r176684. <rdar://problem/18944696> 4 5 2014-12-02 Beth Dakin <bdakin@apple.com> 6 7 Should use standardQuickLookMenuItem for apps that don't implement customizations 8 https://bugs.webkit.org/show_bug.cgi?id=139193 9 -and corresponding- 10 rdar://problem/18944696 11 12 Reviewed by Anders Carlsson. 13 14 New SPI headers. 15 * WebCore.xcodeproj/project.pbxproj: 16 * platform/spi/mac/NSMenuSPI.h: Added. 17 * platform/spi/mac/QuickLookMacSPI.h: Added. 18 1 19 2014-12-03 Dana Burkart <dburkart@apple.com> 2 20 -
branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r176660 r176740 3287 3287 9370918D1416D86B00477333 /* textAreaResizeCorner@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9370918C1416D86B00477333 /* textAreaResizeCorner@2x.png */; }; 3288 3288 9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */ = {isa = PBXBuildFile; fileRef = 9377AB9F15DEFEEF0031FD04 /* Pagination.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3289 937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3290 937F4CCE1A2D4B0100BB39F5 /* NSMenuSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3289 3291 937FF3D51A1012D6008EBA31 /* DictionaryLookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3290 3292 937FF3D71A10131B008EBA31 /* DictionaryLookup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */; }; … … 10454 10456 9370918C1416D86B00477333 /* textAreaResizeCorner@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "textAreaResizeCorner@2x.png"; sourceTree = "<group>"; }; 10455 10457 9377AB9F15DEFEEF0031FD04 /* Pagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pagination.h; sourceTree = "<group>"; }; 10458 937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookMacSPI.h; sourceTree = "<group>"; }; 10459 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSMenuSPI.h; sourceTree = "<group>"; }; 10456 10460 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryLookup.h; sourceTree = "<group>"; }; 10457 10461 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DictionaryLookup.mm; sourceTree = "<group>"; }; … … 17649 17653 2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */, 17650 17654 2D413F601A187A3F0041A521 /* LookupSPI.h */, 17655 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */, 17651 17656 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */, 17652 17657 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */, 17653 17658 9348428119F1A9190009D5AE /* NSViewSPI.h */, 17659 937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */, 17654 17660 ); 17655 17661 path = mac; … … 23443 23449 1A8F6BBD0DB55CDC001DB794 /* ApplicationCache.h in Headers */, 23444 23450 1A8F6BBF0DB55CDC001DB794 /* ApplicationCacheGroup.h in Headers */, 23451 937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */, 23445 23452 24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */, 23446 23453 1A8F6BC10DB55CDC001DB794 /* ApplicationCacheResource.h in Headers */, … … 26058 26065 C5A1EA7D152BCF08004D00B6 /* SimplifyMarkupCommand.h in Headers */, 26059 26066 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */, 26067 937F4CCE1A2D4B0100BB39F5 /* NSMenuSPI.h in Headers */, 26060 26068 FD00D7A514A3F61900734011 /* SincResampler.h in Headers */, 26061 26069 51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */, -
branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog
r176738 r176740 1 2014-12-03 Dana Burkart <dburkart@apple.com> 2 3 Merge r176684. <rdar://problem/18944696> 4 5 2014-12-02 Beth Dakin <bdakin@apple.com> 6 7 Should use standardQuickLookMenuItem for apps that don't implement customizations 8 https://bugs.webkit.org/show_bug.cgi?id=139193 9 -and corresponding- 10 rdar://problem/18944696 11 12 Reviewed by Anders Carlsson. 13 14 Use [NSMenuItem standardQuickLookMenuItem]. 15 * WebView/WebActionMenuController.mm: 16 (-[WebActionMenuController _defaultMenuItemsForLink]): 17 18 Delegate methods to set up the standardQuickLookMenuItem. 19 (-[WebActionMenuController menuItem:viewAtScreenPoint:]): 20 (-[WebActionMenuController menuItem:previewItemAtPoint:]): 21 (-[WebActionMenuController menuItem:preferredEdgeForPoint:]): 22 23 Remove all of the old QLPreviewBubble code. 24 (-[WebActionMenuController _createActionMenuItemForTag:]): 25 (-[WebActionMenuController _quickLookURLFromActionMenu:]): Deleted. 26 1 27 2014-12-03 Dana Burkart <dburkart@apple.com> 2 28 -
branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm
r176737 r176740 56 56 #import <WebCore/LocalizedStrings.h> 57 57 #import <WebCore/LookupSPI.h> 58 #import <WebCore/NSMenuSPI.h> 58 59 #import <WebCore/NSSharingServicePickerSPI.h> 59 60 #import <WebCore/NSSharingServiceSPI.h> 60 61 #import <WebCore/NSViewSPI.h> 61 62 #import <WebCore/Page.h> 63 #import <WebCore/QuickLookMacSPI.h> 62 64 #import <WebCore/Range.h> 63 65 #import <WebCore/RenderElement.h> … … 72 74 73 75 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI) 74 SOFT_LINK_CLASS(QuickLookUI, QLPreview Bubble)76 SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem) 75 77 76 78 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit) 77 79 SOFT_LINK_CLASS(ImageKit, IKSlideshow) 78 80 79 @class QLPreviewBubble; 80 @interface NSObject (WKQLPreviewBubbleDetails) 81 @property (copy) NSArray * controls; 82 @property NSSize maximumSize; 83 @property NSRectEdge preferredEdge; 84 @property (retain) IBOutlet NSWindow* parentWindow; 85 - (void)showPreviewItem:(id)previewItem itemFrame:(NSRect)frame; 86 - (void)setAutomaticallyCloseWithMask:(NSEventMask)autocloseMask filterMask:(NSEventMask)filterMask block:(void (^)(void))block; 81 @interface WebActionMenuController () <QLPreviewMenuItemDelegate> 87 82 @end 88 83 … … 284 279 } 285 280 286 - (void)_quickLookURLFromActionMenu:(id)sender287 {288 if (!_webView)289 return;290 291 NSURL *url = _hitTestResult.absoluteLinkURL();292 if (!url)293 return;294 295 Node* node = _hitTestResult.innerNode();296 if (!node)297 return;298 299 NSRect itemFrame = elementBoundingBoxInWindowCoordinatesFromNode(node);300 NSSize maximumPreviewSize = NSMakeSize(_webView.bounds.size.width * 0.75, _webView.bounds.size.height * 0.75);301 302 RetainPtr<QLPreviewBubble> bubble = adoptNS([[getQLPreviewBubbleClass() alloc] init]);303 [bubble setParentWindow:_webView.window];304 [bubble setMaximumSize:maximumPreviewSize];305 [bubble setPreferredEdge:NSMaxYEdge];306 [bubble setControls:@[ ]];307 NSEventMask filterMask = NSAnyEventMask & ~(NSAppKitDefinedMask | NSSystemDefinedMask | NSApplicationDefinedMask | NSMouseEnteredMask | NSMouseExitedMask);308 NSEventMask autocloseMask = NSLeftMouseDownMask | NSRightMouseDownMask | NSKeyDownMask;309 [bubble setAutomaticallyCloseWithMask:autocloseMask filterMask:filterMask block:[bubble] {310 [bubble close];311 }];312 [bubble showPreviewItem:url itemFrame:itemFrame];313 }314 315 281 - (NSArray *)_defaultMenuItemsForLink 316 282 { 317 283 RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagOpenLinkInDefaultBrowser]; 318 RetainPtr<NSMenuItem> previewLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPreviewLink]; 284 285 RetainPtr<QLPreviewMenuItem> previewLinkItem = [NSMenuItem standardQuickLookMenuItem]; 286 [previewLinkItem setPreviewStyle:QLPreviewStylePopover]; 287 [previewLinkItem setDelegate:self]; 288 319 289 RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddLinkToSafariReadingList]; 320 290 … … 750 720 } 751 721 722 #pragma mark QLPreviewMenuItemDelegate implementation 723 724 - (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint 725 { 726 return _webView; 727 } 728 729 - (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point 730 { 731 if (!_webView) 732 return nil; 733 734 return _hitTestResult.absoluteLinkURL(); 735 } 736 737 - (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point 738 { 739 return NSMaxYEdge; 740 } 741 752 742 #pragma mark Menu Items 753 743 … … 764 754 title = WEB_UI_STRING_KEY("Open", "Open (action menu item)", "action menu item"); 765 755 image = [NSImage imageNamed:@"NSActionMenuOpenInNewWindow"]; 766 break;767 768 case WebActionMenuItemTagPreviewLink:769 selector = @selector(_quickLookURLFromActionMenu:);770 title = WEB_UI_STRING_KEY("Preview", "Preview (action menu item)", "action menu item");771 image = [NSImage imageNamed:@"NSActionMenuQuickLook"];772 756 break; 773 757 -
branches/safari-600.3-branch/Source/WebKit2/ChangeLog
r176736 r176740 1 2014-12-03 Dana Burkart <dburkart@apple.com> 2 3 Merge r176684. <rdar://problem/18944696> 4 5 2014-12-02 Beth Dakin <bdakin@apple.com> 6 7 Should use standardQuickLookMenuItem for apps that don't implement customizations 8 https://bugs.webkit.org/show_bug.cgi?id=139193 9 -and corresponding- 10 rdar://problem/18944696 11 12 Reviewed by Anders Carlsson. 13 14 New SPI will allow clients to opt-out of the standardQuickLookMenuItem. By 15 default, opt in. 16 * UIProcess/API/Cocoa/WKViewPrivate.h: 17 * UIProcess/API/mac/WKView.mm: 18 (-[WKView _shouldUseStandardQuickLookPreview]): 19 * UIProcess/mac/WKActionMenuController.mm: 20 21 Use [NSMenuItem standardQuickLookMenuItem] unless the client has requested 22 otherwise. 23 (-[WKActionMenuController _defaultMenuItemsForLink]): 24 25 Delegate methods to set up the standardQuickLookMenuItem. 26 (-[WKActionMenuController menuItem:viewAtScreenPoint:]): 27 (-[WKActionMenuController menuItem:previewItemAtPoint:]): 28 (-[WKActionMenuController menuItem:preferredEdgeForPoint:]): 29 1 30 2014-12-03 Dana Burkart <dburkart@apple.com> 2 31 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
r176666 r176740 127 127 - (void)_finishPreviewingURL:(NSURL *)url withPreviewView:(NSView *)previewView; 128 128 - (void)_handleClickInPreviewView:(NSView *)previewView URL:(NSURL *)url; 129 - (BOOL)_shouldUseStandardQuickLookPreview; 129 130 #endif 130 131 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm
r176736 r176740 4242 4242 } 4243 4243 4244 - (BOOL)_shouldUseStandardQuickLookPreview 4245 { 4246 return YES; 4247 } 4248 4244 4249 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 4245 4250 -
branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm
r176666 r176740 46 46 #import <WebCore/LocalizedStrings.h> 47 47 #import <WebCore/LookupSPI.h> 48 #import <WebCore/NSMenuSPI.h> 48 49 #import <WebCore/NSSharingServiceSPI.h> 49 50 #import <WebCore/NSSharingServicePickerSPI.h> 50 51 #import <WebCore/NSViewSPI.h> 52 #import <WebCore/QuickLookMacSPI.h> 51 53 #import <WebCore/SoftLinking.h> 52 54 #import <WebCore/TextIndicator.h> 53 55 #import <WebCore/URL.h> 54 56 57 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI) 58 SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem) 59 55 60 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit) 56 61 SOFT_LINK_CLASS(ImageKit, IKSlideshow) … … 59 64 using namespace WebKit; 60 65 61 @interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSPopoverDelegate >66 @interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSPopoverDelegate, QLPreviewMenuItemDelegate> 62 67 - (void)_updateActionMenuItems; 63 68 - (BOOL)_canAddMediaToPhotos; … … 389 394 { 390 395 RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagOpenLinkInDefaultBrowser]; 396 397 BOOL shouldUseStandardQuickLookPreview = [_wkView _shouldUseStandardQuickLookPreview]; 398 RetainPtr<NSMenuItem> previewLinkItem; 399 RetainPtr<QLPreviewMenuItem> qlPreviewLinkItem; 400 if (shouldUseStandardQuickLookPreview) { 401 qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem]; 402 [qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover]; 403 [qlPreviewLinkItem setDelegate:self]; 404 } else { 391 405 #if WK_API_ENABLED 392 RetainPtr<NSMenuItem>previewLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPreviewLink];406 previewLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPreviewLink]; 393 407 #else 394 RetainPtr<NSMenuItem>previewLinkItem = [NSMenuItem separatorItem];408 previewLinkItem = [NSMenuItem separatorItem]; 395 409 #endif 410 } 411 396 412 RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:kWKContextActionItemTagAddLinkToSafariReadingList]; 397 413 398 return @[ openLinkItem.get(), previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];414 return @[ openLinkItem.get(), shouldUseStandardQuickLookPreview ? qlPreviewLinkItem.get() : previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ]; 399 415 } 400 416 … … 932 948 } 933 949 950 #pragma mark QLPreviewMenuItemDelegate implementation 951 952 - (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint 953 { 954 return _wkView; 955 } 956 957 - (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point 958 { 959 if (!_wkView) 960 return nil; 961 962 RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult]; 963 return [NSURL _web_URLWithWTFString:hitTestResult->absoluteLinkURL()]; 964 } 965 966 - (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point 967 { 968 return NSMaxYEdge; 969 } 970 934 971 #pragma mark Menu Items 935 972
Note:
See TracChangeset
for help on using the changeset viewer.