Changeset 176684 in webkit
- Timestamp:
- Dec 2, 2014, 12:36:08 PM (12 years ago)
- Location:
- trunk/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
-
trunk/Source/WebCore/ChangeLog
r176683 r176684 1 2014-12-02 Beth Dakin <bdakin@apple.com> 2 3 Should use standardQuickLookMenuItem for apps that don't implement customizations 4 https://bugs.webkit.org/show_bug.cgi?id=139193 5 -and corresponding- 6 rdar://problem/18944696 7 8 Reviewed by Anders Carlsson. 9 10 New SPI headers. 11 * WebCore.xcodeproj/project.pbxproj: 12 * platform/spi/mac/NSMenuSPI.h: Added. 13 * platform/spi/mac/QuickLookMacSPI.h: Added. 14 1 15 2014-12-02 Gavin Barraclough <barraclough@apple.com> 2 16 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r176683 r176684 3266 3266 9370918D1416D86B00477333 /* textAreaResizeCorner@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9370918C1416D86B00477333 /* textAreaResizeCorner@2x.png */; }; 3267 3267 9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */ = {isa = PBXBuildFile; fileRef = 9377AB9F15DEFEEF0031FD04 /* Pagination.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3268 937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3269 937F4CCE1A2D4B0100BB39F5 /* NSMenuSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3268 3270 937FF3D51A1012D6008EBA31 /* DictionaryLookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3269 3271 937FF3D71A10131B008EBA31 /* DictionaryLookup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */; }; … … 10436 10438 9370918C1416D86B00477333 /* textAreaResizeCorner@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "textAreaResizeCorner@2x.png"; sourceTree = "<group>"; }; 10437 10439 9377AB9F15DEFEEF0031FD04 /* Pagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pagination.h; sourceTree = "<group>"; }; 10440 937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookMacSPI.h; sourceTree = "<group>"; }; 10441 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSMenuSPI.h; sourceTree = "<group>"; }; 10438 10442 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryLookup.h; sourceTree = "<group>"; }; 10439 10443 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DictionaryLookup.mm; sourceTree = "<group>"; }; … … 17611 17615 2D413F601A187A3F0041A521 /* LookupSPI.h */, 17612 17616 1C6466271A12C3F90094603C /* NSFontSPI.h */, 17617 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */, 17613 17618 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */, 17614 17619 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */, 17615 17620 9348428119F1A9190009D5AE /* NSViewSPI.h */, 17621 937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */, 17616 17622 ); 17617 17623 path = mac; … … 23429 23435 1A8F6BBD0DB55CDC001DB794 /* ApplicationCache.h in Headers */, 23430 23436 1A8F6BBF0DB55CDC001DB794 /* ApplicationCacheGroup.h in Headers */, 23437 937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */, 23431 23438 24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */, 23432 23439 1A8F6BC10DB55CDC001DB794 /* ApplicationCacheResource.h in Headers */, … … 26076 26083 C5A1EA7D152BCF08004D00B6 /* SimplifyMarkupCommand.h in Headers */, 26077 26084 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */, 26085 937F4CCE1A2D4B0100BB39F5 /* NSMenuSPI.h in Headers */, 26078 26086 FD00D7A514A3F61900734011 /* SincResampler.h in Headers */, 26079 26087 51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */, -
trunk/Source/WebKit/mac/ChangeLog
r176681 r176684 1 2014-12-02 Beth Dakin <bdakin@apple.com> 2 3 Should use standardQuickLookMenuItem for apps that don't implement customizations 4 https://bugs.webkit.org/show_bug.cgi?id=139193 5 -and corresponding- 6 rdar://problem/18944696 7 8 Reviewed by Anders Carlsson. 9 10 Use [NSMenuItem standardQuickLookMenuItem]. 11 * WebView/WebActionMenuController.mm: 12 (-[WebActionMenuController _defaultMenuItemsForLink]): 13 14 Delegate methods to set up the standardQuickLookMenuItem. 15 (-[WebActionMenuController menuItem:viewAtScreenPoint:]): 16 (-[WebActionMenuController menuItem:previewItemAtPoint:]): 17 (-[WebActionMenuController menuItem:preferredEdgeForPoint:]): 18 19 Remove all of the old QLPreviewBubble code. 20 (-[WebActionMenuController _createActionMenuItemForTag:]): 21 (-[WebActionMenuController _quickLookURLFromActionMenu:]): Deleted. 22 1 23 2014-12-02 Timothy Horton <timothy_horton@apple.com> 2 24 -
trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm
r176680 r176684 55 55 #import <WebCore/HTMLConverter.h> 56 56 #import <WebCore/LookupSPI.h> 57 #import <WebCore/NSMenuSPI.h> 57 58 #import <WebCore/NSSharingServicePickerSPI.h> 58 59 #import <WebCore/NSSharingServiceSPI.h> 59 60 #import <WebCore/NSViewSPI.h> 60 61 #import <WebCore/Page.h> 62 #import <WebCore/QuickLookMacSPI.h> 61 63 #import <WebCore/Range.h> 62 64 #import <WebCore/RenderElement.h> … … 71 73 72 74 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI) 73 SOFT_LINK_CLASS(QuickLookUI, QLPreview Bubble)75 SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem) 74 76 75 77 SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit) 76 78 SOFT_LINK_CLASS(ImageKit, IKSlideshow) 77 79 78 @class QLPreviewBubble; 79 @interface NSObject (WKQLPreviewBubbleDetails) 80 @property (copy) NSArray * controls; 81 @property NSSize maximumSize; 82 @property NSRectEdge preferredEdge; 83 @property (retain) IBOutlet NSWindow* parentWindow; 84 - (void)showPreviewItem:(id)previewItem itemFrame:(NSRect)frame; 85 - (void)setAutomaticallyCloseWithMask:(NSEventMask)autocloseMask filterMask:(NSEventMask)filterMask block:(void (^)(void))block; 80 @interface WebActionMenuController () <QLPreviewMenuItemDelegate> 86 81 @end 87 82 … … 283 278 } 284 279 285 - (void)_quickLookURLFromActionMenu:(id)sender286 {287 if (!_webView)288 return;289 290 NSURL *url = _hitTestResult.absoluteLinkURL();291 if (!url)292 return;293 294 Node* node = _hitTestResult.innerNode();295 if (!node)296 return;297 298 NSRect itemFrame = elementBoundingBoxInWindowCoordinatesFromNode(node);299 NSSize maximumPreviewSize = NSMakeSize(_webView.bounds.size.width * 0.75, _webView.bounds.size.height * 0.75);300 301 RetainPtr<QLPreviewBubble> bubble = adoptNS([[getQLPreviewBubbleClass() alloc] init]);302 [bubble setParentWindow:_webView.window];303 [bubble setMaximumSize:maximumPreviewSize];304 [bubble setPreferredEdge:NSMaxYEdge];305 [bubble setControls:@[ ]];306 NSEventMask filterMask = NSAnyEventMask & ~(NSAppKitDefinedMask | NSSystemDefinedMask | NSApplicationDefinedMask | NSMouseEnteredMask | NSMouseExitedMask);307 NSEventMask autocloseMask = NSLeftMouseDownMask | NSRightMouseDownMask | NSKeyDownMask;308 [bubble setAutomaticallyCloseWithMask:autocloseMask filterMask:filterMask block:[bubble] {309 [bubble close];310 }];311 [bubble showPreviewItem:url itemFrame:itemFrame];312 }313 314 280 - (NSArray *)_defaultMenuItemsForLink 315 281 { 316 282 RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagOpenLinkInDefaultBrowser]; 317 RetainPtr<NSMenuItem> previewLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPreviewLink]; 283 284 RetainPtr<QLPreviewMenuItem> previewLinkItem = [NSMenuItem standardQuickLookMenuItem]; 285 [previewLinkItem setPreviewStyle:QLPreviewStylePopover]; 286 [previewLinkItem setDelegate:self]; 287 318 288 RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddLinkToSafariReadingList]; 319 289 … … 749 719 } 750 720 721 #pragma mark QLPreviewMenuItemDelegate implementation 722 723 - (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint 724 { 725 return _webView; 726 } 727 728 - (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point 729 { 730 if (!_webView) 731 return nil; 732 733 return _hitTestResult.absoluteLinkURL(); 734 } 735 736 - (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point 737 { 738 return NSMaxYEdge; 739 } 740 751 741 #pragma mark Menu Items 752 742 … … 763 753 title = WEB_UI_STRING_KEY("Open", "Open (action menu item)", "action menu item"); 764 754 image = [NSImage imageNamed:@"NSActionMenuOpenInNewWindow"]; 765 break;766 767 case WebActionMenuItemTagPreviewLink:768 selector = @selector(_quickLookURLFromActionMenu:);769 title = WEB_UI_STRING_KEY("Preview", "Preview (action menu item)", "action menu item");770 image = [NSImage imageNamed:@"NSActionMenuQuickLook"];771 755 break; 772 756 -
trunk/Source/WebKit2/ChangeLog
r176678 r176684 1 2014-12-02 Beth Dakin <bdakin@apple.com> 2 3 Should use standardQuickLookMenuItem for apps that don't implement customizations 4 https://bugs.webkit.org/show_bug.cgi?id=139193 5 -and corresponding- 6 rdar://problem/18944696 7 8 Reviewed by Anders Carlsson. 9 10 New SPI will allow clients to opt-out of the standardQuickLookMenuItem. By 11 default, opt in. 12 * UIProcess/API/Cocoa/WKViewPrivate.h: 13 * UIProcess/API/mac/WKView.mm: 14 (-[WKView _shouldUseStandardQuickLookPreview]): 15 * UIProcess/mac/WKActionMenuController.mm: 16 17 Use [NSMenuItem standardQuickLookMenuItem] unless the client has requested 18 otherwise. 19 (-[WKActionMenuController _defaultMenuItemsForLink]): 20 21 Delegate methods to set up the standardQuickLookMenuItem. 22 (-[WKActionMenuController menuItem:viewAtScreenPoint:]): 23 (-[WKActionMenuController menuItem:previewItemAtPoint:]): 24 (-[WKActionMenuController menuItem:preferredEdgeForPoint:]): 25 1 26 2014-12-02 Tim Horton <timothy_horton@apple.com> 2 27 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h
r176613 r176684 128 128 - (void)_finishPreviewingURL:(NSURL *)url withPreviewView:(NSView *)previewView; 129 129 - (void)_handleClickInPreviewView:(NSView *)previewView URL:(NSURL *)url; 130 - (BOOL)_shouldUseStandardQuickLookPreview; 130 131 131 132 - (void)_dismissActionMenuPopovers; -
trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm
r176678 r176684 4247 4247 } 4248 4248 4249 - (BOOL)_shouldUseStandardQuickLookPreview 4250 { 4251 return YES; 4252 } 4253 4249 4254 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000 4250 4255 -
trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm
r176613 r176684 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.