Title: [175016] trunk/Source/WebKit2
Revision
175016
Author
timothy_hor...@apple.com
Date
2014-10-21 19:53:26 -0700 (Tue, 21 Oct 2014)

Log Message

Quick Look preview bubble has unnecessary controls
https://bugs.webkit.org/show_bug.cgi?id=137940
<rdar://problem/18731860>

Reviewed by Simon Fraser.

* UIProcess/API/mac/WKView.mm:
(-[WKView _quickLookURLFromActionMenu:]):
Temporarily use more SPI to allow us to hide the preview bubble's controls.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (175015 => 175016)


--- trunk/Source/WebKit2/ChangeLog	2014-10-22 02:01:30 UTC (rev 175015)
+++ trunk/Source/WebKit2/ChangeLog	2014-10-22 02:53:26 UTC (rev 175016)
@@ -1,3 +1,15 @@
+2014-10-21  Tim Horton  <timothy_hor...@apple.com>
+
+        Quick Look preview bubble has unnecessary controls
+        https://bugs.webkit.org/show_bug.cgi?id=137940
+        <rdar://problem/18731860>
+
+        Reviewed by Simon Fraser.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _quickLookURLFromActionMenu:]):
+        Temporarily use more SPI to allow us to hide the preview bubble's controls.
+
 2014-10-21  Jeff Miller  <je...@apple.com>
 
         Remove const from WKURLRequestRef parameter to WKContextDownloadURLRequest()

Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (175015 => 175016)


--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-10-22 02:01:30 UTC (rev 175015)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm	2014-10-22 02:53:26 UTC (rev 175016)
@@ -119,8 +119,14 @@
 - (void)_maskRoundedBottomCorners:(NSRect)clipRect;
 @end
 
+@class QLPreviewBubble;
 @interface NSObject (WKQLPreviewBubbleDetails)
-+ (void)presentBubbleForItem:(id)item parentWindow:(NSWindow *)aWindow itemFrame:(NSRect)itemFrame maximumSize:(NSSize)maximumSize preferredEdge:(NSRectEdge)preferredEdge;
+@property (copy) NSArray * controls;
+@property NSSize maximumSize;
+@property NSRectEdge preferredEdge;
+@property (retain) IBOutlet NSWindow* parentWindow;
+- (void)showPreviewItem:(id)previewItem itemFrame:(NSRect)frame;
+- (void)setAutomaticallyCloseWithMask:(NSEventMask)autocloseMask filterMask:(NSEventMask)filterMask block:(void (^)(void))block;
 @end
 
 #if USE(ASYNC_NSTEXTINPUTCLIENT)
@@ -3663,8 +3669,17 @@
     NSRect itemFrame = [self convertRect:hitTestResult->elementBoundingBox() toView:nil];
     NSSize maximumPreviewSize = NSMakeSize(self.bounds.size.width * 0.75, self.bounds.size.height * 0.75);
 
-    NSURL *url = "" URLWithString:hitTestResult->absoluteLinkURL()];
-    [NSClassFromString(@"QLPreviewBubble") presentBubbleForItem:url parentWindow:self.window itemFrame:itemFrame maximumSize:maximumPreviewSize preferredEdge:NSMaxYEdge];
+    RetainPtr<QLPreviewBubble> bubble = adoptNS([[NSClassFromString(@"QLPreviewBubble") alloc] init]);
+    [bubble setParentWindow:self.window];
+    [bubble setMaximumSize:maximumPreviewSize];
+    [bubble setPreferredEdge:NSMaxYEdge];
+    [bubble setControls:@[ ]];
+    NSEventMask filterMask = NSAnyEventMask & ~(NSAppKitDefinedMask | NSSystemDefinedMask | NSApplicationDefinedMask | NSMouseEnteredMask | NSMouseExitedMask);
+    NSEventMask autocloseMask = NSLeftMouseDownMask | NSRightMouseDownMask | NSKeyDownMask;
+    [bubble setAutomaticallyCloseWithMask:autocloseMask filterMask:filterMask block:[bubble] {
+        [bubble close];
+    }];
+    [bubble showPreviewItem:[NSURL URLWithString:hitTestResult->absoluteLinkURL()] itemFrame:itemFrame];
 }
 
 - (NSArray *)_defaultMenuItemsForLink
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to