<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[176684] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/176684">176684</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2014-12-02 12:36:08 -0800 (Tue, 02 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Should use standardQuickLookMenuItem for apps that don't implement customizations
https://bugs.webkit.org/show_bug.cgi?id=139193
-and corresponding-
rdar://problem/18944696
Reviewed by Anders Carlsson.
Source/WebCore:
New SPI headers.
* WebCore.xcodeproj/project.pbxproj:
* platform/spi/mac/NSMenuSPI.h: Added.
* platform/spi/mac/QuickLookMacSPI.h: Added.
Source/WebKit/mac:
Use [NSMenuItem standardQuickLookMenuItem].
* WebView/WebActionMenuController.mm:
(-[WebActionMenuController _defaultMenuItemsForLink]):
Delegate methods to set up the standardQuickLookMenuItem.
(-[WebActionMenuController menuItem:viewAtScreenPoint:]):
(-[WebActionMenuController menuItem:previewItemAtPoint:]):
(-[WebActionMenuController menuItem:preferredEdgeForPoint:]):
Remove all of the old QLPreviewBubble code.
(-[WebActionMenuController _createActionMenuItemForTag:]):
(-[WebActionMenuController _quickLookURLFromActionMenu:]): Deleted.
Source/WebKit2:
New SPI will allow clients to opt-out of the standardQuickLookMenuItem. By
default, opt in.
* UIProcess/API/Cocoa/WKViewPrivate.h:
* UIProcess/API/mac/WKView.mm:
(-[WKView _shouldUseStandardQuickLookPreview]):
* UIProcess/mac/WKActionMenuController.mm:
Use [NSMenuItem standardQuickLookMenuItem] unless the client has requested
otherwise.
(-[WKActionMenuController _defaultMenuItemsForLink]):
Delegate methods to set up the standardQuickLookMenuItem.
(-[WKActionMenuController menuItem:viewAtScreenPoint:]):
(-[WKActionMenuController menuItem:previewItemAtPoint:]):
(-[WKActionMenuController menuItem:preferredEdgeForPoint:]):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebActionMenuControllermm">trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKViewPrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKActionMenuControllermm">trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformspimacNSMenuSPIh">trunk/Source/WebCore/platform/spi/mac/NSMenuSPI.h</a></li>
<li><a href="#trunkSourceWebCoreplatformspimacQuickLookMacSPIh">trunk/Source/WebCore/platform/spi/mac/QuickLookMacSPI.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebCore/ChangeLog        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-12-02 Beth Dakin <bdakin@apple.com>
+
+ Should use standardQuickLookMenuItem for apps that don't implement customizations
+ https://bugs.webkit.org/show_bug.cgi?id=139193
+ -and corresponding-
+ rdar://problem/18944696
+
+ Reviewed by Anders Carlsson.
+
+ New SPI headers.
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/spi/mac/NSMenuSPI.h: Added.
+ * platform/spi/mac/QuickLookMacSPI.h: Added.
+
</ins><span class="cx"> 2014-12-02 Gavin Barraclough <barraclough@apple.com>
</span><span class="cx">
</span><span class="cx"> Generalize PageActivityAssertionToken
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -3265,6 +3265,8 @@
</span><span class="cx">                 9362640B0DE1137D009D5A00 /* CSSReflectionDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9362640A0DE1137D009D5A00 /* CSSReflectionDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 9370918D1416D86B00477333 /* textAreaResizeCorner@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9370918C1416D86B00477333 /* textAreaResizeCorner@2x.png */; };
</span><span class="cx">                 9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */ = {isa = PBXBuildFile; fileRef = 9377AB9F15DEFEEF0031FD04 /* Pagination.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                937F4CCE1A2D4B0100BB39F5 /* NSMenuSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 937FF3D51A1012D6008EBA31 /* DictionaryLookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 937FF3D71A10131B008EBA31 /* DictionaryLookup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */; };
</span><span class="cx">                 9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9380F47109A11AB4001FDB34 /* Widget.cpp */; };
</span><span class="lines">@@ -10435,6 +10437,8 @@
</span><span class="cx">                 936DD03A09CEAC270056AE8C /* Range.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Range.idl; sourceTree = "<group>"; };
</span><span class="cx">                 9370918C1416D86B00477333 /* textAreaResizeCorner@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "textAreaResizeCorner@2x.png"; sourceTree = "<group>"; };
</span><span class="cx">                 9377AB9F15DEFEEF0031FD04 /* Pagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pagination.h; sourceTree = "<group>"; };
</span><ins>+                937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuickLookMacSPI.h; sourceTree = "<group>"; };
+                937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSMenuSPI.h; sourceTree = "<group>"; };
</ins><span class="cx">                 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryLookup.h; sourceTree = "<group>"; };
</span><span class="cx">                 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DictionaryLookup.mm; sourceTree = "<group>"; };
</span><span class="cx">                 9380F47109A11AB4001FDB34 /* Widget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Widget.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -17610,9 +17614,11 @@
</span><span class="cx">                                 2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */,
</span><span class="cx">                                 2D413F601A187A3F0041A521 /* LookupSPI.h */,
</span><span class="cx">                                 1C6466271A12C3F90094603C /* NSFontSPI.h */,
</span><ins>+                                937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */,
</ins><span class="cx">                                 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
</span><span class="cx">                                 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */,
</span><span class="cx">                                 9348428119F1A9190009D5AE /* NSViewSPI.h */,
</span><ins>+                                937F4CCB1A2D48C100BB39F5 /* QuickLookMacSPI.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = mac;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -23428,6 +23434,7 @@
</span><span class="cx">                                 93309DD7099E64920056E581 /* AppendNodeCommand.h in Headers */,
</span><span class="cx">                                 1A8F6BBD0DB55CDC001DB794 /* ApplicationCache.h in Headers */,
</span><span class="cx">                                 1A8F6BBF0DB55CDC001DB794 /* ApplicationCacheGroup.h in Headers */,
</span><ins>+                                937F4CCC1A2D48C100BB39F5 /* QuickLookMacSPI.h in Headers */,
</ins><span class="cx">                                 24F54EAD101FE914000AE741 /* ApplicationCacheHost.h in Headers */,
</span><span class="cx">                                 1A8F6BC10DB55CDC001DB794 /* ApplicationCacheResource.h in Headers */,
</span><span class="cx">                                 1A2AAC590DC2A3B100A20D9A /* ApplicationCacheStorage.h in Headers */,
</span><span class="lines">@@ -26075,6 +26082,7 @@
</span><span class="cx">                                 E4E9B1191810916F003ACCDF /* SimpleLineLayoutResolver.h in Headers */,
</span><span class="cx">                                 C5A1EA7D152BCF08004D00B6 /* SimplifyMarkupCommand.h in Headers */,
</span><span class="cx">                                 31741AAD16636609008A5B7E /* SimulatedClickOptions.h in Headers */,
</span><ins>+                                937F4CCE1A2D4B0100BB39F5 /* NSMenuSPI.h in Headers */,
</ins><span class="cx">                                 FD00D7A514A3F61900734011 /* SincResampler.h in Headers */,
</span><span class="cx">                                 51327D6011A33A2B004F9D65 /* SinkDocument.h in Headers */,
</span><span class="cx">                                 49E911CD0EF86D47009D0CAF /* SkewTransformOperation.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacNSMenuSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/spi/mac/NSMenuSPI.h (0 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/NSMenuSPI.h         (rev 0)
+++ trunk/Source/WebCore/platform/spi/mac/NSMenuSPI.h        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "QuickLookMacSPI.h"
+
+#if USE(APPLE_INTERNAL_SDK) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101002
+
+#import <AppKit/NSMenu_Private.h>
+
+#else
+
+#import <AppKit/NSMenu.h>
+
+@interface NSMenuItem (Private)
++ (QLPreviewMenuItem *)standardQuickLookMenuItem;
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacQuickLookMacSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/spi/mac/QuickLookMacSPI.h (0 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/QuickLookMacSPI.h         (rev 0)
+++ trunk/Source/WebCore/platform/spi/mac/QuickLookMacSPI.h        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#import <QuickLookUI/QLPreviewItem.h>
+#import <QuickLookUI/QLPreviewMenuItem.h>
+
+#else
+
+@protocol QLPreviewItem <NSObject>
+@end
+
+@protocol QLPreviewMenuItemDelegate <NSObject>
+@optional
+
+- (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint;
+- (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point;
+- (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point;
+
+@end
+
+@interface QLPreviewMenuItem : NSObject
+@end
+
+@interface QLPreviewMenuItem (Details)
+typedef NS_ENUM(NSInteger, QLPreviewStyle) {
+ QLPreviewStyleStandaloneWindow,
+ QLPreviewStylePopover
+};
+
+@property (assign) id<QLPreviewMenuItemDelegate> delegate;
+@property QLPreviewStyle previewStyle;
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2014-12-02 Beth Dakin <bdakin@apple.com>
+
+ Should use standardQuickLookMenuItem for apps that don't implement customizations
+ https://bugs.webkit.org/show_bug.cgi?id=139193
+ -and corresponding-
+ rdar://problem/18944696
+
+ Reviewed by Anders Carlsson.
+
+ Use [NSMenuItem standardQuickLookMenuItem].
+ * WebView/WebActionMenuController.mm:
+ (-[WebActionMenuController _defaultMenuItemsForLink]):
+
+ Delegate methods to set up the standardQuickLookMenuItem.
+ (-[WebActionMenuController menuItem:viewAtScreenPoint:]):
+ (-[WebActionMenuController menuItem:previewItemAtPoint:]):
+ (-[WebActionMenuController menuItem:preferredEdgeForPoint:]):
+
+ Remove all of the old QLPreviewBubble code.
+ (-[WebActionMenuController _createActionMenuItemForTag:]):
+ (-[WebActionMenuController _quickLookURLFromActionMenu:]): Deleted.
+
</ins><span class="cx"> 2014-12-02 Timothy Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Fix the build.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -54,10 +54,12 @@
</span><span class="cx"> #import <WebCore/FrameView.h>
</span><span class="cx"> #import <WebCore/HTMLConverter.h>
</span><span class="cx"> #import <WebCore/LookupSPI.h>
</span><ins>+#import <WebCore/NSMenuSPI.h>
</ins><span class="cx"> #import <WebCore/NSSharingServicePickerSPI.h>
</span><span class="cx"> #import <WebCore/NSSharingServiceSPI.h>
</span><span class="cx"> #import <WebCore/NSViewSPI.h>
</span><span class="cx"> #import <WebCore/Page.h>
</span><ins>+#import <WebCore/QuickLookMacSPI.h>
</ins><span class="cx"> #import <WebCore/Range.h>
</span><span class="cx"> #import <WebCore/RenderElement.h>
</span><span class="cx"> #import <WebCore/RenderObject.h>
</span><span class="lines">@@ -70,19 +72,12 @@
</span><span class="cx"> #import <objc/objc.h>
</span><span class="cx">
</span><span class="cx"> SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI)
</span><del>-SOFT_LINK_CLASS(QuickLookUI, QLPreviewBubble)
</del><ins>+SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem)
</ins><span class="cx">
</span><span class="cx"> SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit)
</span><span class="cx"> SOFT_LINK_CLASS(ImageKit, IKSlideshow)
</span><span class="cx">
</span><del>-@class QLPreviewBubble;
-@interface NSObject (WKQLPreviewBubbleDetails)
-@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;
</del><ins>+@interface WebActionMenuController () <QLPreviewMenuItemDelegate>
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -282,39 +277,14 @@
</span><span class="cx"> return view->contentsToWindow(node->pixelSnappedBoundingBox());
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (void)_quickLookURLFromActionMenu:(id)sender
-{
- if (!_webView)
- return;
-
- NSURL *url = _hitTestResult.absoluteLinkURL();
- if (!url)
- return;
-
- Node* node = _hitTestResult.innerNode();
- if (!node)
- return;
-
- NSRect itemFrame = elementBoundingBoxInWindowCoordinatesFromNode(node);
- NSSize maximumPreviewSize = NSMakeSize(_webView.bounds.size.width * 0.75, _webView.bounds.size.height * 0.75);
-
- RetainPtr<QLPreviewBubble> bubble = adoptNS([[getQLPreviewBubbleClass() alloc] init]);
- [bubble setParentWindow:_webView.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:url itemFrame:itemFrame];
-}
-
</del><span class="cx"> - (NSArray *)_defaultMenuItemsForLink
</span><span class="cx"> {
</span><span class="cx"> RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagOpenLinkInDefaultBrowser];
</span><del>- RetainPtr<NSMenuItem> previewLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPreviewLink];
</del><ins>+
+ RetainPtr<QLPreviewMenuItem> previewLinkItem = [NSMenuItem standardQuickLookMenuItem];
+ [previewLinkItem setPreviewStyle:QLPreviewStylePopover];
+ [previewLinkItem setDelegate:self];
+
</ins><span class="cx"> RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddLinkToSafariReadingList];
</span><span class="cx">
</span><span class="cx"> return @[ openLinkItem.get(), previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
</span><span class="lines">@@ -748,6 +718,26 @@
</span><span class="cx"> return _webView.window;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#pragma mark QLPreviewMenuItemDelegate implementation
+
+- (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint
+{
+ return _webView;
+}
+
+- (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point
+{
+ if (!_webView)
+ return nil;
+
+ return _hitTestResult.absoluteLinkURL();
+}
+
+- (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point
+{
+ return NSMaxYEdge;
+}
+
</ins><span class="cx"> #pragma mark Menu Items
</span><span class="cx">
</span><span class="cx"> - (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag
</span><span class="lines">@@ -764,12 +754,6 @@
</span><span class="cx"> image = [NSImage imageNamed:@"NSActionMenuOpenInNewWindow"];
</span><span class="cx"> break;
</span><span class="cx">
</span><del>- case WebActionMenuItemTagPreviewLink:
- selector = @selector(_quickLookURLFromActionMenu:);
- title = WEB_UI_STRING_KEY("Preview", "Preview (action menu item)", "action menu item");
- image = [NSImage imageNamed:@"NSActionMenuQuickLook"];
- break;
-
</del><span class="cx"> case WebActionMenuItemTagAddLinkToSafariReadingList:
</span><span class="cx"> selector = @selector(_addToReadingListFromActionMenu:);
</span><span class="cx"> title = WEB_UI_STRING_KEY("Add to Reading List", "Add to Reading List (action menu item)", "action menu item");
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2014-12-02 Beth Dakin <bdakin@apple.com>
+
+ Should use standardQuickLookMenuItem for apps that don't implement customizations
+ https://bugs.webkit.org/show_bug.cgi?id=139193
+ -and corresponding-
+ rdar://problem/18944696
+
+ Reviewed by Anders Carlsson.
+
+ New SPI will allow clients to opt-out of the standardQuickLookMenuItem. By
+ default, opt in.
+ * UIProcess/API/Cocoa/WKViewPrivate.h:
+ * UIProcess/API/mac/WKView.mm:
+ (-[WKView _shouldUseStandardQuickLookPreview]):
+ * UIProcess/mac/WKActionMenuController.mm:
+
+ Use [NSMenuItem standardQuickLookMenuItem] unless the client has requested
+ otherwise.
+ (-[WKActionMenuController _defaultMenuItemsForLink]):
+
+ Delegate methods to set up the standardQuickLookMenuItem.
+ (-[WKActionMenuController menuItem:viewAtScreenPoint:]):
+ (-[WKActionMenuController menuItem:previewItemAtPoint:]):
+ (-[WKActionMenuController menuItem:preferredEdgeForPoint:]):
+
</ins><span class="cx"> 2014-12-02 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> TextIndicator can get stuck (especially if we don't get LUNotificationPopoverWillClose when we should)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -127,6 +127,7 @@
</span><span class="cx"> - (void)_setPreviewTitle:(NSString *)previewTitle;
</span><span class="cx"> - (void)_finishPreviewingURL:(NSURL *)url withPreviewView:(NSView *)previewView;
</span><span class="cx"> - (void)_handleClickInPreviewView:(NSView *)previewView URL:(NSURL *)url;
</span><ins>+- (BOOL)_shouldUseStandardQuickLookPreview;
</ins><span class="cx">
</span><span class="cx"> - (void)_dismissActionMenuPopovers;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -4246,6 +4246,11 @@
</span><span class="cx"> [[NSWorkspace sharedWorkspace] openURL:url];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (BOOL)_shouldUseStandardQuickLookPreview
+{
+ return YES;
+}
+
</ins><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
</span><span class="cx">
</span><span class="cx"> - (void)_setAutomaticallyAdjustsContentInsets:(BOOL)automaticallyAdjustsContentInsets
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176683 => 176684)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-02 20:30:17 UTC (rev 176683)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-02 20:36:08 UTC (rev 176684)
</span><span class="lines">@@ -45,20 +45,25 @@
</span><span class="cx"> #import <WebCore/GeometryUtilities.h>
</span><span class="cx"> #import <WebCore/LocalizedStrings.h>
</span><span class="cx"> #import <WebCore/LookupSPI.h>
</span><ins>+#import <WebCore/NSMenuSPI.h>
</ins><span class="cx"> #import <WebCore/NSSharingServiceSPI.h>
</span><span class="cx"> #import <WebCore/NSSharingServicePickerSPI.h>
</span><span class="cx"> #import <WebCore/NSViewSPI.h>
</span><ins>+#import <WebCore/QuickLookMacSPI.h>
</ins><span class="cx"> #import <WebCore/SoftLinking.h>
</span><span class="cx"> #import <WebCore/TextIndicator.h>
</span><span class="cx"> #import <WebCore/URL.h>
</span><span class="cx">
</span><ins>+SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI)
+SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem)
+
</ins><span class="cx"> SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit)
</span><span class="cx"> SOFT_LINK_CLASS(ImageKit, IKSlideshow)
</span><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="cx">
</span><del>-@interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSPopoverDelegate>
</del><ins>+@interface WKActionMenuController () <NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSPopoverDelegate, QLPreviewMenuItemDelegate>
</ins><span class="cx"> - (void)_updateActionMenuItems;
</span><span class="cx"> - (BOOL)_canAddMediaToPhotos;
</span><span class="cx"> - (void)_showTextIndicator;
</span><span class="lines">@@ -388,14 +393,25 @@
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForLink
</span><span class="cx"> {
</span><span class="cx"> RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagOpenLinkInDefaultBrowser];
</span><ins>+
+ BOOL shouldUseStandardQuickLookPreview = [_wkView _shouldUseStandardQuickLookPreview];
+ RetainPtr<NSMenuItem> previewLinkItem;
+ RetainPtr<QLPreviewMenuItem> qlPreviewLinkItem;
+ if (shouldUseStandardQuickLookPreview) {
+ qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
+ [qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
+ [qlPreviewLinkItem setDelegate:self];
+ } else {
</ins><span class="cx"> #if WK_API_ENABLED
</span><del>- RetainPtr<NSMenuItem> previewLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPreviewLink];
</del><ins>+ previewLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPreviewLink];
</ins><span class="cx"> #else
</span><del>- RetainPtr<NSMenuItem> previewLinkItem = [NSMenuItem separatorItem];
</del><ins>+ previewLinkItem = [NSMenuItem separatorItem];
</ins><span class="cx"> #endif
</span><ins>+ }
+
</ins><span class="cx"> RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:kWKContextActionItemTagAddLinkToSafariReadingList];
</span><span class="cx">
</span><del>- return @[ openLinkItem.get(), previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
</del><ins>+ return @[ openLinkItem.get(), shouldUseStandardQuickLookPreview ? qlPreviewLinkItem.get() : previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_openURLFromActionMenu:(id)sender
</span><span class="lines">@@ -931,6 +947,27 @@
</span><span class="cx"> [self _clearPreviewPopover];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#pragma mark QLPreviewMenuItemDelegate implementation
+
+- (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint
+{
+ return _wkView;
+}
+
+- (id<QLPreviewItem>)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point
+{
+ if (!_wkView)
+ return nil;
+
+ RefPtr<WebHitTestResult> hitTestResult = [self _webHitTestResult];
+ return [NSURL _web_URLWithWTFString:hitTestResult->absoluteLinkURL()];
+}
+
+- (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point
+{
+ return NSMaxYEdge;
+}
+
</ins><span class="cx"> #pragma mark Menu Items
</span><span class="cx">
</span><span class="cx"> - (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag
</span></span></pre>
</div>
</div>
</body>
</html>