<!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>[177409] 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/177409">177409</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2014-12-16 16:33:49 -0800 (Tue, 16 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION: Preview popovers obscure the link, look wrong
https://bugs.webkit.org/show_bug.cgi?id=139711
-and corresponding-
rdar://problem/19271854

Reviewed by Tim Horton.

Source/WebCore:

New SPI.
* WebCore.xcodeproj/project.pbxproj:
* platform/spi/mac/NSPopoverSPI.h: Added.

Source/WebKit2:

Switch to using NSPopoverAnimationController.
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _defaultAnimationController]):
(-[WKImmediateActionController _animationControllerForCustomPreview]):</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="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm">trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformspimacNSPopoverSPIh">trunk/Source/WebCore/platform/spi/mac/NSPopoverSPI.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177408 => 177409)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-17 00:02:37 UTC (rev 177408)
+++ trunk/Source/WebCore/ChangeLog        2014-12-17 00:33:49 UTC (rev 177409)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-12-16  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        REGRESSION: Preview popovers obscure the link, look wrong
+        https://bugs.webkit.org/show_bug.cgi?id=139711
+        -and corresponding-
+        rdar://problem/19271854
+
+        Reviewed by Tim Horton.
+
+        New SPI.
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/spi/mac/NSPopoverSPI.h: Added.
+
</ins><span class="cx"> 2014-12-16  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Cherokee language is drawn as boxes
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (177408 => 177409)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-12-17 00:02:37 UTC (rev 177408)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-12-17 00:33:49 UTC (rev 177409)
</span><span class="lines">@@ -3388,6 +3388,7 @@
</span><span class="cx">                 93F1D5BB12D532C400832BEC /* WebGLLoseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F1D5B812D532C400832BEC /* WebGLLoseContext.h */; };
</span><span class="cx">                 93F1D5C012D5335600832BEC /* JSWebGLLoseContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1D5BE12D5335600832BEC /* JSWebGLLoseContext.cpp */; };
</span><span class="cx">                 93F1D5C112D5335600832BEC /* JSWebGLLoseContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F1D5BF12D5335600832BEC /* JSWebGLLoseContext.h */; };
</span><ins>+                93F1E1EC1A40FDDC00348D13 /* NSPopoverSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */; };
</span><span class="cx">                 93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */; };
</span><span class="cx">                 93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F925410F7EF5B8007E37C9 /* CheckedRadioButtons.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -10561,6 +10562,7 @@
</span><span class="cx">                 93F1D5B912D532C400832BEC /* WebGLLoseContext.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLLoseContext.idl; path = canvas/WebGLLoseContext.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93F1D5BE12D5335600832BEC /* JSWebGLLoseContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLLoseContext.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93F1D5BF12D5335600832BEC /* JSWebGLLoseContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLLoseContext.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSPopoverSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLContextEvent.cpp; path = canvas/WebGLContextEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLContextEvent.h; path = canvas/WebGLContextEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 93F6F1EC127F70B10055CB06 /* WebGLContextEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLContextEvent.idl; path = canvas/WebGLContextEvent.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17636,6 +17638,7 @@
</span><span class="cx">                                 1C6466271A12C3F90094603C /* NSFontSPI.h */,
</span><span class="cx">                                 9321D58F1A3906FA008052BE /* NSImmediateActionGestureRecognizerSPI.h */,
</span><span class="cx">                                 937F4CCD1A2D4B0100BB39F5 /* NSMenuSPI.h */,
</span><ins>+                                93F1E1EB1A40FDDC00348D13 /* NSPopoverSPI.h */,
</ins><span class="cx">                                 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
</span><span class="cx">                                 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */,
</span><span class="cx">                                 9348428119F1A9190009D5AE /* NSViewSPI.h */,
</span><span class="lines">@@ -26064,6 +26067,7 @@
</span><span class="cx">                                 BC6D6E2609AF943500F59759 /* ScrollView.h in Headers */,
</span><span class="cx">                                 F55B3DD21251F12D003EF269 /* SearchInputType.h in Headers */,
</span><span class="cx">                                 AB7170890B3118080017123E /* SearchPopupMenu.h in Headers */,
</span><ins>+                                93F1E1EC1A40FDDC00348D13 /* NSPopoverSPI.h in Headers */,
</ins><span class="cx">                                 976F36EB14686225005E93B4 /* SecurityContext.h in Headers */,
</span><span class="cx">                                 BCD0E0FB0E972C3500265DEA /* SecurityOrigin.h in Headers */,
</span><span class="cx">                                 BCD0E0FC0E972C3500265DEA /* SecurityOriginHash.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacNSPopoverSPIh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/spi/mac/NSPopoverSPI.h (0 => 177409)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/NSPopoverSPI.h                                (rev 0)
+++ trunk/Source/WebCore/platform/spi/mac/NSPopoverSPI.h        2014-12-17 00:33:49 UTC (rev 177409)
</span><span class="lines">@@ -0,0 +1,41 @@
</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. ``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
+ * 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  __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+#import &quot;NSImmediateActionGestureRecognizerSPI.h&quot;
+
+// FIXME: This header should include system headers when possible.
+
+@interface NSPopoverAnimationController : NSObject &lt;NSImmediateActionAnimationController&gt;
++ (instancetype)popoverAnimationControllerWithPopover:(NSPopover *)popover;
+
+@property (readonly) NSPopover *popover;
+@property NSRectEdge preferredEdge;
+@property (weak) NSView *anchorView;
+@property NSRect positioningRect;
+@end
+
+#endif // __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</ins></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177408 => 177409)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-17 00:02:37 UTC (rev 177408)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-17 00:33:49 UTC (rev 177409)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-12-16  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        REGRESSION: Preview popovers obscure the link, look wrong
+        https://bugs.webkit.org/show_bug.cgi?id=139711
+        -and corresponding-
+        rdar://problem/19271854
+
+        Reviewed by Tim Horton.
+
+        Switch to using NSPopoverAnimationController.
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController _defaultAnimationController]):
+        (-[WKImmediateActionController _animationControllerForCustomPreview]):
+
</ins><span class="cx"> 2014-12-16  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Immediate action popovers can get stuck open
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (177408 => 177409)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-17 00:02:37 UTC (rev 177408)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-17 00:33:49 UTC (rev 177409)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #import &lt;WebCore/GeometryUtilities.h&gt;
</span><span class="cx"> #import &lt;WebCore/LookupSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSMenuSPI.h&gt;
</span><ins>+#import &lt;WebCore/NSPopoverSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/QuickLookMacSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/SoftLinking.h&gt;
</span><span class="cx"> #import &lt;WebCore/URL.h&gt;
</span><span class="lines">@@ -225,6 +226,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">         [self _createPreviewPopoverIfNeededForURL:absoluteLinkURL];
</span><ins>+        if (id&lt;NSImmediateActionAnimationController&gt; previewController = [self _animationControllerForCustomPreview])
+            return previewController;
</ins><span class="cx">         return (id&lt;NSImmediateActionAnimationController&gt;)_previewPopover.get();
</span><span class="cx"> #else
</span><span class="cx">         return nil;
</span><span class="lines">@@ -416,6 +419,18 @@
</span><span class="cx">     return computedTargetSize;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (id&lt;NSImmediateActionAnimationController&gt;)_animationControllerForCustomPreview
+{
+    Class nsPopoverAnimationControllerClass = NSClassFromString(@&quot;NSPopoverAnimationController&quot;);
+    if (!nsPopoverAnimationControllerClass)
+        return nil;
+    NSPopoverAnimationController *popoverController = [NSPopoverAnimationController popoverAnimationControllerWithPopover:_previewPopover.get()];
+    popoverController.preferredEdge = NSMaxYEdge;
+    popoverController.anchorView = _wkView;
+    popoverController.positioningRect = _popoverOriginRect;
+    return popoverController;
+}
+
</ins><span class="cx"> #pragma mark WKPagePreviewViewControllerDelegate
</span><span class="cx"> 
</span><span class="cx"> - (NSView *)pagePreviewViewController:(WKPagePreviewViewController *)pagePreviewViewController viewForPreviewingURL:(NSURL *)url initialFrameSize:(NSSize)initialFrameSize
</span></span></pre>
</div>
</div>

</body>
</html>