<!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>[177339] branches/safari-600.3-branch/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/177339">177339</a></dd>
<dt>Author</dt> <dd>dburkart@apple.com</dd>
<dt>Date</dt> <dd>2014-12-16 00:15:25 -0800 (Tue, 16 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/177180">r177180</a>. &lt;rdar://problem/19208291&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebCoreChangeLog">branches/safari-600.3-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebCoreplatformspimacNSImmediateActionGestureRecognizerSPIh">branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2ChangeLog">branches/safari-600.3-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedAPIcWKImmediateActionTypesh">branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessAPImacWKViewmm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllerh">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKImmediateActionControllerh">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKImmediateActionControllermm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebKit2xcodeprojprojectpbxproj">branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKPagePreviewViewControllerh">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKPagePreviewViewControllermm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6003branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -1,5 +1,47 @@
</span><span class="cx"> 2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merged r177180. &lt;rdar://problem/19208291&gt;
+
+    2014-12-11  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+            Move the preview popover to WKImmediateActionController
+            https://bugs.webkit.org/show_bug.cgi?id=139560
+            &lt;rdar://problem/19208291&gt;
+
+            Reviewed by Beth Dakin.
+
+            * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
+            Add some requisite SPI.
+
+    2014-12-11  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+            [Mac] Crash in -[WebVideoFullscreenHUDWindowController playing] in WK1 clients without FULLSCREEN_API enabled.
+            https://bugs.webkit.org/show_bug.cgi?id=139546
+
+            Reviewed by Eric Carlson.
+
+            Finish the work started by r173230 and rename mediaElement -&gt; videoElement in WebVideoFullscreenHUDWindowController.
+
+            * platform/mac/WebVideoFullscreenHUDWindowController.h:
+            * platform/mac/WebVideoFullscreenHUDWindowController.mm:
+            (-[WebVideoFullscreenHUDWindowController endScrubbing]):
+            (-[WebVideoFullscreenHUDWindowController timelinePositionChanged:]):
+            (-[WebVideoFullscreenHUDWindowController currentTime]):
+            (-[WebVideoFullscreenHUDWindowController setCurrentTime:]):
+            (-[WebVideoFullscreenHUDWindowController duration]):
+            (-[WebVideoFullscreenHUDWindowController decrementVolume]):
+            (-[WebVideoFullscreenHUDWindowController incrementVolume]):
+            (-[WebVideoFullscreenHUDWindowController volume]):
+            (-[WebVideoFullscreenHUDWindowController setVolume:]):
+            (-[WebVideoFullscreenHUDWindowController playing]):
+            (-[WebVideoFullscreenHUDWindowController setPlaying:]):
+            (-[WebVideoFullscreenHUDWindowController remainingTimeText]):
+            (-[WebVideoFullscreenHUDWindowController elapsedTimeText]):
+            (-[WebVideoFullscreenHUDWindowController rewind:]):
+            (-[WebVideoFullscreenHUDWindowController fastForward:]):
+
+2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merged r177124. &lt;rdar://problem/19198539&gt;
</span><span class="cx"> 
</span><span class="cx">     2014-12-10  Beth Dakin  &lt;bdakin@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCoreplatformspimacNSImmediateActionGestureRecognizerSPIh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -27,13 +27,26 @@
</span><span class="cx"> 
</span><span class="cx"> #import &lt;AppKit/NSGestureRecognizer.h&gt;
</span><span class="cx"> 
</span><del>-#if __has_include(&lt;AppKit/NSImmediateActionGestureRecognizer.h&gt;)
</del><ins>+#if __has_include(&lt;AppKit/NSImmediateActionGestureRecognizer_Private.h&gt;)
</ins><span class="cx"> 
</span><del>-#import &lt;AppKit/NSImmediateActionGestureRecognizer.h&gt;
</del><ins>+#import &lt;AppKit/NSImmediateActionGestureRecognizer_Private.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #else
</span><span class="cx"> 
</span><ins>+@protocol NSImmediateActionAnimationController &lt;NSObject&gt;
+@optional
+
+- (void)recognizerWillBeginAnimation:(NSImmediateActionGestureRecognizer *)recognizer;
+- (void)recognizerDidUpdateAnimation:(NSImmediateActionGestureRecognizer *)recognizer;
+- (void)recognizerDidCancelAnimation:(NSImmediateActionGestureRecognizer *)recognizer;
+- (void)recognizerDidCompleteAnimation:(NSImmediateActionGestureRecognizer *)recognizer;
+- (void)recognizerDidDismissAnimation:(NSImmediateActionGestureRecognizer *)recognizer;
+@end
+
</ins><span class="cx"> @interface NSImmediateActionGestureRecognizer : NSGestureRecognizer
</span><ins>+
+@property (strong) id&lt;NSImmediateActionAnimationController&gt; animationController;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // __has_include(&lt;AppKit/NSImmediateActionGestureRecognizer.h&gt;)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -1,5 +1,45 @@
</span><span class="cx"> 2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merged r177180. &lt;rdar://problem/19208291&gt;
+
+    2014-12-11  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+            Move the preview popover to WKImmediateActionController
+            https://bugs.webkit.org/show_bug.cgi?id=139560
+            &lt;rdar://problem/19208291&gt;
+
+            Reviewed by Beth Dakin.
+
+            * Shared/API/c/WKImmediateActionTypes.h:
+            Add a link preview type.
+
+            * UIProcess/API/mac/WKView.mm:
+            (-[WKView initWithFrame:context:configuration:webView:]):
+            Pass the gesture recognizer to the WKImmediateActionController.
+
+            (-[WKView _setPreviewTitle:]):
+            Forward preview title changes to the WKImmediateActionController,
+            because that's where the preview popover lives now.
+
+            * UIProcess/mac/WKActionMenuController.h:
+            * UIProcess/mac/WKActionMenuController.mm:
+            Move WKPagePreviewViewController into its own file.
+            Move page preview popover related code to WKImmediateActionController.
+
+            * UIProcess/mac/WKImmediateActionController.h:
+            * UIProcess/mac/WKImmediateActionController.mm:
+            Compare the gesture recognizers directly instead of their views, for accuracy.
+            Move page preview popover related code in from WKActionMenuController.
+            Some of this should eventually move to WKPagePreviewViewController, but
+            for now for ease of transition we will move it here.
+
+            * UIProcess/mac/WKPagePreviewViewController.h: Added.
+            * UIProcess/mac/WKPagePreviewViewController.mm: Added.
+            * WebKit2.xcodeproj/project.pbxproj:
+            Move WKPagePreviewViewController into its own file.
+
+2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merged r177116. &lt;rdar://problem/19198539&gt;
</span><span class="cx"> 
</span><span class="cx">     2014-12-10  Beth Dakin  &lt;bdakin@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedAPIcWKImmediateActionTypesh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> enum {
</span><span class="cx">     kWKImmediateActionNone = 0,
</span><ins>+    kWKImmediateActionLinkPreview,
</ins><span class="cx"> };
</span><span class="cx"> typedef uint32_t _WKImmediateActionType;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -3624,7 +3624,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (Class gestureClass = NSClassFromString(@&quot;NSImmediateActionGestureRecognizer&quot;)) {
</span><span class="cx">         RetainPtr&lt;NSImmediateActionGestureRecognizer&gt; recognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] initWithTarget:nil action:NULL]);
</span><del>-        _data-&gt;_immediateActionController = adoptNS([[WKImmediateActionController alloc] initWithPage:*_data-&gt;_page view:self]);
</del><ins>+        _data-&gt;_immediateActionController = adoptNS([[WKImmediateActionController alloc] initWithPage:*_data-&gt;_page view:self recognizer:recognizer.get()]);
</ins><span class="cx">         [recognizer setDelegate:_data-&gt;_immediateActionController.get()];
</span><span class="cx">         [self addGestureRecognizer:recognizer.get()];
</span><span class="cx">     }
</span><span class="lines">@@ -4323,7 +4323,7 @@
</span><span class="cx"> - (void)_setPreviewTitle:(NSString *)previewTitle
</span><span class="cx"> {
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><del>-    [_data-&gt;_actionMenuController setPreviewTitle:previewTitle];
</del><ins>+    [_data-&gt;_immediateActionController setPreviewTitle:previewTitle];
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -48,10 +48,6 @@
</span><span class="cx"> @class DDActionContext;
</span><span class="cx"> @class WKView;
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
-@class WKPagePreviewViewController;
-#endif
-
</del><span class="cx"> @interface WKActionMenuController : NSObject &lt;NSMenuDelegate&gt; {
</span><span class="cx"> @private
</span><span class="cx">     WebKit::WebPageProxy *_page;
</span><span class="lines">@@ -63,18 +59,9 @@
</span><span class="cx">     _WKActionMenuType _type;
</span><span class="cx">     RetainPtr&lt;NSSharingServicePicker&gt; _sharingServicePicker;
</span><span class="cx"> 
</span><del>-    RetainPtr&lt;NSPopover&gt; _previewPopover;
-    NSPoint _eventLocationInView;
-    NSRect _popoverOriginRect;
-
</del><span class="cx">     BOOL _isShowingTextIndicator;
</span><del>-    BOOL _shouldKeepPreviewPopoverOpen;
</del><span class="cx">     BOOL _hasActivatedActionContext;
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
-    RetainPtr&lt;WKPagePreviewViewController&gt; _previewViewController;
-#endif
-
</del><span class="cx">     RetainPtr&lt;DDActionContext&gt; _currentActionContext;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -89,7 +76,6 @@
</span><span class="cx"> - (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&amp;)hitTestResult userData:(API::Object*)userData;
</span><span class="cx"> 
</span><span class="cx"> - (void)dismissActionMenuPopovers;
</span><del>-- (void)setPreviewTitle:(NSString *)previewTitle;
</del><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -30,8 +30,6 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WKNSURLExtras.h&quot;
</span><span class="cx"> #import &quot;WKViewInternal.h&quot;
</span><del>-#import &quot;WKWebView.h&quot;
-#import &quot;WKWebViewInternal.h&quot;
</del><span class="cx"> #import &quot;WebContext.h&quot;
</span><span class="cx"> #import &quot;WebKitSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebPageMessages.h&quot;
</span><span class="lines">@@ -42,28 +40,23 @@
</span><span class="cx"> #import &lt;ImageIO/ImageIO.h&gt;
</span><span class="cx"> #import &lt;ImageKit/ImageKit.h&gt;
</span><span class="cx"> #import &lt;WebCore/DataDetectorsSPI.h&gt;
</span><del>-#import &lt;WebCore/GeometryUtilities.h&gt;
</del><span class="cx"> #import &lt;WebCore/LocalizedStrings.h&gt;
</span><span class="cx"> #import &lt;WebCore/LookupSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSMenuSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSSharingServiceSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSSharingServicePickerSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSViewSPI.h&gt;
</span><del>-#import &lt;WebCore/QuickLookMacSPI.h&gt;
</del><span class="cx"> #import &lt;WebCore/SoftLinking.h&gt;
</span><span class="cx"> #import &lt;WebCore/TextIndicator.h&gt;
</span><span class="cx"> #import &lt;WebCore/URL.h&gt;
</span><span class="cx"> 
</span><del>-SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI)
-SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem)
-
</del><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 () &lt;NSSharingServiceDelegate, NSSharingServicePickerDelegate, NSPopoverDelegate, QLPreviewMenuItemDelegate&gt;
</del><ins>+@interface WKActionMenuController () &lt;NSSharingServiceDelegate, NSSharingServicePickerDelegate&gt;
</ins><span class="cx"> - (void)_updateActionMenuItems;
</span><span class="cx"> - (BOOL)_canAddMediaToPhotos;
</span><span class="cx"> - (void)_showTextIndicator;
</span><span class="lines">@@ -75,150 +68,6 @@
</span><span class="cx"> - (NSArray *)_actionMenuItemsForHitTestResult:(WKHitTestResultRef)hitTestResult defaultActionMenuItems:(NSArray *)defaultMenuItems;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
-
-static const CGFloat previewViewInset = 3;
-static const CGFloat previewViewTitleHeight = 34;
-
-@class WKPagePreviewViewController;
-
-@protocol WKPagePreviewViewControllerDelegate &lt;NSObject&gt;
-- (NSView *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize;
-- (NSString *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController titleForPreviewOfURL:(NSURL *)url;
-- (void)pagePreviewViewControllerWasClicked:(WKPagePreviewViewController *)pagePreviewViewController;
-@end
-
-@interface WKPagePreviewViewController : NSViewController {
-@public
-    NSSize _mainViewSize;
-    RetainPtr&lt;NSURL&gt; _url;
-    RetainPtr&lt;NSView&gt; _previewView;
-    RetainPtr&lt;NSTextField&gt; _titleTextField;
-    RetainPtr&lt;NSString&gt; _previewTitle;
-    id &lt;WKPagePreviewViewControllerDelegate&gt; _delegate;
-    CGFloat _popoverToViewScale;
-}
-
-@property (nonatomic, copy) NSString *previewTitle;
-
-- (instancetype)initWithPageURL:(NSURL *)URL mainViewSize:(NSSize)size popoverToViewScale:(CGFloat)scale;
-
-+ (NSSize)previewPadding;
-
-@end
-
-@implementation WKPagePreviewViewController
-
-- (instancetype)initWithPageURL:(NSURL *)URL mainViewSize:(NSSize)size popoverToViewScale:(CGFloat)scale
-{
-    if (!(self = [super init]))
-        return nil;
-
-    _url = URL;
-    _mainViewSize = size;
-    _popoverToViewScale = scale;
-
-    return self;
-}
-
-- (NSString *)previewTitle
-{
-    return _previewTitle.get();
-}
-
-- (void)setPreviewTitle:(NSString *)previewTitle
-{
-    if ([_previewTitle isEqualToString:previewTitle])
-        return;
-
-    // Keep a separate copy around in case this is received before the view hierarchy is created.
-    _previewTitle = adoptNS([previewTitle copy]);
-    [_titleTextField setStringValue:previewTitle ? previewTitle : @&quot;&quot;];
-}
-
-+ (NSSize)previewPadding
-{
-    return NSMakeSize(2 * previewViewInset, previewViewTitleHeight + 2 * previewViewInset);
-}
-
-- (void)loadView
-{
-    NSRect defaultFrame = NSMakeRect(0, 0, _mainViewSize.width, _mainViewSize.height);
-    _previewView = [_delegate pagePreviewViewController:self viewForPreviewingURL:_url.get() initialFrameSize:defaultFrame.size];
-    if (!_previewView) {
-        RetainPtr&lt;WKWebView&gt; webView = adoptNS([[WKWebView alloc] initWithFrame:defaultFrame]);
-        [webView _setIgnoresNonWheelEvents:YES];
-        if (_url) {
-            NSURLRequest *request = [NSURLRequest requestWithURL:_url.get()];
-            [webView loadRequest:request];
-        }
-        _previewView = webView;
-    }
-
-    RetainPtr&lt;NSClickGestureRecognizer&gt; clickRecognizer = adoptNS([[NSClickGestureRecognizer alloc] initWithTarget:self action:@selector(_clickRecognized:)]);
-    [_previewView addGestureRecognizer:clickRecognizer.get()];
-
-    NSRect previewFrame = [_previewView frame];
-    NSRect containerFrame = previewFrame;
-    NSSize totalPadding = [[self class] previewPadding];
-    containerFrame.size.width += totalPadding.width;
-    containerFrame.size.height += totalPadding.height;
-    previewFrame = NSOffsetRect(previewFrame, previewViewInset, previewViewInset);
-
-    RetainPtr&lt;NSView&gt; containerView = adoptNS([[NSView alloc] initWithFrame:containerFrame]);
-    [containerView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-    [containerView addSubview:_previewView.get()];
-    [_previewView setFrame:previewFrame];
-    [_previewView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
-
-    _titleTextField = adoptNS([[NSTextField alloc] init]);
-    [_titleTextField setWantsLayer:YES];
-    [_titleTextField setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
-    [_titleTextField setEditable:NO];
-    [_titleTextField setBezeled:NO];
-    [_titleTextField setDrawsBackground:NO];
-    [_titleTextField setAlignment:NSCenterTextAlignment];
-    [_titleTextField setUsesSingleLineMode:YES];
-    [_titleTextField setLineBreakMode:NSLineBreakByTruncatingTail];
-    [_titleTextField setTextColor:[NSColor labelColor]];
-
-    NSString *title = _previewTitle.get();
-    if (!title)
-        title = [_delegate pagePreviewViewController:self titleForPreviewOfURL:_url.get()];
-    if (!title)
-        title = [_url absoluteString];
-
-    [_titleTextField setStringValue:title ? title : @&quot;&quot;];
-
-    [_titleTextField sizeToFit];
-    NSSize titleFittingSize = [_titleTextField frame].size;
-    CGFloat textFieldCenteringOffset = (NSMaxY(containerFrame) - NSMaxY(previewFrame) - titleFittingSize.height) / 2;
-
-    NSRect titleFrame = previewFrame;
-    titleFrame.size.height = titleFittingSize.height;
-    titleFrame.origin.y = NSMaxY(previewFrame) + textFieldCenteringOffset;
-    [_titleTextField setFrame:titleFrame];
-    [containerView addSubview:_titleTextField.get()];
-
-    // Setting the webView bounds will scale it to 75% of the _mainViewSize.
-    [_previewView setBounds:NSMakeRect(0, 0, _mainViewSize.width / _popoverToViewScale, _mainViewSize.height / _popoverToViewScale)];
-
-    self.view = containerView.get();
-}
-
-- (void)_clickRecognized:(NSGestureRecognizer *)gestureRecognizer
-{
-    if (gestureRecognizer.state == NSGestureRecognizerStateBegan)
-        [_delegate pagePreviewViewControllerWasClicked:self];
-}
-
-@end
-
-@interface WKActionMenuController () &lt;WKPagePreviewViewControllerDelegate&gt;
-@end
-
-#endif
-
</del><span class="cx"> @implementation WKActionMenuController
</span><span class="cx"> 
</span><span class="cx"> - (instancetype)initWithPage:(WebPageProxy&amp;)page view:(WKView *)wkView
</span><span class="lines">@@ -255,13 +104,10 @@
</span><span class="cx"> 
</span><span class="cx">     [self dismissActionMenuPopovers];
</span><span class="cx"> 
</span><del>-    _eventLocationInView = [_wkView convertPoint:event.locationInWindow fromView:nil];
-    _page-&gt;performActionMenuHitTestAtLocation(_eventLocationInView);
</del><ins>+    _page-&gt;performActionMenuHitTestAtLocation([_wkView convertPoint:event.locationInWindow fromView:nil]);
</ins><span class="cx"> 
</span><span class="cx">     _state = ActionMenuState::Pending;
</span><span class="cx">     [self _updateActionMenuItems];
</span><del>-
-    _shouldKeepPreviewPopoverOpen = NO;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)isMenuForTextContent
</span><span class="lines">@@ -290,11 +136,6 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
-    if (_type == kWKActionMenuLink)
-        [self _createPreviewPopover];
-#endif
-
</del><span class="cx">     if (![self isMenuForTextContent]) {
</span><span class="cx">         _page-&gt;clearSelection();
</span><span class="cx">         return;
</span><span class="lines">@@ -312,10 +153,6 @@
</span><span class="cx">     if (menu != _wkView.actionMenu)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    [_previewPopover setBehavior:NSPopoverBehaviorTransient];
-    if (!_shouldKeepPreviewPopoverOpen)
-        [self _clearPreviewPopover];
-
</del><span class="cx">     [self _clearActionMenuState];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -351,16 +188,8 @@
</span><span class="cx">         [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
</span><span class="cx"> 
</span><span class="cx">     [self _hideTextIndicator];
</span><del>-    [self _clearPreviewPopover];
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)setPreviewTitle:(NSString *)previewTitle
-{
-#if WK_API_ENABLED
-    [_previewViewController setPreviewTitle:previewTitle];
-#endif
-}
-
</del><span class="cx"> #pragma mark Text Indicator
</span><span class="cx"> 
</span><span class="cx"> - (void)_showTextIndicator
</span><span class="lines">@@ -388,25 +217,9 @@
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForLink
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; openLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagOpenLinkInDefaultBrowser];
</span><del>-
-    BOOL shouldUseStandardQuickLookPreview = [_wkView _shouldUseStandardQuickLookPreview] &amp;&amp; [NSMenuItem respondsToSelector:@selector(standardQuickLookMenuItem)];
-    RetainPtr&lt;NSMenuItem&gt; previewLinkItem;
-    RetainPtr&lt;QLPreviewMenuItem&gt; qlPreviewLinkItem;
-    if (shouldUseStandardQuickLookPreview) {
-        qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
-        [qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
-        [qlPreviewLinkItem setDelegate:self];
-    } else {
-#if WK_API_ENABLED
-        previewLinkItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPreviewLink];
-#else
-        previewLinkItem = [NSMenuItem separatorItem];
-#endif
-    }
-
</del><span class="cx">     RetainPtr&lt;NSMenuItem&gt; readingListItem = [self _createActionMenuItemForTag:kWKContextActionItemTagAddLinkToSafariReadingList];
</span><span class="cx"> 
</span><del>-    return @[ openLinkItem.get(), shouldUseStandardQuickLookPreview ? qlPreviewLinkItem.get() : previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
</del><ins>+    return @[ openLinkItem.get(), [NSMenuItem separatorItem], [NSMenuItem separatorItem], readingListItem.get() ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_openURLFromActionMenu:(id)sender
</span><span class="lines">@@ -422,156 +235,6 @@
</span><span class="cx">     [service performWithItems:@[ [NSURL _web_URLWithWTFString:hitTestResult-&gt;absoluteLinkURL()] ]];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
-- (void)_keepPreviewOpenFromActionMenu:(id)sender
-{
-    _shouldKeepPreviewPopoverOpen = YES;
-}
-
-- (void)_previewURLFromActionMenu:(id)sender
-{
-    ASSERT(_previewPopover);
-
-    // We might already have a preview showing if the menu item was highlighted earlier.
-    if ([_previewPopover isShown])
-        return;
-
-    RefPtr&lt;WebHitTestResult&gt; hitTestResult = [self _webHitTestResult];
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [_previewPopover showRelativeToRect:_popoverOriginRect ofView:_wkView preferredEdge:NSMaxYEdge];
-    });
-}
-
-- (void)_createPreviewPopover
-{
-    RefPtr&lt;WebHitTestResult&gt; hitTestResult = [self _webHitTestResult];
-    NSURL *url = [NSURL _web_URLWithWTFString:hitTestResult-&gt;absoluteLinkURL()];
-    _popoverOriginRect = hitTestResult-&gt;elementBoundingBox();
-
-    NSSize previewPadding = [WKPagePreviewViewController previewPadding];
-    NSSize popoverSize = [self _preferredPopoverSizeWithPreviewPadding:previewPadding];
-    CGFloat actualPopoverToViewScale = popoverSize.width / NSWidth(_wkView.bounds);
-    popoverSize.width += previewPadding.width;
-    popoverSize.height += previewPadding.height;
-
-    _previewViewController = adoptNS([[WKPagePreviewViewController alloc] initWithPageURL:url mainViewSize:_wkView.bounds.size popoverToViewScale:actualPopoverToViewScale]);
-    _previewViewController-&gt;_delegate = self;
-    [_previewViewController loadView];
-
-    _previewPopover = adoptNS([[NSPopover alloc] init]);
-    [_previewPopover setBehavior:NSPopoverBehaviorApplicationDefined];
-    [_previewPopover setContentSize:popoverSize];
-    [_previewPopover setContentViewController:_previewViewController.get()];
-    [_previewPopover setDelegate:self];
-}
-
-static bool targetSizeFitsInAvailableSpace(NSSize targetSize, NSSize availableSpace)
-{
-    return targetSize.width &lt;= availableSpace.width &amp;&amp; targetSize.height &lt;= availableSpace.height;
-}
-
-- (NSSize)largestPopoverSize
-{
-    NSSize screenSize = _wkView.window.screen.frame.size;
-
-    if (screenSize.width == 1280 &amp;&amp; screenSize.height == 800)
-        return NSMakeSize(1240, 674);
-
-    if (screenSize.width == 1366 &amp;&amp; screenSize.height == 768)
-        return NSMakeSize(1264, 642);
-
-    if (screenSize.width == 1440 &amp;&amp; screenSize.height == 900)
-        return NSMakeSize(1264, 760);
-
-    if (screenSize.width == 1680 &amp;&amp; screenSize.height == 1050)
-        return NSMakeSize(1324, 910);
-
-    return NSMakeSize(1324, 940);
-}
-
-- (NSSize)_preferredPopoverSizeWithPreviewPadding:(NSSize)previewPadding
-{
-    static const CGFloat preferredPopoverToViewScale = 0.75;
-    static const NSSize screenPadding = {40, 40};
-    static const NSSize smallestPopoverSize = NSMakeSize(500, 300);
-
-    const NSSize effectivePadding = NSMakeSize(screenPadding.width + previewPadding.width, screenPadding.height + previewPadding.height);
-
-    NSWindow *window = _wkView.window;
-    NSRect originScreenRect = [window convertRectToScreen:[_wkView convertRect:_popoverOriginRect toView:nil]];
-    NSRect screenFrame = window.screen.visibleFrame;
-
-    NSRect wkViewBounds = _wkView.bounds;
-    NSSize targetSize = NSMakeSize(NSWidth(wkViewBounds) * preferredPopoverToViewScale, NSHeight(wkViewBounds) * preferredPopoverToViewScale);
-    NSSize largestPopoverSize = [self largestPopoverSize];
-
-    CGFloat availableSpaceAbove = NSMaxY(screenFrame) - NSMaxY(originScreenRect);
-    CGFloat availableSpaceBelow = NSMinY(originScreenRect) - NSMinY(screenFrame);
-    CGFloat maxAvailableVerticalSpace = fmax(availableSpaceAbove, availableSpaceBelow) - effectivePadding.height;
-    NSSize maxSpaceAvailableOnYEdge = NSMakeSize(screenFrame.size.width - effectivePadding.height, maxAvailableVerticalSpace);
-    if (targetSizeFitsInAvailableSpace(targetSize, maxSpaceAvailableOnYEdge) &amp;&amp; targetSizeFitsInAvailableSpace(targetSize, largestPopoverSize))
-        return targetSize;
-
-    CGFloat availableSpaceAtLeft = NSMinX(originScreenRect) - NSMinX(screenFrame);
-    CGFloat availableSpaceAtRight = NSMaxX(screenFrame) - NSMaxX(originScreenRect);
-    CGFloat maxAvailableHorizontalSpace = fmax(availableSpaceAtLeft, availableSpaceAtRight) - effectivePadding.width;
-    NSSize maxSpaceAvailableOnXEdge = NSMakeSize(maxAvailableHorizontalSpace, screenFrame.size.height - effectivePadding.width);
-    if (targetSizeFitsInAvailableSpace(targetSize, maxSpaceAvailableOnXEdge) &amp;&amp; targetSizeFitsInAvailableSpace(targetSize, largestPopoverSize))
-        return targetSize;
-
-    // Adjust the maximum space available if it is larger than the largest popover size.
-    if (maxSpaceAvailableOnYEdge.width &gt; largestPopoverSize.width &amp;&amp; maxSpaceAvailableOnYEdge.height &gt; largestPopoverSize.height)
-        maxSpaceAvailableOnYEdge = largestPopoverSize;
-    if (maxSpaceAvailableOnXEdge.width &gt; largestPopoverSize.width &amp;&amp; maxSpaceAvailableOnXEdge.height &gt; largestPopoverSize.height)
-        maxSpaceAvailableOnXEdge = largestPopoverSize;
-
-    // If the target size doesn't fit anywhere, we'll find the largest rect that does fit that also maintains the original view's aspect ratio.
-    CGFloat aspectRatio = wkViewBounds.size.width / wkViewBounds.size.height;
-    FloatRect maxVerticalTargetSizePreservingAspectRatioRect = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(0, 0, maxSpaceAvailableOnYEdge.width, maxSpaceAvailableOnYEdge.height));
-    FloatRect maxHorizontalTargetSizePreservingAspectRatioRect = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(0, 0, maxSpaceAvailableOnXEdge.width, maxSpaceAvailableOnXEdge.height));
-
-    NSSize maxVerticalTargetSizePreservingAspectRatio = NSMakeSize(maxVerticalTargetSizePreservingAspectRatioRect.width(), maxVerticalTargetSizePreservingAspectRatioRect.height());
-    NSSize maxHortizontalTargetSizePreservingAspectRatio = NSMakeSize(maxHorizontalTargetSizePreservingAspectRatioRect.width(), maxHorizontalTargetSizePreservingAspectRatioRect.height());
-
-    NSSize computedTargetSize;
-    if ((maxVerticalTargetSizePreservingAspectRatio.width * maxVerticalTargetSizePreservingAspectRatio.height) &gt; (maxHortizontalTargetSizePreservingAspectRatio.width * maxHortizontalTargetSizePreservingAspectRatio.height))
-        computedTargetSize = maxVerticalTargetSizePreservingAspectRatio;
-    computedTargetSize = maxHortizontalTargetSizePreservingAspectRatio;
-
-    // Now make sure what we've computed isn't too small.
-    if (computedTargetSize.width &lt; smallestPopoverSize.width &amp;&amp; computedTargetSize.height &lt; smallestPopoverSize.height) {
-        float limitWidth = smallestPopoverSize.width &gt; computedTargetSize.width ? smallestPopoverSize.width : computedTargetSize.width;
-        float limitHeight = smallestPopoverSize.height &gt; computedTargetSize.height ? smallestPopoverSize.height : computedTargetSize.height;
-        FloatRect targetRectLargerThanMinSize = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(0, 0, limitWidth, limitHeight));
-        computedTargetSize = NSMakeSize(targetRectLargerThanMinSize.size().width(), targetRectLargerThanMinSize.size().height());
-
-        // If our orignal computedTargetSize was so small that we had to get here and make a new computedTargetSize that is
-        // larger than the minimum, then the elementBoundingBox of the _hitTestResult is probably huge. So we should use
-        // the event origin as the popover origin in this case and not worry about obscuring the _hitTestResult.
-        _popoverOriginRect.origin = _eventLocationInView;
-        _popoverOriginRect.size = NSMakeSize(1, 1);
-    }
-
-    return computedTargetSize;
-}
-
-#endif // WK_API_ENABLED
-
-- (void)_clearPreviewPopover
-{
-#if WK_API_ENABLED
-    if (_previewViewController) {
-        _previewViewController-&gt;_delegate = nil;
-        [_wkView _finishPreviewingURL:_previewViewController-&gt;_url.get() withPreviewView:_previewViewController-&gt;_previewView.get()];
-        _previewViewController = nil;
-    }
-#endif
-
-    [_previewPopover close];
-    [_previewPopover setDelegate:nil];
-    _previewPopover = nil;
-}
-
</del><span class="cx"> #pragma mark Video actions
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForVideo
</span><span class="lines">@@ -912,15 +575,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
-{
-#if WK_API_ENABLED
-    if (item.tag != kWKContextActionItemTagPreviewLink)
-        return;
-    [self _previewURLFromActionMenu:item];
-#endif
-}
-
</del><span class="cx"> #pragma mark NSSharingServicePickerDelegate implementation
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items mask:(NSSharingServiceMask)mask proposedSharingServices:(NSArray *)proposedServices
</span><span class="lines">@@ -948,35 +602,6 @@
</span><span class="cx">     return _wkView.window;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#pragma mark NSPopoverDelegate implementation
-
-- (void)popoverWillClose:(NSNotification *)notification
-{
-    _shouldKeepPreviewPopoverOpen = NO;
-    [self _clearPreviewPopover];
-}
-
-#pragma mark QLPreviewMenuItemDelegate implementation
-
-- (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint
-{
-    return _wkView;
-}
-
-- (id&lt;QLPreviewItem&gt;)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point
-{
-    if (!_wkView)
-        return nil;
-
-    RefPtr&lt;WebHitTestResult&gt; hitTestResult = [self _webHitTestResult];
-    return [NSURL _web_URLWithWTFString:hitTestResult-&gt;absoluteLinkURL()];
-}
-
-- (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point
-{
-    return NSMaxYEdge;
-}
-
</del><span class="cx"> #pragma mark Menu Items
</span><span class="cx"> 
</span><span class="cx"> - (RetainPtr&lt;NSMenuItem&gt;)_createActionMenuItemForTag:(uint32_t)tag
</span><span class="lines">@@ -994,13 +619,9 @@
</span><span class="cx">         image = [NSImage imageNamed:@&quot;NSActionMenuOpenInNewWindow&quot;];
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
</del><span class="cx">     case kWKContextActionItemTagPreviewLink:
</span><del>-        selector = @selector(_keepPreviewOpenFromActionMenu:);
-        title = @&quot;&quot;;
-        image = [NSImage imageNamed:@&quot;NSActionMenuQuickLook&quot;];
</del><ins>+        ASSERT_NOT_REACHED();
</ins><span class="cx">         break;
</span><del>-#endif
</del><span class="cx"> 
</span><span class="cx">     case kWKContextActionItemTagAddLinkToSafariReadingList:
</span><span class="cx">         selector = @selector(_addToReadingListFromActionMenu:);
</span><span class="lines">@@ -1195,28 +816,6 @@
</span><span class="cx">         [_wkView.actionMenu cancelTracking];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if WK_API_ENABLED
-
-#pragma mark WKPagePreviewViewControllerDelegate
-
-- (NSView *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize
-{
-    return [_wkView _viewForPreviewingURL:url initialFrameSize:initialFrameSize];
-}
-
-- (NSString *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController titleForPreviewOfURL:(NSURL *)url
-{
-    return [_wkView _titleForPreviewOfURL:url];
-}
-
-- (void)pagePreviewViewControllerWasClicked:(WKPagePreviewViewController *)pagePreviewViewController
-{
-    if (NSURL *url = pagePreviewViewController-&gt;_url.get())
-        [_wkView _handleClickInPreviewView:pagePreviewViewController-&gt;_previewView.get() URL:url];
-}
-
-#endif
-
</del><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKImmediateActionControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -43,6 +43,8 @@
</span><span class="cx"> };
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+@class NSImmediateActionGestureRecognizer;
+@class WKPagePreviewViewController;
</ins><span class="cx"> @class WKView;
</span><span class="cx"> 
</span><span class="cx"> @interface WKImmediateActionController : NSObject &lt;NSGestureRecognizerDelegate&gt; {
</span><span class="lines">@@ -53,14 +55,24 @@
</span><span class="cx">     WebKit::ImmediateActionState _state;
</span><span class="cx">     WebKit::ActionMenuHitTestResult _hitTestResult;
</span><span class="cx">     _WKImmediateActionType _type;
</span><ins>+    NSImmediateActionGestureRecognizer *_immediateActionRecognizer;
</ins><span class="cx"> 
</span><span class="cx">     NSPoint _eventLocationInView;
</span><ins>+
+#if WK_API_ENABLED
+    RetainPtr&lt;NSPopover&gt; _previewPopover;
+    String _previewPopoverOriginalURL;
+    NSRect _popoverOriginRect;
+    RetainPtr&lt;WKPagePreviewViewController&gt; _previewViewController;
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (instancetype)initWithPage:(WebKit::WebPageProxy&amp;)page view:(WKView *)wkView;
</del><ins>+- (instancetype)initWithPage:(WebKit::WebPageProxy&amp;)page view:(WKView *)wkView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
</ins><span class="cx"> - (void)willDestroyView:(WKView *)view;
</span><span class="cx"> - (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&amp;)hitTestResult userData:(API::Object*)userData;
</span><span class="cx"> 
</span><ins>+- (void)setPreviewTitle:(NSString *)previewTitle;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -28,19 +28,37 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="cx"> 
</span><ins>+#import &quot;WKNSURLExtras.h&quot;
+#import &quot;WKPagePreviewViewController.h&quot;
</ins><span class="cx"> #import &quot;WKViewInternal.h&quot;
</span><span class="cx"> #import &quot;WebPageMessages.h&quot;
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><span class="cx"> #import &quot;WebPageProxyMessages.h&quot;
</span><span class="cx"> #import &quot;WebProcessProxy.h&quot;
</span><ins>+#import &lt;WebCore/GeometryUtilities.h&gt;
</ins><span class="cx"> #import &lt;WebCore/NSImmediateActionGestureRecognizerSPI.h&gt;
</span><ins>+#import &lt;WebCore/NSMenuSPI.h&gt;
+#import &lt;WebCore/QuickLookMacSPI.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;WebCore/URL.h&gt;
</ins><span class="cx"> 
</span><ins>+SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI)
+SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem)
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> 
</span><ins>+@interface WKImmediateActionController () &lt;NSPopoverDelegate, QLPreviewMenuItemDelegate&gt;
+@end
+
+#if WK_API_ENABLED
+@interface WKImmediateActionController () &lt;WKPagePreviewViewControllerDelegate&gt;
+@end
+#endif
+
</ins><span class="cx"> @implementation WKImmediateActionController
</span><span class="cx"> 
</span><del>-- (instancetype)initWithPage:(WebPageProxy&amp;)page view:(WKView *)wkView
</del><ins>+- (instancetype)initWithPage:(WebPageProxy&amp;)page view:(WKView *)wkView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</ins><span class="cx"> {
</span><span class="cx">     self = [super init];
</span><span class="cx"> 
</span><span class="lines">@@ -50,6 +68,7 @@
</span><span class="cx">     _page = &amp;page;
</span><span class="cx">     _wkView = wkView;
</span><span class="cx">     _type = kWKImmediateActionNone;
</span><ins>+    _immediateActionRecognizer = immediateActionRecognizer;
</ins><span class="cx"> 
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="lines">@@ -81,7 +100,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)immediateActionRecognizerWillPrepare:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="cx"> {
</span><del>-    if (immediateActionRecognizer.view != _wkView)
</del><ins>+    if (immediateActionRecognizer != _immediateActionRecognizer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     _eventLocationInView = [immediateActionRecognizer locationInView:immediateActionRecognizer.view];
</span><span class="lines">@@ -93,7 +112,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)immediateActionRecognizerWillBeginAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="cx"> {
</span><del>-    if (immediateActionRecognizer.view != _wkView)
</del><ins>+    if (immediateActionRecognizer != _immediateActionRecognizer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     ASSERT(_state != ImmediateActionState::None);
</span><span class="lines">@@ -114,7 +133,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)immediateActionRecognizerDidCancelAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="cx"> {
</span><del>-    if (immediateActionRecognizer.view != _wkView)
</del><ins>+    if (immediateActionRecognizer != _immediateActionRecognizer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     [self _clearImmediateActionState];
</span><span class="lines">@@ -122,19 +141,247 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)immediateActionRecognizerDidCompleteAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="cx"> {
</span><del>-    if (immediateActionRecognizer.view != _wkView)
</del><ins>+    if (immediateActionRecognizer != _immediateActionRecognizer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Add support for the types of functionality provided in Action menu's willOpenMenu.
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (PassRefPtr&lt;WebHitTestResult&gt;)_webHitTestResult
+{
+    RefPtr&lt;WebHitTestResult&gt; hitTestResult;
+    if (_state == ImmediateActionState::Ready)
+        hitTestResult = WebHitTestResult::create(_hitTestResult.hitTestResult);
+    else
+        hitTestResult = _page-&gt;lastMouseMoveHitTestResult();
+
+    return hitTestResult.release();
+}
+
</ins><span class="cx"> #pragma mark Immediate actions
</span><span class="cx"> 
</span><span class="cx"> - (void)_updateImmediateActionItem
</span><span class="cx"> {
</span><del>-    // FIXME: Implement.
</del><ins>+    RefPtr&lt;WebHitTestResult&gt; hitTestResult = [self _webHitTestResult];
+
+    _type = kWKImmediateActionNone;
+    _immediateActionRecognizer.animationController = nil;
+
+    if (!hitTestResult)
+        return;
+
+    String absoluteLinkURL = hitTestResult-&gt;absoluteLinkURL();
+    if (!absoluteLinkURL.isEmpty() &amp;&amp; WebCore::protocolIsInHTTPFamily(absoluteLinkURL)) {
+        _type = kWKImmediateActionLinkPreview;
+
+        BOOL shouldUseStandardQuickLookPreview = [_wkView _shouldUseStandardQuickLookPreview] &amp;&amp; [NSMenuItem respondsToSelector:@selector(standardQuickLookMenuItem)];
+        if (shouldUseStandardQuickLookPreview) {
+            RetainPtr&lt;NSMenuItem&gt; previewLinkItem;
+            RetainPtr&lt;QLPreviewMenuItem&gt; qlPreviewLinkItem;
+            if (shouldUseStandardQuickLookPreview) {
+                qlPreviewLinkItem = [NSMenuItem standardQuickLookMenuItem];
+                [qlPreviewLinkItem setPreviewStyle:QLPreviewStylePopover];
+                [qlPreviewLinkItem setDelegate:self];
+            }
+            _immediateActionRecognizer.animationController = (id&lt;NSImmediateActionAnimationController&gt;)qlPreviewLinkItem.get();
+        } else {
+#if WK_API_ENABLED
+            [self _createPreviewPopoverIfNeededForURL:absoluteLinkURL];
+            _immediateActionRecognizer.animationController = (id&lt;NSImmediateActionAnimationController&gt;)_previewPopover.get();
+#endif // WK_API_ENABLED
+        }
+
+        return;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark Link Preview action
+
+#if WK_API_ENABLED
+
+- (void)_createPreviewPopoverIfNeededForURL:(String)absoluteLinkURL
+{
+    if (_previewPopoverOriginalURL == absoluteLinkURL)
+        return;
+
+    _previewPopoverOriginalURL = absoluteLinkURL;
+
+    NSURL *url = [NSURL _web_URLWithWTFString:absoluteLinkURL];
+    RefPtr&lt;WebHitTestResult&gt; hitTestResult = [self _webHitTestResult];
+    _popoverOriginRect = hitTestResult-&gt;elementBoundingBox();
+
+    NSSize previewPadding = [WKPagePreviewViewController previewPadding];
+    NSSize popoverSize = [self _preferredPopoverSizeWithPreviewPadding:previewPadding];
+    CGFloat actualPopoverToViewScale = popoverSize.width / NSWidth(_wkView.bounds);
+    popoverSize.width += previewPadding.width;
+    popoverSize.height += previewPadding.height;
+
+    _previewViewController = adoptNS([[WKPagePreviewViewController alloc] initWithPageURL:url mainViewSize:_wkView.bounds.size popoverToViewScale:actualPopoverToViewScale]);
+    _previewViewController-&gt;_delegate = self;
+    [_previewViewController loadView];
+
+    _previewPopover = adoptNS([[NSPopover alloc] init]);
+    [_previewPopover setBehavior:NSPopoverBehaviorTransient];
+    [_previewPopover setContentSize:popoverSize];
+    [_previewPopover setContentViewController:_previewViewController.get()];
+    [_previewPopover setDelegate:self];
+}
+
+- (void)_clearPreviewPopover
+{
+    if (_previewViewController) {
+        _previewViewController-&gt;_delegate = nil;
+        [_wkView _finishPreviewingURL:_previewViewController-&gt;_url.get() withPreviewView:_previewViewController-&gt;_previewView.get()];
+        _previewViewController = nil;
+    }
+
+    [_previewPopover close];
+    [_previewPopover setDelegate:nil];
+    _previewPopover = nil;
+    _previewPopoverOriginalURL = String();
+}
+
+- (void)setPreviewTitle:(NSString *)previewTitle
+{
+    [_previewViewController setPreviewTitle:previewTitle];
+}
+
+- (void)popoverWillClose:(NSNotification *)notification
+{
+    [self _clearPreviewPopover];
+}
+
+static bool targetSizeFitsInAvailableSpace(NSSize targetSize, NSSize availableSpace)
+{
+    return targetSize.width &lt;= availableSpace.width &amp;&amp; targetSize.height &lt;= availableSpace.height;
+}
+
+- (NSSize)largestPopoverSize
+{
+    NSSize screenSize = _wkView.window.screen.frame.size;
+
+    if (screenSize.width == 1280 &amp;&amp; screenSize.height == 800)
+        return NSMakeSize(1240, 674);
+
+    if (screenSize.width == 1366 &amp;&amp; screenSize.height == 768)
+        return NSMakeSize(1264, 642);
+
+    if (screenSize.width == 1440 &amp;&amp; screenSize.height == 900)
+        return NSMakeSize(1264, 760);
+
+    if (screenSize.width == 1680 &amp;&amp; screenSize.height == 1050)
+        return NSMakeSize(1324, 910);
+
+    return NSMakeSize(1324, 940);
+}
+
+- (NSSize)_preferredPopoverSizeWithPreviewPadding:(NSSize)previewPadding
+{
+    static const CGFloat preferredPopoverToViewScale = 0.75;
+    static const NSSize screenPadding = {40, 40};
+    static const NSSize smallestPopoverSize = NSMakeSize(500, 300);
+
+    const NSSize effectivePadding = NSMakeSize(screenPadding.width + previewPadding.width, screenPadding.height + previewPadding.height);
+
+    NSWindow *window = _wkView.window;
+    NSRect originScreenRect = [window convertRectToScreen:[_wkView convertRect:_popoverOriginRect toView:nil]];
+    NSRect screenFrame = window.screen.visibleFrame;
+
+    NSRect wkViewBounds = _wkView.bounds;
+    NSSize targetSize = NSMakeSize(NSWidth(wkViewBounds) * preferredPopoverToViewScale, NSHeight(wkViewBounds) * preferredPopoverToViewScale);
+    NSSize largestPopoverSize = [self largestPopoverSize];
+
+    CGFloat availableSpaceAbove = NSMaxY(screenFrame) - NSMaxY(originScreenRect);
+    CGFloat availableSpaceBelow = NSMinY(originScreenRect) - NSMinY(screenFrame);
+    CGFloat maxAvailableVerticalSpace = fmax(availableSpaceAbove, availableSpaceBelow) - effectivePadding.height;
+    NSSize maxSpaceAvailableOnYEdge = NSMakeSize(screenFrame.size.width - effectivePadding.height, maxAvailableVerticalSpace);
+    if (targetSizeFitsInAvailableSpace(targetSize, maxSpaceAvailableOnYEdge) &amp;&amp; targetSizeFitsInAvailableSpace(targetSize, largestPopoverSize))
+        return targetSize;
+
+    CGFloat availableSpaceAtLeft = NSMinX(originScreenRect) - NSMinX(screenFrame);
+    CGFloat availableSpaceAtRight = NSMaxX(screenFrame) - NSMaxX(originScreenRect);
+    CGFloat maxAvailableHorizontalSpace = fmax(availableSpaceAtLeft, availableSpaceAtRight) - effectivePadding.width;
+    NSSize maxSpaceAvailableOnXEdge = NSMakeSize(maxAvailableHorizontalSpace, screenFrame.size.height - effectivePadding.width);
+    if (targetSizeFitsInAvailableSpace(targetSize, maxSpaceAvailableOnXEdge) &amp;&amp; targetSizeFitsInAvailableSpace(targetSize, largestPopoverSize))
+        return targetSize;
+
+    // Adjust the maximum space available if it is larger than the largest popover size.
+    if (maxSpaceAvailableOnYEdge.width &gt; largestPopoverSize.width &amp;&amp; maxSpaceAvailableOnYEdge.height &gt; largestPopoverSize.height)
+        maxSpaceAvailableOnYEdge = largestPopoverSize;
+    if (maxSpaceAvailableOnXEdge.width &gt; largestPopoverSize.width &amp;&amp; maxSpaceAvailableOnXEdge.height &gt; largestPopoverSize.height)
+        maxSpaceAvailableOnXEdge = largestPopoverSize;
+
+    // If the target size doesn't fit anywhere, we'll find the largest rect that does fit that also maintains the original view's aspect ratio.
+    CGFloat aspectRatio = wkViewBounds.size.width / wkViewBounds.size.height;
+    FloatRect maxVerticalTargetSizePreservingAspectRatioRect = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(0, 0, maxSpaceAvailableOnYEdge.width, maxSpaceAvailableOnYEdge.height));
+    FloatRect maxHorizontalTargetSizePreservingAspectRatioRect = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(0, 0, maxSpaceAvailableOnXEdge.width, maxSpaceAvailableOnXEdge.height));
+
+    NSSize maxVerticalTargetSizePreservingAspectRatio = NSMakeSize(maxVerticalTargetSizePreservingAspectRatioRect.width(), maxVerticalTargetSizePreservingAspectRatioRect.height());
+    NSSize maxHortizontalTargetSizePreservingAspectRatio = NSMakeSize(maxHorizontalTargetSizePreservingAspectRatioRect.width(), maxHorizontalTargetSizePreservingAspectRatioRect.height());
+
+    NSSize computedTargetSize;
+    if ((maxVerticalTargetSizePreservingAspectRatio.width * maxVerticalTargetSizePreservingAspectRatio.height) &gt; (maxHortizontalTargetSizePreservingAspectRatio.width * maxHortizontalTargetSizePreservingAspectRatio.height))
+        computedTargetSize = maxVerticalTargetSizePreservingAspectRatio;
+    computedTargetSize = maxHortizontalTargetSizePreservingAspectRatio;
+
+    // Now make sure what we've computed isn't too small.
+    if (computedTargetSize.width &lt; smallestPopoverSize.width &amp;&amp; computedTargetSize.height &lt; smallestPopoverSize.height) {
+        float limitWidth = smallestPopoverSize.width &gt; computedTargetSize.width ? smallestPopoverSize.width : computedTargetSize.width;
+        float limitHeight = smallestPopoverSize.height &gt; computedTargetSize.height ? smallestPopoverSize.height : computedTargetSize.height;
+        FloatRect targetRectLargerThanMinSize = largestRectWithAspectRatioInsideRect(aspectRatio, FloatRect(0, 0, limitWidth, limitHeight));
+        computedTargetSize = NSMakeSize(targetRectLargerThanMinSize.size().width(), targetRectLargerThanMinSize.size().height());
+
+        // If our orignal computedTargetSize was so small that we had to get here and make a new computedTargetSize that is
+        // larger than the minimum, then the elementBoundingBox of the _hitTestResult is probably huge. So we should use
+        // the event origin as the popover origin in this case and not worry about obscuring the _hitTestResult.
+        _popoverOriginRect.origin = _eventLocationInView;
+        _popoverOriginRect.size = NSMakeSize(1, 1);
+    }
+    
+    return computedTargetSize;
+}
+
+#pragma mark WKPagePreviewViewControllerDelegate
+
+- (NSView *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize
+{
+    return [_wkView _viewForPreviewingURL:url initialFrameSize:initialFrameSize];
+}
+
+- (NSString *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController titleForPreviewOfURL:(NSURL *)url
+{
+    return [_wkView _titleForPreviewOfURL:url];
+}
+
+- (void)pagePreviewViewControllerWasClicked:(WKPagePreviewViewController *)pagePreviewViewController
+{
+    if (NSURL *url = pagePreviewViewController-&gt;_url.get())
+        [_wkView _handleClickInPreviewView:pagePreviewViewController-&gt;_previewView.get() URL:url];
+}
+
+#endif // WK_API_ENABLED
+
+#pragma mark QLPreviewMenuItemDelegate implementation
+
+- (NSView *)menuItem:(NSMenuItem *)menuItem viewAtScreenPoint:(NSPoint)screenPoint
+{
+    return _wkView;
+}
+
+- (id&lt;QLPreviewItem&gt;)menuItem:(NSMenuItem *)menuItem previewItemAtPoint:(NSPoint)point
+{
+    if (!_wkView)
+        return nil;
+
+    RefPtr&lt;WebHitTestResult&gt; hitTestResult = [self _webHitTestResult];
+    return [NSURL _web_URLWithWTFString:hitTestResult-&gt;absoluteLinkURL()];
+}
+
+- (NSRectEdge)menuItem:(NSMenuItem *)menuItem preferredEdgeForPoint:(NSPoint)point
+{
+    return NSMaxYEdge;
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKPagePreviewViewControllerhfromrev177180trunkSourceWebKit2UIProcessmacWKPagePreviewViewControllerh"></a>
<div class="copfile"><h4>Copied: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h (from rev 177180, trunk/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h) (0 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h                                (rev 0)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.h        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -0,0 +1,66 @@
</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.
+ */
+
+#ifndef WKPagePreviewViewController_h
+#define WKPagePreviewViewController_h
+
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+#import &lt;wtf/RetainPtr.h&gt;
+
+@class NSString;
+@class NSTextField;
+@class NSURL;
+@class NSView;
+@class WKPagePreviewViewController;
+
+@protocol WKPagePreviewViewControllerDelegate &lt;NSObject&gt;
+- (NSView *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize;
+- (NSString *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController titleForPreviewOfURL:(NSURL *)url;
+- (void)pagePreviewViewControllerWasClicked:(WKPagePreviewViewController *)pagePreviewViewController;
+@end
+
+@interface WKPagePreviewViewController : NSViewController {
+@public
+    NSSize _mainViewSize;
+    RetainPtr&lt;NSURL&gt; _url;
+    RetainPtr&lt;NSView&gt; _previewView;
+    RetainPtr&lt;NSTextField&gt; _titleTextField;
+    RetainPtr&lt;NSString&gt; _previewTitle;
+    id &lt;WKPagePreviewViewControllerDelegate&gt; _delegate;
+    CGFloat _popoverToViewScale;
+}
+
+@property (nonatomic, copy) NSString *previewTitle;
+
+- (instancetype)initWithPageURL:(NSURL *)URL mainViewSize:(NSSize)size popoverToViewScale:(CGFloat)scale;
+
++ (NSSize)previewPadding;
+
+@end
+
+#endif // PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+#endif // WKPagePreviewViewController_h
</ins></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKPagePreviewViewControllermmfromrev177180trunkSourceWebKit2UIProcessmacWKPagePreviewViewControllermm"></a>
<div class="copfile"><h4>Copied: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm (from rev 177180, trunk/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm) (0 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm                                (rev 0)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKPagePreviewViewController.mm        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -0,0 +1,143 @@
</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 &quot;config.h&quot;
+#import &quot;WKPagePreviewViewController.h&quot;
+
+#import &quot;WKWebViewInternal.h&quot;
+
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000 &amp;&amp; WK_API_ENABLED
+
+static const CGFloat previewViewInset = 3;
+static const CGFloat previewViewTitleHeight = 34;
+
+@implementation WKPagePreviewViewController
+
+- (instancetype)initWithPageURL:(NSURL *)URL mainViewSize:(NSSize)size popoverToViewScale:(CGFloat)scale
+{
+    if (!(self = [super init]))
+        return nil;
+
+    _url = URL;
+    _mainViewSize = size;
+    _popoverToViewScale = scale;
+
+    return self;
+}
+
+- (NSString *)previewTitle
+{
+    return _previewTitle.get();
+}
+
+- (void)setPreviewTitle:(NSString *)previewTitle
+{
+    if ([_previewTitle isEqualToString:previewTitle])
+        return;
+
+    // Keep a separate copy around in case this is received before the view hierarchy is created.
+    _previewTitle = adoptNS([previewTitle copy]);
+    [_titleTextField setStringValue:previewTitle ? previewTitle : @&quot;&quot;];
+}
+
++ (NSSize)previewPadding
+{
+    return NSMakeSize(2 * previewViewInset, previewViewTitleHeight + 2 * previewViewInset);
+}
+
+- (void)loadView
+{
+    NSRect defaultFrame = NSMakeRect(0, 0, _mainViewSize.width, _mainViewSize.height);
+    _previewView = [_delegate pagePreviewViewController:self viewForPreviewingURL:_url.get() initialFrameSize:defaultFrame.size];
+    if (!_previewView) {
+        RetainPtr&lt;WKWebView&gt; webView = adoptNS([[WKWebView alloc] initWithFrame:defaultFrame]);
+        [webView _setIgnoresNonWheelEvents:YES];
+        if (_url) {
+            NSURLRequest *request = [NSURLRequest requestWithURL:_url.get()];
+            [webView loadRequest:request];
+        }
+        _previewView = webView;
+    }
+
+    RetainPtr&lt;NSClickGestureRecognizer&gt; clickRecognizer = adoptNS([[NSClickGestureRecognizer alloc] initWithTarget:self action:@selector(_clickRecognized:)]);
+    [_previewView addGestureRecognizer:clickRecognizer.get()];
+
+    NSRect previewFrame = [_previewView frame];
+    NSRect containerFrame = previewFrame;
+    NSSize totalPadding = [[self class] previewPadding];
+    containerFrame.size.width += totalPadding.width;
+    containerFrame.size.height += totalPadding.height;
+    previewFrame = NSOffsetRect(previewFrame, previewViewInset, previewViewInset);
+
+    RetainPtr&lt;NSView&gt; containerView = adoptNS([[NSView alloc] initWithFrame:containerFrame]);
+    [containerView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+    [containerView addSubview:_previewView.get()];
+    [_previewView setFrame:previewFrame];
+    [_previewView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
+
+    _titleTextField = adoptNS([[NSTextField alloc] init]);
+    [_titleTextField setWantsLayer:YES];
+    [_titleTextField setAutoresizingMask:NSViewWidthSizable | NSViewMinYMargin];
+    [_titleTextField setEditable:NO];
+    [_titleTextField setBezeled:NO];
+    [_titleTextField setDrawsBackground:NO];
+    [_titleTextField setAlignment:NSCenterTextAlignment];
+    [_titleTextField setUsesSingleLineMode:YES];
+    [_titleTextField setLineBreakMode:NSLineBreakByTruncatingTail];
+    [_titleTextField setTextColor:[NSColor labelColor]];
+
+    NSString *title = _previewTitle.get();
+    if (!title)
+        title = [_delegate pagePreviewViewController:self titleForPreviewOfURL:_url.get()];
+    if (!title)
+        title = [_url absoluteString];
+
+    [_titleTextField setStringValue:title ? title : @&quot;&quot;];
+
+    [_titleTextField sizeToFit];
+    NSSize titleFittingSize = [_titleTextField frame].size;
+    CGFloat textFieldCenteringOffset = (NSMaxY(containerFrame) - NSMaxY(previewFrame) - titleFittingSize.height) / 2;
+
+    NSRect titleFrame = previewFrame;
+    titleFrame.size.height = titleFittingSize.height;
+    titleFrame.origin.y = NSMaxY(previewFrame) + textFieldCenteringOffset;
+    [_titleTextField setFrame:titleFrame];
+    [containerView addSubview:_titleTextField.get()];
+
+    // Setting the webView bounds will scale it to 75% of the _mainViewSize.
+    [_previewView setBounds:NSMakeRect(0, 0, _mainViewSize.width / _popoverToViewScale, _mainViewSize.height / _popoverToViewScale)];
+
+    self.view = containerView.get();
+}
+
+- (void)_clickRecognized:(NSGestureRecognizer *)gestureRecognizer
+{
+    if (gestureRecognizer.state == NSGestureRecognizerStateBegan)
+        [_delegate pagePreviewViewControllerWasClicked:self];
+}
+
+@end
+
+#endif // PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000 &amp;&amp; WK_API_ENABLED
</ins></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (177338 => 177339)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-12-16 08:08:44 UTC (rev 177338)
+++ branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-12-16 08:15:25 UTC (rev 177339)
</span><span class="lines">@@ -632,6 +632,8 @@
</span><span class="cx">                 2DDF731618E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DDF731418E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm */; };
</span><span class="cx">                 2DE6943D18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */; };
</span><span class="cx">                 2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */; };
</span><ins>+                2DEB34711A3987AB0030E2BA /* WKPagePreviewViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DEB346F1A3987AB0030E2BA /* WKPagePreviewViewController.h */; };
+                2DEB34721A3987AB0030E2BA /* WKPagePreviewViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DEB34701A3987AB0030E2BA /* WKPagePreviewViewController.mm */; };
</ins><span class="cx">                 2DF9593B18A42412009785A1 /* ViewGestureControllerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */; };
</span><span class="cx">                 31099973146C75A20029DEB9 /* WebNotificationClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31099971146C759B0029DEB9 /* WebNotificationClient.cpp */; };
</span><span class="cx">                 310999C7146C9E3D0029DEB9 /* WebNotificationClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31099968146C71F50029DEB9 /* WebNotificationClient.h */; };
</span><span class="lines">@@ -2646,6 +2648,8 @@
</span><span class="cx">                 2DDF731418E95060004F5A66 /* RemoteLayerBackingStoreCollection.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerBackingStoreCollection.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DE6943B18BD2A68005C15E5 /* SmartMagnificationControllerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SmartMagnificationControllerMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2DE6943C18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SmartMagnificationControllerMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2DEB346F1A3987AB0030E2BA /* WKPagePreviewViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPagePreviewViewController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                2DEB34701A3987AB0030E2BA /* WKPagePreviewViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKPagePreviewViewController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2DF9593418A42412009785A1 /* ViewGestureControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ViewGestureControllerIOS.mm; path = ios/ViewGestureControllerIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31099968146C71F50029DEB9 /* WebNotificationClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebNotificationClient.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 31099971146C759B0029DEB9 /* WebNotificationClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationClient.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6647,6 +6651,8 @@
</span><span class="cx">                                 CDCA85C6132ABA4E00E961DF /* WKFullScreenWindowController.mm */,
</span><span class="cx">                                 9321D5851A38EE3C008052BE /* WKImmediateActionController.h */,
</span><span class="cx">                                 9321D5871A38EE74008052BE /* WKImmediateActionController.mm */,
</span><ins>+                                2DEB346F1A3987AB0030E2BA /* WKPagePreviewViewController.h */,
+                                2DEB34701A3987AB0030E2BA /* WKPagePreviewViewController.mm */,
</ins><span class="cx">                                 0FCB4E5C18BBE3D9000FCFC9 /* WKPrintingView.h */,
</span><span class="cx">                                 0FCB4E5D18BBE3D9000FCFC9 /* WKPrintingView.mm */,
</span><span class="cx">                                 0FCB4E5E18BBE3D9000FCFC9 /* WKTextInputWindowController.h */,
</span><span class="lines">@@ -7352,6 +7358,7 @@
</span><span class="cx">                                 1A4A9F3312B844E2008FE984 /* PluginQuirks.h in Headers */,
</span><span class="cx">                                 7CD622781739D863005BD7FF /* PluginSandboxProfile.h in Headers */,
</span><span class="cx">                                 1AAB037A185A7C6A00EDF501 /* MessageSender.h in Headers */,
</span><ins>+                                2DEB34711A3987AB0030E2BA /* WKPagePreviewViewController.h in Headers */,
</ins><span class="cx">                                 1A6FB7AF11E64B6800DB1371 /* PluginView.h in Headers */,
</span><span class="cx">                                 1AFE436618B6C081009C7A48 /* UIDelegate.h in Headers */,
</span><span class="cx">                                 E1CC1B9012D7EADF00625838 /* PrintInfo.h in Headers */,
</span><span class="lines">@@ -9480,6 +9487,7 @@
</span><span class="cx">                                 1AC1338518590C4600F3EC05 /* RemoteObjectRegistryMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 BC40760B124FF0270068F20A /* WKURLRequest.cpp in Sources */,
</span><span class="cx">                                 BC40762A124FF0400068F20A /* WKURLRequestNS.mm in Sources */,
</span><ins>+                                2DEB34721A3987AB0030E2BA /* WKPagePreviewViewController.mm in Sources */,
</ins><span class="cx">                                 512A9760180E031D0039A149 /* DatabaseProcessMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 BC40760D124FF0270068F20A /* WKURLResponse.cpp in Sources */,
</span><span class="cx">                                 379A873918BBFE0F00588AF2 /* _WKElementAction.mm in Sources */,
</span></span></pre>
</div>
</div>

</body>
</html>