<!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>[176661] 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/176661">176661</a></dd>
<dt>Author</dt> <dd>dburkart@apple.com</dd>
<dt>Date</dt> <dd>2014-12-02 08:57:18 -0800 (Tue, 02 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/176599">r176599</a>. rdar://problem/18992185</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebCoreChangeLog">branches/safari-600.3-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebCorepageTextIndicatorcpp">branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebCorepageTextIndicatorh">branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.h</a></li>
<li><a href="#branchessafari6003branchSourceWebCorepagemacTextIndicatorWindowmm">branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacChangeLog">branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllerh">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebHTMLViewmm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebViewmm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebViewDatah">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebViewDatamm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebViewInternalh">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2ChangeLog">branches/safari-600.3-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedWebCoreArgumentCoderscpp">branches/safari-600.3-branch/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessWebPageFindControllercpp">branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp</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 (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2014-12-01 Tim Horton <timothy_horton@apple.com>
+
+ Implement yellow highlight for WebKit1 data detectors
+ https://bugs.webkit.org/show_bug.cgi?id=138956
+ <rdar://problem/18992185>
+
+ Reviewed by Beth Dakin.
+
+ * page/TextIndicator.cpp:
+ (WebCore::TextIndicator::createWithSelectionInFrame):
+ (WebCore::TextIndicator::TextIndicator):
+ * page/TextIndicator.h:
+ (WebCore::TextIndicator::selectionRectInScreenCoordinates):
+ (WebCore::TextIndicator::textBoundingRectInScreenCoordinates):
+ (WebCore::TextIndicator::selectionRectInWindowCoordinates): Deleted.
+ (WebCore::TextIndicator::textBoundingRectInWindowCoordinates): Deleted.
+ Store TextIndicator rects in screen coordinates, since that's what we
+ want anyway, and this makes it easier to share this code between the WebKits.
+
+ * page/mac/TextIndicatorWindow.mm:
+ (-[WebTextIndicatorView initWithFrame:textIndicator:margin:]):
+ (WebCore::TextIndicatorWindow::setTextIndicator):
+ Avoid some rect conversion because the TextIndicator rects are already in screen coordinates.
+
</ins><span class="cx"> 2014-11-21 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Move TextIndicator{Window} to WebCore
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.cpp (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.cpp        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.cpp        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -143,7 +143,7 @@
</span><span class="cx">
</span><span class="cx"> // Store the selection rect in window coordinates, to be used subsequently
</span><span class="cx"> // to determine if the indicator and selection still precisely overlap.
</span><del>- IntRect selectionRectInWindowCoordinates = frame.view()->contentsToWindow(selectionRect);
</del><ins>+ IntRect selectionRectInScreenCoordinates = frame.view()->contentsToScreen(selectionRect);
</ins><span class="cx">
</span><span class="cx"> Vector<FloatRect> textRects;
</span><span class="cx"> frame.selection().getClippedVisibleTextRectangles(textRects);
</span><span class="lines">@@ -151,23 +151,23 @@
</span><span class="cx"> // The bounding rect of all the text rects can be different than the selection
</span><span class="cx"> // rect when the selection spans multiple lines; the indicator doesn't actually
</span><span class="cx"> // care where the selection highlight goes, just where the text actually is.
</span><del>- FloatRect textBoundingRectInWindowCoordinates;
- Vector<FloatRect> textRectsInWindowCoordinates;
</del><ins>+ FloatRect textBoundingRectInScreenCoordinates;
+ Vector<FloatRect> textRectsInScreenCoordinates;
</ins><span class="cx"> for (const FloatRect& textRect : textRects) {
</span><del>- FloatRect textRectInWindowCoordinates = frame.view()->contentsToWindow(enclosingIntRect(textRect));
- textRectsInWindowCoordinates.append(textRectInWindowCoordinates);
- textBoundingRectInWindowCoordinates.unite(textRectInWindowCoordinates);
</del><ins>+ FloatRect textRectInScreenCoordinates = frame.view()->contentsToScreen(enclosingIntRect(textRect));
+ textRectsInScreenCoordinates.append(textRectInScreenCoordinates);
+ textBoundingRectInScreenCoordinates.unite(textRectInScreenCoordinates);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Vector<FloatRect> textRectsInBoundingRectCoordinates;
</span><del>- for (auto rect : textRectsInWindowCoordinates) {
- rect.moveBy(-textBoundingRectInWindowCoordinates.location());
</del><ins>+ for (auto rect : textRectsInScreenCoordinates) {
+ rect.moveBy(-textBoundingRectInScreenCoordinates.location());
</ins><span class="cx"> textRectsInBoundingRectCoordinates.append(rect);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> TextIndicatorData data;
</span><del>- data.selectionRectInWindowCoordinates = selectionRectInWindowCoordinates;
- data.textBoundingRectInWindowCoordinates = textBoundingRectInWindowCoordinates;
</del><ins>+ data.selectionRectInScreenCoordinates = selectionRectInScreenCoordinates;
+ data.textBoundingRectInScreenCoordinates = textBoundingRectInScreenCoordinates;
</ins><span class="cx"> data.textRectsInBoundingRectCoordinates = textRectsInBoundingRectCoordinates;
</span><span class="cx"> data.contentImageScaleFactor = frame.page()->deviceScaleFactor();
</span><span class="cx"> data.contentImage = indicatorBitmap;
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx"> TextIndicator::TextIndicator(const TextIndicatorData& data)
</span><span class="cx"> : m_data(data)
</span><span class="cx"> {
</span><del>- ASSERT(m_data.contentImageScaleFactor != 1 || m_data.contentImage->size() == enclosingIntRect(m_data.selectionRectInWindowCoordinates).size());
</del><ins>+ ASSERT(m_data.contentImageScaleFactor != 1 || m_data.contentImage->size() == enclosingIntRect(m_data.selectionRectInScreenCoordinates).size());
</ins><span class="cx">
</span><span class="cx"> if (textIndicatorsForTextRectsOverlap(m_data.textRectsInBoundingRectCoordinates)) {
</span><span class="cx"> m_data.textRectsInBoundingRectCoordinates[0] = unionRect(m_data.textRectsInBoundingRectCoordinates);
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorepageTextIndicatorh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.h (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.h        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebCore/page/TextIndicator.h        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -51,8 +51,8 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> struct TextIndicatorData {
</span><del>- FloatRect selectionRectInWindowCoordinates;
- FloatRect textBoundingRectInWindowCoordinates;
</del><ins>+ FloatRect selectionRectInScreenCoordinates;
+ FloatRect textBoundingRectInScreenCoordinates;
</ins><span class="cx"> Vector<FloatRect> textRectsInBoundingRectCoordinates;
</span><span class="cx"> float contentImageScaleFactor;
</span><span class="cx"> RefPtr<Image> contentImageWithHighlight;
</span><span class="lines">@@ -68,8 +68,8 @@
</span><span class="cx">
</span><span class="cx"> ~TextIndicator();
</span><span class="cx">
</span><del>- FloatRect selectionRectInWindowCoordinates() const { return m_data.selectionRectInWindowCoordinates; }
- FloatRect textBoundingRectInWindowCoordinates() const { return m_data.textBoundingRectInWindowCoordinates; }
</del><ins>+ FloatRect selectionRectInScreenCoordinates() const { return m_data.selectionRectInScreenCoordinates; }
+ FloatRect textBoundingRectInScreenCoordinates() const { return m_data.textBoundingRectInScreenCoordinates; }
</ins><span class="cx"> const Vector<FloatRect>& textRectsInBoundingRectCoordinates() const { return m_data.textRectsInBoundingRectCoordinates; }
</span><span class="cx"> float contentImageScaleFactor() const { return m_data.contentImageScaleFactor; }
</span><span class="cx"> Image *contentImageWithHighlight() const { return m_data.contentImageWithHighlight.get(); }
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorepagemacTextIndicatorWindowmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.mm (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.mm        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebCore/page/mac/TextIndicatorWindow.mm        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -171,7 +171,7 @@
</span><span class="cx"> [textLayer setContents:(id)contentsImage.get()];
</span><span class="cx">
</span><span class="cx"> FloatRect imageRect = textRect;
</span><del>- imageRect.move(_textIndicator->textBoundingRectInWindowCoordinates().location() - _textIndicator->selectionRectInWindowCoordinates().location());
</del><ins>+ imageRect.move(_textIndicator->textBoundingRectInScreenCoordinates().location() - _textIndicator->selectionRectInScreenCoordinates().location());
</ins><span class="cx"> [textLayer setContentsRect:CGRectMake(imageRect.x() / contentsImageLogicalSize.width(), imageRect.y() / contentsImageLogicalSize.height(), imageRect.width() / contentsImageLogicalSize.width(), imageRect.height() / contentsImageLogicalSize.height())];
</span><span class="cx"> [textLayer setContentsGravity:kCAGravityCenter];
</span><span class="cx"> [textLayer setContentsScale:_textIndicator->contentImageScaleFactor()];
</span><span class="lines">@@ -279,16 +279,12 @@
</span><span class="cx"> if (!m_textIndicator)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- NSRect contentRect = m_textIndicator->textBoundingRectInWindowCoordinates();
-
</del><ins>+ NSRect contentRect = m_textIndicator->textBoundingRectInScreenCoordinates();
</ins><span class="cx"> CGFloat horizontalMargin = std::max(dropShadowBlurRadius * 2 + horizontalBorder, contentRect.size.width * 2);
</span><span class="cx"> CGFloat verticalMargin = std::max(dropShadowBlurRadius * 2 + verticalBorder, contentRect.size.height * 2);
</span><span class="cx">
</span><span class="cx"> contentRect = NSInsetRect(contentRect, -horizontalMargin, -verticalMargin);
</span><del>- NSRect windowFrameRect = NSIntegralRect([m_targetView convertRect:contentRect toView:nil]);
- windowFrameRect = [[m_targetView window] convertRectToScreen:windowFrameRect];
- NSRect windowContentRect = [NSWindow contentRectForFrameRect:windowFrameRect styleMask:NSBorderlessWindowMask];
-
</del><ins>+ NSRect windowContentRect = [NSWindow contentRectForFrameRect:NSIntegralRect(contentRect) styleMask:NSBorderlessWindowMask];
</ins><span class="cx"> m_textIndicatorWindow = adoptNS([[NSWindow alloc] initWithContentRect:windowContentRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
</span><span class="cx">
</span><span class="cx"> [m_textIndicatorWindow setBackgroundColor:[NSColor clearColor]];
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-12-01 Tim Horton <timothy_horton@apple.com>
+
+ Implement yellow highlight for WebKit1 data detectors
+ https://bugs.webkit.org/show_bug.cgi?id=138956
+ <rdar://problem/18992185>
+
+ Reviewed by Beth Dakin.
+
+ * WebView/WebActionMenuController.h:
+ * WebView/WebActionMenuController.mm:
+ (-[WebActionMenuController webView:willHandleMouseDown:]):
+ (-[WebActionMenuController webView:didHandleScrollWheel:]):
+ (-[WebActionMenuController prepareForMenu:withEvent:]):
+ (-[WebActionMenuController didCloseMenu:withEvent:]):
+ (-[WebActionMenuController _defaultMenuItemsForDataDetectedText]):
+ (-[WebActionMenuController _showTextIndicator]):
+ (-[WebActionMenuController _hideTextIndicator]):
+ (-[WebActionMenuController _dismissActionMenuPopovers]):
+ Copy the WebKit2 WKActionMenuController TextIndicator implementation
+ into WebActionMenuController. The only significant difference is
+ that we build the TextIndicator right at menu construction time
+ instead of in the Web process.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView scrollWheel:]):
+ Let the WebActionMenuController know that we're handling a scroll.
+
+ (-[WebHTMLView mouseDown:]):
+ Let the WebActionMenuController know that we're handling a mouseDown.
+
+ * WebView/WebView.mm:
+ (-[WebView _setTextIndicator:fadeOut:animationCompletionHandler:]):
+ (-[WebView _clearTextIndicator]):
+ (-[WebView _actionMenuController]):
+ (-[WebView _convertRectFromRootView:]): Deleted.
+ * WebView/WebViewData.h:
+ * WebView/WebViewData.mm:
+ * WebView/WebViewInternal.h:
+ Keep a TextIndicatorWindow on WebView, just like WKView does.
+ Expose the WebActionMenuController on WebView (internally).
+
</ins><span class="cx"> 2014-11-21 Jer Noble <jer.noble@apple.com>
</span><span class="cx">
</span><span class="cx"> Support multiple signatures of diagnostic logging.
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> class Range;
</span><ins>+class TextIndicator;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @interface WebActionMenuController : NSObject <NSSharingServiceDelegate, NSSharingServicePickerDelegate> {
</span><span class="lines">@@ -44,6 +45,9 @@
</span><span class="cx"> RetainPtr<NSSharingServicePicker> _sharingServicePicker;
</span><span class="cx"> RetainPtr<DDActionContext> _currentActionContext;
</span><span class="cx"> RefPtr<WebCore::Range> _currentDetectedDataRange;
</span><ins>+ BOOL _isShowingTextIndicator;
+ RefPtr<WebCore::TextIndicator> _currentDetectedDataTextIndicator;
+ BOOL _hasActivatedActionContext;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (id)initWithWebView:(WebView *)webView;
</span><span class="lines">@@ -52,4 +56,7 @@
</span><span class="cx"> - (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
</span><span class="cx"> - (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
</span><span class="cx">
</span><ins>+- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event;
+- (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event;
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -62,6 +62,7 @@
</span><span class="cx"> #import <WebCore/SharedBuffer.h>
</span><span class="cx"> #import <WebCore/SoftLinking.h>
</span><span class="cx"> #import <WebCore/TextCheckerClient.h>
</span><ins>+#import <WebCore/TextIndicator.h>
</ins><span class="cx"> #import <WebKitSystemInterface.h>
</span><span class="cx"> #import <objc/objc-class.h>
</span><span class="cx"> #import <objc/objc.h>
</span><span class="lines">@@ -131,6 +132,19 @@
</span><span class="cx"> return [[[WebElementDictionary alloc] initWithHitTestResult:_hitTestResult] autorelease];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)webView:(WebView *)webView willHandleMouseDown:(NSEvent *)event
+{
+ if (_type == WebActionMenuDataDetectedItem && _currentActionContext && _hasActivatedActionContext) {
+ [getDDActionsManagerClass() didUseActions];
+ _hasActivatedActionContext = NO;
+ }
+}
+
+- (void)webView:(WebView *)webView didHandleScrollWheel:(NSEvent *)event
+{
+ [self _dismissActionMenuPopovers];
+}
+
</ins><span class="cx"> - (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx"> if (!_webView)
</span><span class="lines">@@ -140,6 +154,7 @@
</span><span class="cx"> if (menu != actionMenu)
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ [self _dismissActionMenuPopovers];
</ins><span class="cx"> [actionMenu removeAllItems];
</span><span class="cx">
</span><span class="cx"> WebElementDictionary *hitTestResult = [self performHitTestAtPoint:event.locationInWindow];
</span><span class="lines">@@ -152,9 +167,12 @@
</span><span class="cx"> for (NSMenuItem *item in menuItems)
</span><span class="cx"> [actionMenu addItem:item];
</span><span class="cx">
</span><del>- if (_type == WebActionMenuDataDetectedItem && _currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
- [menu cancelTracking];
- [menu removeAllItems];
</del><ins>+ if (_type == WebActionMenuDataDetectedItem && _currentActionContext) {
+ _hasActivatedActionContext = YES;
+ if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
+ [menu cancelTracking];
+ [menu removeAllItems];
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -220,11 +238,16 @@
</span><span class="cx"> if (menu != _webView.actionMenu)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- if (_type == WebActionMenuDataDetectedItem && _currentActionContext)
</del><ins>+ if (_type == WebActionMenuDataDetectedItem && _currentActionContext && _hasActivatedActionContext) {
</ins><span class="cx"> [getDDActionsManagerClass() didUseActions];
</span><ins>+ _hasActivatedActionContext = NO;
+ }
</ins><span class="cx">
</span><span class="cx"> _type = WebActionMenuNone;
</span><span class="cx"> _sharingServicePicker = nil;
</span><ins>+ _currentDetectedDataTextIndicator = nil;
+ _currentDetectedDataRange = nil;
+ _currentActionContext = nil;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #pragma mark Link actions
</span><span class="lines">@@ -579,16 +602,22 @@
</span><span class="cx"> return @[ ];
</span><span class="cx"> }
</span><span class="cx">
</span><del>- // FIXME: We should hide/show the yellow highlight here.
</del><ins>+ _currentDetectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::BounceAndCrossfade);
+
</ins><span class="cx"> _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
</span><span class="cx"> } interactionChangedHandler:^() {
</span><ins>+ [self _showTextIndicator];
</ins><span class="cx"> } interactionStoppedHandler:^() {
</span><ins>+ [self _hideTextIndicator];
</ins><span class="cx"> }];
</span><span class="cx"> _currentDetectedDataRange = detectedDataRange;
</span><span class="cx">
</span><del>- [_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:[_webView convertRect:detectedDataBoundingBox toView:nil]]];
</del><ins>+ [_currentActionContext setHighlightFrame:[_webView.window convertRectToScreen:detectedDataBoundingBox]];
</ins><span class="cx">
</span><del>- return [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
</del><ins>+ NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
+ if (menuItems.count == 1 && _currentDetectedDataTextIndicator)
+ _currentDetectedDataTextIndicator->setPresentationTransition(TextIndicatorPresentationTransition::Bounce);
+ return menuItems;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> - (void)_copySelection:(id)sender
</span><span class="lines">@@ -898,4 +927,35 @@
</span><span class="cx"> return @[ ];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#pragma mark Text Indicator
+
+- (void)_showTextIndicator
+{
+ if (_isShowingTextIndicator)
+ return;
+
+ if (_type == WebActionMenuDataDetectedItem && _currentDetectedDataTextIndicator) {
+ [_webView _setTextIndicator:_currentDetectedDataTextIndicator.get() fadeOut:NO animationCompletionHandler:^ { }];
+ _isShowingTextIndicator = YES;
+ }
+}
+
+- (void)_hideTextIndicator
+{
+ if (!_isShowingTextIndicator)
+ return;
+
+ [_webView _clearTextIndicator];
+ _isShowingTextIndicator = NO;
+}
+
+- (void)_dismissActionMenuPopovers
+{
+ DDActionsManager *actionsManager = [getDDActionsManagerClass() sharedManager];
+ if ([actionsManager respondsToSelector:@selector(requestBubbleClosureUnanchorOnFailure:)])
+ [actionsManager requestBubbleClosureUnanchorOnFailure:YES];
+
+ [self _hideTextIndicator];
+}
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebHTMLView.mm (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #import "DOMDocumentInternal.h"
</span><span class="cx"> #import "DOMNodeInternal.h"
</span><span class="cx"> #import "DOMRangeInternal.h"
</span><ins>+#import "WebActionMenuController.h"
</ins><span class="cx"> #import "WebArchive.h"
</span><span class="cx"> #import "WebClipView.h"
</span><span class="cx"> #import "WebDOMOperationsInternal.h"
</span><span class="lines">@@ -3767,6 +3768,8 @@
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> if (!frame || !frame->eventHandler().wheelEvent(event))
</span><span class="cx"> [super scrollWheel:event];
</span><ins>+
+ [[[self _webView] _actionMenuController] webView:[self _webView] didHandleScrollWheel:event];
</ins><span class="cx"> #else
</span><span class="cx"> if (frame)
</span><span class="cx"> frame->eventHandler().wheelEvent(event);
</span><span class="lines">@@ -3879,6 +3882,10 @@
</span><span class="cx"> // Record the mouse down position so we can determine drag hysteresis.
</span><span class="cx"> [self _setMouseDownEvent:event];
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC)
+ [[[self _webView] _actionMenuController] webView:[self _webView] willHandleMouseDown:event];
+#endif
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> // TEXTINPUT: if there is marked text and the current input
</span><span class="cx"> // manager wants to handle mouse events, we need to make sure to
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -209,6 +209,8 @@
</span><span class="cx"> #import "WebNSPrintOperationExtras.h"
</span><span class="cx"> #import "WebPDFView.h"
</span><span class="cx"> #import <WebCore/NSViewSPI.h>
</span><ins>+#import <WebCore/TextIndicator.h>
+#import <WebCore/TextIndicatorWindow.h>
</ins><span class="cx"> #import <WebCore/WebVideoFullscreenController.h>
</span><span class="cx"> #else
</span><span class="cx"> #import "MemoryMeasure.h"
</span><span class="lines">@@ -8572,6 +8574,29 @@
</span><span class="cx"> [_private->actionMenuController didCloseMenu:menu withEvent:event];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (void)_setTextIndicator:(TextIndicator *)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function<void ()>)completionHandler
+{
+ if (!textIndicator) {
+ _private->textIndicatorWindow = nullptr;
+ return;
+ }
+
+ if (!_private->textIndicatorWindow)
+ _private->textIndicatorWindow = std::make_unique<TextIndicatorWindow>(self);
+
+ _private->textIndicatorWindow->setTextIndicator(textIndicator, fadeOut, WTF::move(completionHandler));
+}
+
+- (void)_clearTextIndicator
+{
+ [self _setTextIndicator:nullptr fadeOut:NO animationCompletionHandler:^ { }];
+}
+
+- (WebActionMenuController *)_actionMenuController
+{
+ return _private->actionMenuController;
+}
+
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> @implementation WebView (WebViewDeviceOrientation)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebViewDatah"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.h (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.h        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.h        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> class AlternativeTextUIController;
</span><span class="cx"> class HistoryItem;
</span><span class="cx"> class Page;
</span><ins>+class TextIndicatorWindow;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> @class WebActionMenuController;
</span><span class="lines">@@ -147,6 +148,7 @@
</span><span class="cx"> WebNodeHighlight *currentNodeHighlight;
</span><span class="cx">
</span><span class="cx"> WebActionMenuController *actionMenuController;
</span><ins>+ std::unique_ptr<WebCore::TextIndicatorWindow> textIndicatorWindow;
</ins><span class="cx">
</span><span class="cx"> BOOL allowsUndo;
</span><span class="cx">
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebViewDatamm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.mm (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.mm        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewData.mm        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import <WebCore/AlternativeTextUIController.h>
</span><span class="cx"> #import <WebCore/WebCoreObjCExtras.h>
</span><span class="cx"> #import <WebCore/HistoryItem.h>
</span><ins>+#import <WebCore/TextIndicatorWindow.h>
</ins><span class="cx"> #import <objc/objc-auto.h>
</span><span class="cx"> #import <runtime/InitializeThreading.h>
</span><span class="cx"> #import <wtf/MainThread.h>
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -40,26 +40,28 @@
</span><span class="cx"> #import <WebCore/LayoutMilestones.h>
</span><span class="cx"> #import <WebCore/TextAlternativeWithRange.h>
</span><span class="cx"> #import <WebCore/WebCoreKeyboardUIMode.h>
</span><ins>+#import <functional>
+#import <wtf/Forward.h>
+#import <wtf/RetainPtr.h>
</ins><span class="cx">
</span><del>-#include <wtf/Forward.h>
-#include <wtf/RetainPtr.h>
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> class Element;
</span><span class="cx"> class Event;
</span><span class="cx"> class Frame;
</span><ins>+class HTMLVideoElement;
</ins><span class="cx"> class HistoryItem;
</span><del>-class URL;
</del><span class="cx"> class KeyboardEvent;
</span><span class="cx"> class Page;
</span><span class="cx"> class RenderBox;
</span><span class="cx"> class Node;
</span><ins>+class TextIndicator;
</ins><span class="cx"> struct DictationAlternative;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> class WebSelectionServiceController;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+@class WebActionMenuController;
</ins><span class="cx"> @class WebBasePluginPackage;
</span><span class="cx"> @class WebDownload;
</span><span class="cx"> @class WebNodeHighlight;
</span><span class="lines">@@ -253,4 +255,10 @@
</span><span class="cx"> - (NSPoint)_convertPointFromRootView:(NSPoint)point;
</span><span class="cx"> - (NSRect)_convertRectFromRootView:(NSRect)rect;
</span><span class="cx">
</span><ins>+#if PLATFORM(MAC) && defined(__cplusplus)
+- (void)_setTextIndicator:(WebCore::TextIndicator*)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function<void ()>)completionHandler;
+- (void)_clearTextIndicator;
+- (WebActionMenuController *)_actionMenuController;
+#endif
+
</ins><span class="cx"> @end
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-12-01 Tim Horton <timothy_horton@apple.com>
+
+ Implement yellow highlight for WebKit1 data detectors
+ https://bugs.webkit.org/show_bug.cgi?id=138956
+ <rdar://problem/18992185>
+
+ Reviewed by Beth Dakin.
+
+ * Shared/WebCoreArgumentCoders.cpp:
+ (IPC::ArgumentCoder<TextIndicatorData>::encode):
+ (IPC::ArgumentCoder<TextIndicatorData>::decode):
+ * WebProcess/WebPage/FindController.cpp:
+ (WebKit::FindController::updateFindIndicator):
+ (WebKit::FindController::drawRect):
+ Adjust to the fact that TextIndicator keeps screen-relative rects.
+
</ins><span class="cx"> 2014-11-21 Tim Horton <timothy_horton@apple.com>
</span><span class="cx">
</span><span class="cx"> Move TextIndicator{Window} to WebCore
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedWebCoreArgumentCoderscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebCoreArgumentCoders.cpp        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -2172,8 +2172,8 @@
</span><span class="cx">
</span><span class="cx"> void ArgumentCoder<TextIndicatorData>::encode(ArgumentEncoder& encoder, const TextIndicatorData& textIndicatorData)
</span><span class="cx"> {
</span><del>- encoder << textIndicatorData.selectionRectInWindowCoordinates;
- encoder << textIndicatorData.textBoundingRectInWindowCoordinates;
</del><ins>+ encoder << textIndicatorData.selectionRectInScreenCoordinates;
+ encoder << textIndicatorData.textBoundingRectInScreenCoordinates;
</ins><span class="cx"> encoder << textIndicatorData.textRectsInBoundingRectCoordinates;
</span><span class="cx"> encoder << textIndicatorData.contentImageScaleFactor;
</span><span class="cx"> encoder.encodeEnum(textIndicatorData.presentationTransition);
</span><span class="lines">@@ -2183,10 +2183,10 @@
</span><span class="cx">
</span><span class="cx"> bool ArgumentCoder<TextIndicatorData>::decode(ArgumentDecoder& decoder, TextIndicatorData& textIndicatorData)
</span><span class="cx"> {
</span><del>- if (!decoder.decode(textIndicatorData.selectionRectInWindowCoordinates))
</del><ins>+ if (!decoder.decode(textIndicatorData.selectionRectInScreenCoordinates))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- if (!decoder.decode(textIndicatorData.textBoundingRectInWindowCoordinates))
</del><ins>+ if (!decoder.decode(textIndicatorData.textBoundingRectInScreenCoordinates))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (!decoder.decode(textIndicatorData.textRectsInBoundingRectCoordinates))
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebProcessWebPageFindControllercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp (176660 => 176661)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp        2014-12-02 16:56:58 UTC (rev 176660)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/FindController.cpp        2014-12-02 16:57:18 UTC (rev 176661)
</span><span class="lines">@@ -318,7 +318,7 @@
</span><span class="cx"> if (!indicator)
</span><span class="cx"> return false;
</span><span class="cx">
</span><del>- m_findIndicatorRect = enclosingIntRect(indicator->selectionRectInWindowCoordinates());
</del><ins>+ m_findIndicatorRect = enclosingIntRect(indicator->selectionRectInScreenCoordinates());
</ins><span class="cx"> m_webPage->send(Messages::WebPageProxy::SetTextIndicator(indicator->data(), !isShowingOverlay));
</span><span class="cx"> m_isShowingFindIndicator = true;
</span><span class="cx">
</span><span class="lines">@@ -450,7 +450,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> if (Frame* selectedFrame = frameWithSelection(m_webPage->corePage())) {
</span><del>- IntRect findIndicatorRect = selectedFrame->view()->contentsToWindow(enclosingIntRect(selectedFrame->selection().selectionBounds()));
</del><ins>+ IntRect findIndicatorRect = selectedFrame->view()->contentsToScreen(enclosingIntRect(selectedFrame->selection().selectionBounds()));
</ins><span class="cx">
</span><span class="cx"> if (findIndicatorRect != m_findIndicatorRect)
</span><span class="cx"> hideFindIndicator();
</span></span></pre>
</div>
</div>
</body>
</html>