<!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>[170640] 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/170640">170640</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2014-07-01 09:22:01 -0700 (Tue, 01 Jul 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Combine the Telephone and Selection overlay controllers, updating UI behavior.
https://bugs.webkit.org/show_bug.cgi?id=134461

Reviewed by Tim Horton.

Source/WebCore:
* WebCore.exp.in:

* dom/Range.cpp:
(WebCore::Range::contains): Returns true if the Range completely contains the passed-in Range.
* dom/Range.h:

Source/WebKit2:
* WebKit2.xcodeproj/project.pbxproj:

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::selectedTelephoneNumberRangesChanged):
(WebKit::WebEditorClient::selectionRectsDidChange):

Remove the separate Selection overlay controller:
* WebProcess/WebPage/SelectionOverlayController.cpp: Removed.
* WebProcess/WebPage/ServicesOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h.
(WebKit::ServicesOverlayController::create):
* WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm: Removed.

Remove the separate TelephoneNumber overlay controller:
* WebProcess/WebPage/TelephoneNumberOverlayController.cpp: Removed.
* WebProcess/WebPage/TelephoneNumberOverlayController.h: Removed.
* WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm: Removed.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::servicesOverlayController):
(WebKit::WebPage::telephoneNumberOverlayController): Deleted.
(WebKit::WebPage::selectionOverlayController): Deleted.
(WebKit::WebPage::didChangeScrollOffsetForFrame): Deleted.
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::serviceControlsEnabled): Deleted.

ServicesOverlayController is a combination of the old TelephoneNumber and Selection overlay controllers.
A lot of code duplication is resolved, and things are generally easier to follow.
It enforces displaying a telephone number highlight if precisely one telephone number is selected, or
the selection highlight if the selection contains more than a single phone number
* WebProcess/WebPage/mac/ServicesOverlayController.mm: Added.
(WebKit::textQuadsToBoundingRectForRange):
(WebKit::ServicesOverlayController::ServicesOverlayController):
(WebKit::ServicesOverlayController::destroyOverlay):
(WebKit::ServicesOverlayController::pageOverlayDestroyed):
(WebKit::ServicesOverlayController::willMoveToWebPage):
(WebKit::ServicesOverlayController::didMoveToWebPage):
(WebKit::ServicesOverlayController::createOverlayIfNeeded):
(WebKit::ServicesOverlayController::selectionRectsDidChange):
(WebKit::ServicesOverlayController::selectedTelephoneNumberRangesChanged):
(WebKit::ServicesOverlayController::clearHighlightState):
(WebKit::ServicesOverlayController::drawRect):
(WebKit::ServicesOverlayController::drawSelectionHighlight):
(WebKit::ServicesOverlayController::drawTelephoneNumberHighlight):
(WebKit::ServicesOverlayController::drawCurrentHighlight):
(WebKit::ServicesOverlayController::mouseEvent):
(WebKit::ServicesOverlayController::handleClick):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCoredomRangecpp">trunk/Source/WebCore/dom/Range.cpp</a></li>
<li><a href="#trunkSourceWebCoredomRangeh">trunk/Source/WebCore/dom/Range.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessWebPageServicesOverlayControllerh">trunk/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacServicesOverlayControllermm">trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessWebPageSelectionOverlayControllercpp">trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageSelectionOverlayControllerh">trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageTelephoneNumberOverlayControllercpp">trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageTelephoneNumberOverlayControllerh">trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacSelectionOverlayControllerMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacTelephoneNumberOverlayControllerMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebCore/ChangeLog        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-07-01  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Combine the Telephone and Selection overlay controllers, updating UI behavior.
+        https://bugs.webkit.org/show_bug.cgi?id=134461
+
+        Reviewed by Tim Horton.
+
+        * WebCore.exp.in:
+
+        * dom/Range.cpp:
+        (WebCore::Range::contains): Returns true if the Range completely contains the passed-in Range.
+        * dom/Range.h:
+
</ins><span class="cx"> 2014-07-01  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(160908): vube.com video won't play after going into and out of fullscreen
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1907,6 +1907,7 @@
</span><span class="cx"> __ZNK7WebCore5Range21compareBoundaryPointsENS0_10CompareHowEPKS0_Ri
</span><span class="cx"> __ZNK7WebCore5Range23commonAncestorContainerERi
</span><span class="cx"> __ZNK7WebCore5Range4textEv
</span><ins>+__ZNK7WebCore5Range8containsERKS0_
</ins><span class="cx"> __ZNK7WebCore5Range9collapsedERi
</span><span class="cx"> __ZNK7WebCore5Range9endOffsetERi
</span><span class="cx"> __ZNK7WebCore5Range9firstNodeEv
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.cpp (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.cpp        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebCore/dom/Range.cpp        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1967,6 +1967,19 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+bool Range::contains(const Range&amp; other) const
+{
+    if (commonAncestorContainer(ASSERT_NO_EXCEPTION)-&gt;ownerDocument() != other.commonAncestorContainer(ASSERT_NO_EXCEPTION)-&gt;ownerDocument())
+        return false;
+
+    short startToStart = compareBoundaryPoints(Range::START_TO_START, &amp;other, ASSERT_NO_EXCEPTION);
+    if (startToStart &gt; 0)
+        return false;
+
+    short endToEnd = compareBoundaryPoints(Range::END_TO_END, &amp;other, ASSERT_NO_EXCEPTION);
+    return endToEnd &gt;= 0;
+}
+
</ins><span class="cx"> bool areRangesEqual(const Range* a, const Range* b)
</span><span class="cx"> {
</span><span class="cx">     if (a == b)
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.h (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.h        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebCore/dom/Range.h        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -161,6 +161,8 @@
</span><span class="cx">     void formatForDebugger(char* buffer, unsigned length) const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    bool contains(const Range&amp;) const;
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit Range(Document&amp;);
</span><span class="cx">     Range(Document&amp;, PassRefPtr&lt;Node&gt; startContainer, int startOffset, PassRefPtr&lt;Node&gt; endContainer, int endOffset);
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,3 +1,57 @@
</span><ins>+2014-07-01  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Combine the Telephone and Selection overlay controllers, updating UI behavior.
+        https://bugs.webkit.org/show_bug.cgi?id=134461
+
+        Reviewed by Tim Horton.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::selectedTelephoneNumberRangesChanged):
+        (WebKit::WebEditorClient::selectionRectsDidChange):
+
+        Remove the separate Selection overlay controller:
+        * WebProcess/WebPage/SelectionOverlayController.cpp: Removed.
+        * WebProcess/WebPage/ServicesOverlayController.h: Renamed from Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h.
+        (WebKit::ServicesOverlayController::create):
+        * WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm: Removed.
+
+        Remove the separate TelephoneNumber overlay controller:
+        * WebProcess/WebPage/TelephoneNumberOverlayController.cpp: Removed.
+        * WebProcess/WebPage/TelephoneNumberOverlayController.h: Removed.
+        * WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm: Removed.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::servicesOverlayController):
+        (WebKit::WebPage::telephoneNumberOverlayController): Deleted.
+        (WebKit::WebPage::selectionOverlayController): Deleted.
+        (WebKit::WebPage::didChangeScrollOffsetForFrame): Deleted.
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::serviceControlsEnabled): Deleted.
+
+        ServicesOverlayController is a combination of the old TelephoneNumber and Selection overlay controllers.
+        A lot of code duplication is resolved, and things are generally easier to follow.
+        It enforces displaying a telephone number highlight if precisely one telephone number is selected, or
+        the selection highlight if the selection contains more than a single phone number
+        * WebProcess/WebPage/mac/ServicesOverlayController.mm: Added.
+        (WebKit::textQuadsToBoundingRectForRange):
+        (WebKit::ServicesOverlayController::ServicesOverlayController):
+        (WebKit::ServicesOverlayController::destroyOverlay):
+        (WebKit::ServicesOverlayController::pageOverlayDestroyed):
+        (WebKit::ServicesOverlayController::willMoveToWebPage):
+        (WebKit::ServicesOverlayController::didMoveToWebPage):
+        (WebKit::ServicesOverlayController::createOverlayIfNeeded):
+        (WebKit::ServicesOverlayController::selectionRectsDidChange):
+        (WebKit::ServicesOverlayController::selectedTelephoneNumberRangesChanged):
+        (WebKit::ServicesOverlayController::clearHighlightState):
+        (WebKit::ServicesOverlayController::drawRect):
+        (WebKit::ServicesOverlayController::drawSelectionHighlight):
+        (WebKit::ServicesOverlayController::drawTelephoneNumberHighlight):
+        (WebKit::ServicesOverlayController::drawCurrentHighlight):
+        (WebKit::ServicesOverlayController::mouseEvent):
+        (WebKit::ServicesOverlayController::handleClick):
+
</ins><span class="cx"> 2014-07-01  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2] IPC messages' arguments() method returns const std::tuple&lt;&gt; copies
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -915,8 +915,7 @@
</span><span class="cx">                 518E8F0B16B2093700E91429 /* DownloadManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 518E8F0216B2093700E91429 /* DownloadManager.cpp */; };
</span><span class="cx">                 518E8F0C16B2093700E91429 /* DownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 518E8F0316B2093700E91429 /* DownloadManager.h */; };
</span><span class="cx">                 518E8F0D16B2093700E91429 /* DownloadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518E8F0516B2093700E91429 /* DownloadMac.mm */; };
</span><del>-                519EF58E18EF770D0003B7F4 /* TelephoneNumberOverlayControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 519EF58D18EF770D0003B7F4 /* TelephoneNumberOverlayControllerMac.mm */; };
-                519EF59218EF80CE0003B7F4 /* TelephoneNumberOverlayController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 519EF58F18EF77210003B7F4 /* TelephoneNumberOverlayController.cpp */; };
</del><ins>+                5192D5761961FD0300CD19AA /* ServicesOverlayController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5192D5751961FD0300CD19AA /* ServicesOverlayController.mm */; };
</ins><span class="cx">                 51A4D5A916CAC4FF000E615E /* StatisticsRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */; };
</span><span class="cx">                 51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */; };
</span><span class="cx">                 51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -966,9 +965,6 @@
</span><span class="cx">                 51E35205180F5D4F00E53BE9 /* DatabaseProcessMain.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E35203180F5D4B00E53BE9 /* DatabaseProcessMain.mm */; };
</span><span class="cx">                 51E35209180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E35208180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm */; };
</span><span class="cx">                 51E3B67F16F266B3009968DC /* NetworkResourceLoaderMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E3B67E16F266B3009968DC /* NetworkResourceLoaderMac.mm */; };
</span><del>-                51EF124E19098522008A6532 /* SelectionOverlayController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51EF124C19098522008A6532 /* SelectionOverlayController.cpp */; };
-                51EF124F19098523008A6532 /* SelectionOverlayController.h in Headers */ = {isa = PBXBuildFile; fileRef = 51EF124D19098522008A6532 /* SelectionOverlayController.h */; };
-                51EF125119098531008A6532 /* SelectionOverlayControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51EF125019098531008A6532 /* SelectionOverlayControllerMac.mm */; };
</del><span class="cx">                 51EFC1CF1524E62500C9A938 /* WKBundleDOMWindowExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 51FA2D541521118600C1BA0B /* WKBundleDOMWindowExtension.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */; };
</span><span class="cx">                 51F060E11654318500F3281B /* WebResourceLoaderMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */; };
</span><span class="lines">@@ -2928,9 +2924,8 @@
</span><span class="cx">                 518E8F0216B2093700E91429 /* DownloadManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DownloadManager.cpp; path = Downloads/DownloadManager.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 518E8F0316B2093700E91429 /* DownloadManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DownloadManager.h; path = Downloads/DownloadManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 518E8F0516B2093700E91429 /* DownloadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DownloadMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                519EF58D18EF770D0003B7F4 /* TelephoneNumberOverlayControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TelephoneNumberOverlayControllerMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
-                519EF58F18EF77210003B7F4 /* TelephoneNumberOverlayController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TelephoneNumberOverlayController.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                519EF59018EF77210003B7F4 /* TelephoneNumberOverlayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TelephoneNumberOverlayController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                5192D5711961FA2F00CD19AA /* ServicesOverlayController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServicesOverlayController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                5192D5751961FD0300CD19AA /* ServicesOverlayController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServicesOverlayController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StatisticsRequest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextMenuItem.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItem.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -3000,9 +2995,6 @@
</span><span class="cx">                 51E35207180F5D6100E53BE9 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E35208180F5D6B00E53BE9 /* DatabaseServiceEntryPoint.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DatabaseServiceEntryPoint.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E3B67E16F266B3009968DC /* NetworkResourceLoaderMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NetworkResourceLoaderMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                51EF124C19098522008A6532 /* SelectionOverlayController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionOverlayController.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
-                51EF124D19098522008A6532 /* SelectionOverlayController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionOverlayController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                51EF125019098531008A6532 /* SelectionOverlayControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SelectionOverlayControllerMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 51F060DD1654317500F3281B /* WebResourceLoaderMessageReceiver.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoaderMessageReceiver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51F060DE1654317500F3281B /* WebResourceLoaderMessages.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoaderMessages.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51F7DC4A180CC93600212CA3 /* com.apple.WebKit.Databases.xpc */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = com.apple.WebKit.Databases.xpc; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="lines">@@ -5708,10 +5700,7 @@
</span><span class="cx">                                 1A90C23512650717003E44D4 /* PageOverlay.h */,
</span><span class="cx">                                 2D140EAD18F37BE0005E75A0 /* PageOverlayController.cpp */,
</span><span class="cx">                                 2D140EAE18F37BE0005E75A0 /* PageOverlayController.h */,
</span><del>-                                51EF124C19098522008A6532 /* SelectionOverlayController.cpp */,
-                                51EF124D19098522008A6532 /* SelectionOverlayController.h */,
-                                519EF58F18EF77210003B7F4 /* TelephoneNumberOverlayController.cpp */,
-                                519EF59018EF77210003B7F4 /* TelephoneNumberOverlayController.h */,
</del><ins>+                                5192D5711961FA2F00CD19AA /* ServicesOverlayController.h */,
</ins><span class="cx">                                 2D819B99186275B3001F03D1 /* ViewGestureGeometryCollector.cpp */,
</span><span class="cx">                                 2D819B9A186275B3001F03D1 /* ViewGestureGeometryCollector.h */,
</span><span class="cx">                                 2D819B9B186275B3001F03D1 /* ViewGestureGeometryCollector.messages.in */,
</span><span class="lines">@@ -6481,8 +6470,7 @@
</span><span class="cx">                                 1AB16AE7164B3A8800290D62 /* RemoteLayerTreeContext.mm */,
</span><span class="cx">                                 1AB16ADC1648598400290D62 /* RemoteLayerTreeDrawingArea.h */,
</span><span class="cx">                                 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */,
</span><del>-                                51EF125019098531008A6532 /* SelectionOverlayControllerMac.mm */,
-                                519EF58D18EF770D0003B7F4 /* TelephoneNumberOverlayControllerMac.mm */,
</del><ins>+                                5192D5751961FD0300CD19AA /* ServicesOverlayController.mm */,
</ins><span class="cx">                                 1AAF263714687C39004A1E8A /* TiledCoreAnimationDrawingArea.h */,
</span><span class="cx">                                 1AAF263614687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm */,
</span><span class="cx">                                 1C8E2DAD1278C5B200BC7BD0 /* WebInspectorMac.mm */,
</span><span class="lines">@@ -7819,7 +7807,6 @@
</span><span class="cx">                                 29501724162A4504004A9D71 /* WKWebProcessPlugInBrowserContextControllerPrivate.h in Headers */,
</span><span class="cx">                                 1F7506B61859165700EC0FF7 /* WKWebProcessPlugInNodeHandleInternal.h in Headers */,
</span><span class="cx">                                 1F7506B51859165400EC0FF7 /* WKWebProcessPlugInScriptWorldInternal.h in Headers */,
</span><del>-                                51EF124F19098523008A6532 /* SelectionOverlayController.h in Headers */,
</del><span class="cx">                                 373CEAD6185417AE008C363D /* WKNSData.h in Headers */,
</span><span class="cx">                                 1AB8A1F018400B0000E9AE69 /* WKPageFormClient.h in Headers */,
</span><span class="cx">                                 BC989D85161A9890000D46D3 /* WKWebProcessPlugInInternal.h in Headers */,
</span><span class="lines">@@ -8726,6 +8713,7 @@
</span><span class="cx">                                 512F589612A8838800629530 /* AuthenticationChallengeProxy.cpp in Sources */,
</span><span class="cx">                                 1AE00D4C182D6EB000087DD7 /* WKBrowsingContextHandle.mm in Sources */,
</span><span class="cx">                                 512F589812A8838800629530 /* AuthenticationDecisionListener.cpp in Sources */,
</span><ins>+                                5192D5761961FD0300CD19AA /* ServicesOverlayController.mm in Sources */,
</ins><span class="cx">                                 518E8EF816B2091C00E91429 /* AuthenticationManager.cpp in Sources */,
</span><span class="cx">                                 518E8EFB16B2091C00E91429 /* AuthenticationManager.mac.mm in Sources */,
</span><span class="cx">                                 512F58A212A883AD00629530 /* AuthenticationManagerMessageReceiver.cpp in Sources */,
</span><span class="lines">@@ -9104,7 +9092,6 @@
</span><span class="cx">                                 BCAC112012C92C1F00B08EEE /* WebDatabaseManagerProxyClient.cpp in Sources */,
</span><span class="cx">                                 F62A76B812B1B25F0005F1B6 /* WebDatabaseManagerProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 517DD5C5180DC3E10081660B /* DatabaseProcessProxyMac.mm in Sources */,
</span><del>-                                51EF125119098531008A6532 /* SelectionOverlayControllerMac.mm in Sources */,
</del><span class="cx">                                 BC111A5D112F4FBB00337BAB /* WebDragClient.cpp in Sources */,
</span><span class="cx">                                 C574A37712E6099D002DFE98 /* WebDragClientMac.mm in Sources */,
</span><span class="cx">                                 BCA0EFA012332642007D3CFB /* WebEditCommandProxy.cpp in Sources */,
</span><span class="lines">@@ -9178,11 +9165,9 @@
</span><span class="cx">                                 33D3A3CA1339617900709BE4 /* WebMediaCacheManagerProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 E164A2F1191AF14E0010737D /* BlobDataFileReferenceWithSandboxExtension.cpp in Sources */,
</span><span class="cx">                                 0FCB4E4D18BBE044000FCFC9 /* WKContentView.mm in Sources */,
</span><del>-                                519EF59218EF80CE0003B7F4 /* TelephoneNumberOverlayController.cpp in Sources */,
</del><span class="cx">                                 909854EC12BC4E17000AD080 /* WebMemorySampler.cpp in Sources */,
</span><span class="cx">                                 909854EE12BC4E18000AD080 /* WebMemorySampler.mac.mm in Sources */,
</span><span class="cx">                                 C0337DB0127A28D0008FF4F4 /* WebMouseEvent.cpp in Sources */,
</span><del>-                                519EF58E18EF770D0003B7F4 /* TelephoneNumberOverlayControllerMac.mm in Sources */,
</del><span class="cx">                                 BCF69FA31176D01400471A52 /* APINavigationData.cpp in Sources */,
</span><span class="cx">                                 31A2EC48148997C200810D71 /* WebNotification.cpp in Sources */,
</span><span class="cx">                                 A115DC71191D82D700DA8072 /* _WKWebViewPrintFormatter.mm in Sources */,
</span><span class="lines">@@ -9257,7 +9242,6 @@
</span><span class="cx">                                 E115C714190F89E400ECC516 /* DatabaseProcessIOS.mm in Sources */,
</span><span class="cx">                                 33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */,
</span><span class="cx">                                 33367655130C9ECA006C9DE2 /* WebResourceCacheManagerMessageReceiver.cpp in Sources */,
</span><del>-                                51EF124E19098522008A6532 /* SelectionOverlayController.cpp in Sources */,
</del><span class="cx">                                 33367635130C99B2006C9DE2 /* WebResourceCacheManagerProxy.cpp in Sources */,
</span><span class="cx">                                 33367657130C9ECA006C9DE2 /* WebResourceCacheManagerProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A8E7D3C18C15149005A702A /* VisitedLinkTableControllerMessageReceiver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -27,8 +27,7 @@
</span><span class="cx"> #include &quot;WebEditorClient.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;EditorState.h&quot;
</span><del>-#include &quot;SelectionOverlayController.h&quot;
-#include &quot;TelephoneNumberOverlayController.h&quot;
</del><ins>+#include &quot;ServicesOverlayController.h&quot;
</ins><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="cx"> #include &quot;WebFrame.h&quot;
</span><span class="cx"> #include &quot;WebPage.h&quot;
</span><span class="lines">@@ -525,19 +524,16 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
</del><ins>+#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
</ins><span class="cx"> void WebEditorClient::selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;Range&gt;&gt;&amp; ranges)
</span><span class="cx"> {
</span><del>-    m_page-&gt;telephoneNumberOverlayController().selectedTelephoneNumberRangesChanged(ranges);
</del><ins>+    m_page-&gt;servicesOverlayController().selectedTelephoneNumberRangesChanged(ranges);
</ins><span class="cx"> }
</span><del>-#endif
-
-#if ENABLE(SERVICE_CONTROLS)
</del><span class="cx"> void WebEditorClient::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects)
</span><span class="cx"> {
</span><span class="cx">     if (m_page-&gt;serviceControlsEnabled())
</span><del>-        m_page-&gt;selectionOverlayController().selectionRectsDidChange(rects);
</del><ins>+        m_page-&gt;servicesOverlayController().selectionRectsDidChange(rects);
</ins><span class="cx"> }
</span><del>-#endif // ENABLE(SERVICE_CONTROLS)
</del><ins>+#endif // ENABLE(SERVICE_CONTROLS) &amp;&amp; ENABLE(TELEPHONE_NUMBER_DETECTION)
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageSelectionOverlayControllercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,136 +0,0 @@
</span><del>-/*
- * 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.
- */
-
-#include &quot;config.h&quot;
-#include &quot;SelectionOverlayController.h&quot;
-
-#if ENABLE(SERVICE_CONTROLS)
-
-#include &quot;WebPage.h&quot;
-#include &quot;WebProcess.h&quot;
-#include &lt;WebCore/NotImplemented.h&gt;
-
-using namespace WebCore;
-
-namespace WebKit {
-    
-SelectionOverlayController::SelectionOverlayController(WebPage* webPage)
-    : m_webPage(webPage)
-    , m_selectionOverlay(nullptr)
-    , m_mouseIsDownOnButton(false)
-    , m_mouseIsOverHighlight(false)
-    , m_visible(false)
-    , m_hoverTimer(RunLoop::main(), this, &amp;SelectionOverlayController::hoverTimerFired)
-    , m_currentHighlightIsDirty(false)
-{
-}
-
-void SelectionOverlayController::createOverlayIfNeeded()
-{
-    if (m_selectionOverlay) {
-        m_selectionOverlay-&gt;setNeedsDisplay();
-        return;
-    }
-    
-    RefPtr&lt;PageOverlay&gt; overlay = PageOverlay::create(this, PageOverlay::OverlayType::Document);
-    m_selectionOverlay = overlay.get();
-    m_webPage-&gt;installPageOverlay(overlay.release(), PageOverlay::FadeMode::Fade);
-    m_selectionOverlay-&gt;setNeedsDisplay();
-}
-
-void SelectionOverlayController::destroyOverlay()
-{
-    if (!m_selectionOverlay)
-        return;
-
-    m_mouseIsOverHighlight = false;
-    mouseHoverStateChanged();
-
-    m_webPage-&gt;uninstallPageOverlay(m_selectionOverlay, PageOverlay::FadeMode::DoNotFade);
-}
-
-void SelectionOverlayController::pageOverlayDestroyed(PageOverlay*)
-{
-    // Before the overlay is destroyed, it should have moved out of the WebPage,
-    // at which point we already cleared our back pointer.
-    ASSERT(!m_selectionOverlay);
-}
-
-void SelectionOverlayController::willMoveToWebPage(PageOverlay*, WebPage* webPage)
-{
-    if (webPage)
-        return;
-
-    ASSERT(m_selectionOverlay);
-    m_selectionOverlay = nullptr;
-}
-
-void SelectionOverlayController::didMoveToWebPage(PageOverlay*, WebPage*)
-{
-}
-
-void SelectionOverlayController::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects)
-{
-#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 1090
-    m_currentHighlightIsDirty = true;
-    m_currentSelectionRects = rects;
-
-    if (WebProcess::shared().hasSelectionServices() &amp;&amp; !m_currentSelectionRects.isEmpty())
-        createOverlayIfNeeded();
-    else
-        destroyOverlay();
-
-#else
-    UNUSED_PARAM(rects);
-#endif
-}
-
-void SelectionOverlayController::hoverTimerFired()
-{
-    if (!m_mouseIsOverHighlight)
-        return;
-
-    m_visible = true;
-
-    ASSERT(m_selectionOverlay);
-    m_selectionOverlay-&gt;setNeedsDisplay();
-}
-
-#if !PLATFORM(MAC)
-void SelectionOverlayController::drawRect(PageOverlay*, WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp;)
-{
-    notImplemented();
-}
-
-bool SelectionOverlayController::mouseEvent(PageOverlay*, const WebMouseEvent&amp;)
-{
-    notImplemented();
-    return false;
-}
-#endif
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_CONTROLS)
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageSelectionOverlayControllerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,91 +0,0 @@
</span><del>-/*
- * 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 SelectionOverlayController_h
-
-#if ENABLE(SERVICE_CONTROLS)
-
-#include &quot;PageOverlay.h&quot;
-#include &quot;WebPage.h&quot;
-#include &lt;wtf/RefCounted.h&gt;
-#include &lt;wtf/RunLoop.h&gt;
-
-typedef void* DDHighlightRef;
-
-namespace WebCore {
-class LayoutRect;
-}
-
-namespace WebKit {
-    
-class WebPage;
-
-class SelectionOverlayController : public RefCounted&lt;SelectionOverlayController&gt;, private PageOverlay::Client {
-public:
-
-    static PassRefPtr&lt;SelectionOverlayController&gt; create(WebPage* webPage)
-    {
-        return adoptRef(new SelectionOverlayController(webPage));
-    }
-
-    void selectionRectsDidChange(const Vector&lt;WebCore::LayoutRect&gt;&amp;);
-    void handleClick(const WebCore::IntPoint&amp;);
-    
-private:
-    SelectionOverlayController(WebPage*);
-
-    void createOverlayIfNeeded();
-    void destroyOverlay();
-    
-    void handleSelectionOverlayClick(const WebCore::IntPoint&amp;);
-
-    virtual void pageOverlayDestroyed(PageOverlay*) override;
-    virtual void willMoveToWebPage(PageOverlay*, WebPage*) override;
-    virtual void didMoveToWebPage(PageOverlay*, WebPage*) override;
-    virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp; dirtyRect) override;
-    virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&amp;) override;
-
-    void mouseHoverStateChanged();
-    void hoverTimerFired();
-
-    RefPtr&lt;WebPage&gt; m_webPage;
-    PageOverlay* m_selectionOverlay;
-    Vector&lt;WebCore::LayoutRect&gt; m_currentSelectionRects;
-
-    WebCore::IntPoint m_mousePosition;
-    bool m_mouseIsDownOnButton;
-    bool m_mouseIsOverHighlight;
-    bool m_visible;
-
-    RunLoop::Timer&lt;SelectionOverlayController&gt; m_hoverTimer;
-
-    RetainPtr&lt;DDHighlightRef&gt; m_currentHighlight;
-    bool m_currentHighlightIsDirty;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_CONTROLS)
-#endif // SelectionOverlayController_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageServicesOverlayControllerhfromrev170639trunkSourceWebKit2WebProcessWebPageSelectionOverlayControllerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h (from rev 170639, trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h) (0 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -0,0 +1,86 @@
</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 ServicesOverlayController_h
+
+#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
+
+#include &quot;PageOverlay.h&quot;
+
+typedef void* DDHighlightRef;
+
+namespace WebCore {
+class LayoutRect;
+class Range;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+typedef void* DDHighlightRef;
+
+class ServicesOverlayController : private PageOverlay::Client {
+public:
+    ServicesOverlayController(WebPage&amp;);
+    ~ServicesOverlayController();
+
+    void selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;WebCore::Range&gt;&gt;&amp;);
+    void selectionRectsDidChange(const Vector&lt;WebCore::LayoutRect&gt;&amp;);
+
+private:
+    void createOverlayIfNeeded();
+    void handleClick(const WebCore::IntPoint&amp;);
+    void clearHighlightState();
+    
+    virtual void pageOverlayDestroyed(PageOverlay*) override;
+    virtual void willMoveToWebPage(PageOverlay*, WebPage*) override;
+    virtual void didMoveToWebPage(PageOverlay*, WebPage*) override;
+    virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp; dirtyRect) override;
+    virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&amp;) override;
+
+    void drawTelephoneNumberHighlight(WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp; dirtyRect);
+    void drawSelectionHighlight(WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp; dirtyRect);
+    void drawCurrentHighlight(WebCore::GraphicsContext&amp;);
+
+    WebPage* m_webPage;
+    PageOverlay* m_servicesOverlay;
+    
+    Vector&lt;WebCore::LayoutRect&gt; m_currentSelectionRects;
+    Vector&lt;RefPtr&lt;WebCore::Range&gt;&gt; m_currentTelephoneNumberRanges;
+
+    WebCore::IntPoint m_mousePosition;
+    bool m_mouseIsDownOnButton;
+    bool m_mouseIsOverHighlight;
+    bool m_drawingTelephoneNumberHighlight;
+
+    RetainPtr&lt;DDHighlightRef&gt; m_currentHighlight;
+    bool m_currentHighlightIsDirty;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_CONTROLS) &amp;&amp; ENABLE(TELEPHONE_NUMBER_DETECTION)
+#endif // ServicesOverlayController_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageTelephoneNumberOverlayControllercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.cpp (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.cpp        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.cpp        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,117 +0,0 @@
</span><del>-/*
- * 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.
- */
-
-#include &quot;config.h&quot;
-#include &quot;TelephoneNumberOverlayController.h&quot;
-
-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-
-#include &quot;WebPage.h&quot;
-#include &lt;WebCore/NotImplemented.h&gt;
-
-using namespace WebCore;
-
-namespace WebKit {
-    
-TelephoneNumberOverlayController::TelephoneNumberOverlayController(WebPage* webPage)
-    : m_webPage(webPage)
-    , m_telephoneNumberOverlay(nullptr)
-{
-    ASSERT(m_webPage);
-}
-
-void TelephoneNumberOverlayController::createOverlayIfNeeded()
-{
-    if (m_telephoneNumberOverlay) {
-        m_telephoneNumberOverlay-&gt;setNeedsDisplay();
-        return;
-    }
-    
-    RefPtr&lt;PageOverlay&gt; overlay = PageOverlay::create(this, PageOverlay::OverlayType::Document);
-    m_telephoneNumberOverlay = overlay.get();
-    m_webPage-&gt;installPageOverlay(overlay.release(), PageOverlay::FadeMode::Fade);
-    m_telephoneNumberOverlay-&gt;setNeedsDisplay();
-}
-
-void TelephoneNumberOverlayController::destroyOverlay()
-{
-    if (!m_telephoneNumberOverlay)
-        return;
-
-    m_webPage-&gt;uninstallPageOverlay(m_telephoneNumberOverlay, PageOverlay::FadeMode::DoNotFade);
-}
-
-void TelephoneNumberOverlayController::pageOverlayDestroyed(PageOverlay*)
-{
-    // Before the overlay is destroyed, it should have moved out of the WebPage,
-    // at which point we already cleared our back pointer.
-    ASSERT(!m_telephoneNumberOverlay);
-}
-
-void TelephoneNumberOverlayController::willMoveToWebPage(PageOverlay*, WebPage* webPage)
-{
-    if (webPage)
-        return;
-
-    ASSERT(m_telephoneNumberOverlay);
-    m_telephoneNumberOverlay = 0;
-}
-
-void TelephoneNumberOverlayController::didMoveToWebPage(PageOverlay*, WebPage*)
-{
-}
-
-void TelephoneNumberOverlayController::selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;Range&gt;&gt;&amp; ranges)
-{
-#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 1090
-    m_currentSelectionRanges = ranges;
-    
-    clearHighlights();
-    
-    if (m_currentSelectionRanges.isEmpty())
-        destroyOverlay();
-    else
-        createOverlayIfNeeded();
-#else
-    UNUSED_PARAM(ranges);
-#endif
-}
-
-#if !PLATFORM(MAC)
-void TelephoneNumberOverlayController::drawRect(PageOverlay*, WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp;)
-{
-    notImplemented();
-}
-
-bool TelephoneNumberOverlayController::mouseEvent(PageOverlay*, const WebMouseEvent&amp;)
-{
-    notImplemented();
-    return false;
-}
-#endif
-
-} // namespace WebKit
-
-#endif // ENABLE(TELEPHONE_NUMBER_DETECTION)
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageTelephoneNumberOverlayControllerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.h (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.h        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TelephoneNumberOverlayController.h        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,118 +0,0 @@
</span><del>-/*
- * 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 TelephoneNumberOverlayController_h
-
-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-
-#include &quot;PageOverlay.h&quot;
-#include &quot;WebPage.h&quot;
-#include &lt;WebCore/IntRect.h&gt;
-#include &lt;wtf/RefCounted.h&gt;
-
-namespace WebCore {
-class Range;
-}
-
-namespace WebKit {
-    
-class WebPage;
-    
-#if PLATFORM(MAC)
-typedef void* DDHighlightRef;
-
-class TelephoneNumberData : public RefCounted&lt;TelephoneNumberData&gt; {
-public:
-    static PassRefPtr&lt;TelephoneNumberData&gt; create(WebCore::Range* range, DDHighlightRef highlight)
-    {
-        return adoptRef(new TelephoneNumberData(range, highlight));
-    }
-
-    WebCore::Range* range() const { return m_range.get(); }
-    DDHighlightRef highlight() const { return m_highlight.get(); }
-
-    bool isHovered() const { return m_hovered; }
-    void setHovered(bool hovered) { m_hovered = hovered; }
-
-private:
-    TelephoneNumberData(WebCore::Range* range, DDHighlightRef highlight)
-        : m_hovered(false)
-        , m_range(range)
-        , m_highlight(highlight)
-    {
-    }
-
-    bool m_hovered;
-    RefPtr&lt;WebCore::Range&gt; m_range;
-    RetainPtr&lt;DDHighlightRef&gt; m_highlight;
-};
-#endif
-
-class TelephoneNumberOverlayController : public RefCounted&lt;TelephoneNumberOverlayController&gt;, private PageOverlay::Client {
-public:
-
-    static PassRefPtr&lt;TelephoneNumberOverlayController&gt; create(WebPage* webPage)
-    {
-        return adoptRef(new TelephoneNumberOverlayController(webPage));
-    }
-
-    void selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;WebCore::Range&gt;&gt;&amp;);
-    
-private:
-    TelephoneNumberOverlayController(WebPage*);
-
-    void createOverlayIfNeeded();
-    void destroyOverlay();
-    
-    void clearHighlights();
-    void clearMouseDownInformation();
-
-#if PLATFORM(MAC)
-    void handleTelephoneClick(TelephoneNumberData*, const WebCore::IntPoint&amp;);
-#endif
-    
-    virtual void pageOverlayDestroyed(PageOverlay*) override;
-    virtual void willMoveToWebPage(PageOverlay*, WebPage*) override;
-    virtual void didMoveToWebPage(PageOverlay*, WebPage*) override;
-    virtual void drawRect(PageOverlay*, WebCore::GraphicsContext&amp;, const WebCore::IntRect&amp; dirtyRect) override;
-    virtual bool mouseEvent(PageOverlay*, const WebMouseEvent&amp;) override;
-
-    RefPtr&lt;WebPage&gt; m_webPage;
-    PageOverlay* m_telephoneNumberOverlay;
-    Vector&lt;RefPtr&lt;WebCore::Range&gt;&gt; m_currentSelectionRanges;
-    
-#if PLATFORM(MAC)
-    RefPtr&lt;TelephoneNumberData&gt; m_highlightedTelephoneNumberData;
-    RefPtr&lt;TelephoneNumberData&gt; m_currentMouseDownNumber;
-#endif
-
-    WebCore::IntPoint m_lastMouseMovePosition;
-    WebCore::IntPoint m_mouseDownPosition;
-};
-
-} // namespace WebKit
-
-#endif // ENABLE(TELEPHONE_NUMBER_DETECTION)
-#endif // TelephoneNumberOverlayController_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -51,12 +51,11 @@
</span><span class="cx"> #include &quot;PluginProxy.h&quot;
</span><span class="cx"> #include &quot;PluginView.h&quot;
</span><span class="cx"> #include &quot;PrintInfo.h&quot;
</span><del>-#include &quot;SelectionOverlayController.h&quot;
</del><ins>+#include &quot;ServicesOverlayController.h&quot;
</ins><span class="cx"> #include &quot;SessionState.h&quot;
</span><span class="cx"> #include &quot;SessionStateConversion.h&quot;
</span><span class="cx"> #include &quot;SessionTracker.h&quot;
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><del>-#include &quot;TelephoneNumberOverlayController.h&quot;
</del><span class="cx"> #include &quot;VisitedLinkTableController.h&quot;
</span><span class="cx"> #include &quot;WKBundleAPICast.h&quot;
</span><span class="cx"> #include &quot;WKRetainPtr.h&quot;
</span><span class="lines">@@ -4735,26 +4734,16 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-TelephoneNumberOverlayController&amp; WebPage::telephoneNumberOverlayController()
</del><ins>+#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
+ServicesOverlayController&amp; WebPage::servicesOverlayController()
</ins><span class="cx"> {
</span><del>-    if (!m_telephoneNumberOverlayController)
-        m_telephoneNumberOverlayController = TelephoneNumberOverlayController::create(this);
</del><ins>+    if (!m_servicesOverlayController)
+        m_servicesOverlayController = std::make_unique&lt;ServicesOverlayController&gt;(this);
</ins><span class="cx"> 
</span><del>-    return *m_telephoneNumberOverlayController;
</del><ins>+    return *m_servicesOverlayController;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(SERVICE_CONTROLS)
-SelectionOverlayController&amp; WebPage::selectionOverlayController()
-{
-    if (!m_selectionOverlayController)
-        m_selectionOverlayController = SelectionOverlayController::create(this);
-
-    return *m_selectionOverlayController;
-}
-#endif
-
</del><span class="cx"> void WebPage::didChangeScrollOffsetForFrame(Frame* frame)
</span><span class="cx"> {
</span><span class="cx">     m_pageOverlayController.didScrollFrame(frame);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -140,12 +140,12 @@
</span><span class="cx"> 
</span><span class="cx"> class DrawingArea;
</span><span class="cx"> class InjectedBundleBackForwardList;
</span><ins>+class LegacySessionState;
</ins><span class="cx"> class NotificationPermissionRequestManager;
</span><span class="cx"> class PageBanner;
</span><span class="cx"> class PageOverlay;
</span><span class="cx"> class PluginView;
</span><del>-class LegacySessionState;
-class SelectionOverlayController;
</del><ins>+class ServicesOverlayController;
</ins><span class="cx"> class VisibleContentRectUpdateInfo;
</span><span class="cx"> class WebColorChooser;
</span><span class="cx"> class WebContextMenu;
</span><span class="lines">@@ -183,10 +183,6 @@
</span><span class="cx"> class WebTouchEvent;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-class TelephoneNumberOverlayController;
-#endif
-
</del><span class="cx"> class WebPage : public API::ObjectImpl&lt;API::Object::Type::BundlePage&gt;, public IPC::MessageReceiver, public IPC::MessageSender {
</span><span class="cx"> public:
</span><span class="cx">     static PassRefPtr&lt;WebPage&gt; create(uint64_t pageID, const WebPageCreationParameters&amp;);
</span><span class="lines">@@ -827,13 +823,10 @@
</span><span class="cx">     // Some platforms require accessibility-enabled processes to spin the run loop so that the WebProcess doesn't hang.
</span><span class="cx">     // While this is not ideal, it does not have to be applied to every platform at the moment.
</span><span class="cx">     static bool synchronousMessagesShouldSpinRunLoop();
</span><del>-    
-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-    TelephoneNumberOverlayController&amp; telephoneNumberOverlayController();
</del><ins>+
+#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION) 
+    ServicesOverlayController&amp; servicesOverlayController();
</ins><span class="cx">     void handleTelephoneNumberClick(const String&amp; number, const WebCore::IntPoint&amp;);
</span><del>-#endif
-#if ENABLE(SERVICE_CONTROLS)
-    SelectionOverlayController&amp; selectionOverlayController();
</del><span class="cx">     void handleSelectionServiceClick(WebCore::FrameSelection&amp;, const WebCore::IntPoint&amp;);
</span><span class="cx">     bool serviceControlsEnabled() const { return m_serviceControlsEnabled; }
</span><span class="cx"> #endif
</span><span class="lines">@@ -1271,12 +1264,9 @@
</span><span class="cx">     WebCore::WebGLLoadPolicy m_systemWebGLPolicy;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(TELEPHONE_NUMBER_DETECTION)
-    RefPtr&lt;TelephoneNumberOverlayController&gt; m_telephoneNumberOverlayController;
</del><ins>+#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
+    std::unique_ptr&lt;ServicesOverlayController&gt; m_servicesOverlayController;
</ins><span class="cx"> #endif
</span><del>-#if ENABLE(SERVICE_CONTROLS)
-    RefPtr&lt;SelectionOverlayController&gt; m_selectionOverlayController;
-#endif
</del><span class="cx"> 
</span><span class="cx">     PageOverlayController m_pageOverlayController;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacSelectionOverlayControllerMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,201 +0,0 @@
</span><del>-/*
- * 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;SelectionOverlayController.h&quot;
-
-#if ENABLE(SERVICE_CONTROLS)
-
-#import &quot;WebProcess.h&quot;
-#import &lt;WebCore/FrameView.h&gt;
-#import &lt;WebCore/GraphicsContext.h&gt;
-#import &lt;WebCore/MainFrame.h&gt;
-#import &lt;WebCore/SoftLinking.h&gt;
-
-#if __has_include(&lt;DataDetectors/DDHighlightDrawing.h&gt;)
-#import &lt;DataDetectors/DDHighlightDrawing.h&gt;
-#else
-typedef void* DDHighlightRef;
-#endif
-
-#if __has_include(&lt;DataDetectors/DDHighlightDrawing_Private.h&gt;)
-#import &lt;DataDetectors/DDHighlightDrawing_Private.h&gt;
-#endif
-
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
-SOFT_LINK(DataDetectors, DDHighlightCreateWithRectsInVisibleRect, DDHighlightRef, (CFAllocatorRef allocator, CGRect * rects, CFIndex count, CGRect globalVisibleRect, Boolean withArrow), (allocator, rects, count, globalVisibleRect, withArrow))
-SOFT_LINK(DataDetectors, DDHighlightGetLayerWithContext, CGLayerRef, (DDHighlightRef highlight, CGContextRef context), (highlight, context))
-SOFT_LINK(DataDetectors, DDHighlightGetBoundingRect, CGRect, (DDHighlightRef highlight), (highlight))
-SOFT_LINK(DataDetectors, DDHighlightPointIsOnHighlight, Boolean, (DDHighlightRef highlight, CGPoint point, Boolean* onButton), (highlight, point, onButton))
-SOFT_LINK(DataDetectors, DDHighlightSetButtonPressed, void, (DDHighlightRef highlight, Boolean buttonPressed), (highlight, buttonPressed))
-
-using namespace WebCore;
-
-namespace WebKit {
-
-static double hoverTimerInterval = 2.0;
-
-void SelectionOverlayController::drawRect(PageOverlay* overlay, WebCore::GraphicsContext&amp; graphicsContext, const WebCore::IntRect&amp; dirtyRect)
-{
-    if (m_currentSelectionRects.isEmpty())
-        return;
-
-    if (!WebProcess::shared().hasSelectionServices()) {
-        destroyOverlay();
-        return;
-    }
-
-    if (!m_currentHighlight || m_currentHighlightIsDirty) {
-        Vector&lt;CGRect&gt; cgRects;
-        cgRects.reserveCapacity(m_currentSelectionRects.size());
-
-        for (auto&amp; rect : m_currentSelectionRects) {
-            IntRect selectionRect(rect.pixelSnappedLocation(), rect.pixelSnappedSize());
-
-            if (!selectionRect.intersects(dirtyRect))
-                continue;
-
-            cgRects.append((CGRect)pixelSnappedIntRect(rect));
-        }
-
-        if (!cgRects.isEmpty()) {
-            CGRect bounds = m_webPage-&gt;corePage()-&gt;mainFrame().view()-&gt;boundsRect();
-            m_currentHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, cgRects.begin(), cgRects.size(), bounds, true));
-            m_currentHighlightIsDirty = false;
-
-            Boolean onButton;
-            m_mouseIsOverHighlight = DDHighlightPointIsOnHighlight(m_currentHighlight.get(), (CGPoint)m_mousePosition, &amp;onButton);
-
-            mouseHoverStateChanged();
-        }
-    }
-
-    // If the UI is not visibile or if the mouse is not over the DDHighlight we have no drawing to do.
-    if (!m_mouseIsOverHighlight || !m_visible)
-        return;
-
-    CGContextRef cgContext = graphicsContext.platformContext();
-
-    CGLayerRef highlightLayer = DDHighlightGetLayerWithContext(m_currentHighlight.get(), cgContext);
-    CGRect highlightBoundingRect = DDHighlightGetBoundingRect(m_currentHighlight.get());
-    
-    GraphicsContextStateSaver stateSaver(graphicsContext);
-
-    graphicsContext.translate(toFloatSize(highlightBoundingRect.origin));
-    graphicsContext.scale(FloatSize(1, -1));
-    graphicsContext.translate(FloatSize(0, -highlightBoundingRect.size.height));
-    
-    CGRect highlightDrawRect = highlightBoundingRect;
-    highlightDrawRect.origin.x = 0;
-    highlightDrawRect.origin.y = 0;
-    
-    CGContextDrawLayerInRect(cgContext, highlightDrawRect, highlightLayer);
-}
-    
-bool SelectionOverlayController::mouseEvent(PageOverlay*, const WebMouseEvent&amp; event)
-{
-    m_mousePosition = m_webPage-&gt;corePage()-&gt;mainFrame().view()-&gt;rootViewToContents(event.position());
-
-    bool mouseWasOverHighlight = m_mouseIsOverHighlight;
-    Boolean onButton = false;
-    m_mouseIsOverHighlight = m_currentHighlight ? DDHighlightPointIsOnHighlight(m_currentHighlight.get(), (CGPoint)m_mousePosition, &amp;onButton) : false;
-
-    if (mouseWasOverHighlight != m_mouseIsOverHighlight) {
-        m_selectionOverlay-&gt;setNeedsDisplay();
-        mouseHoverStateChanged();
-    }
-
-    // If this event has nothing to do with the left button, it clears the current mouse down tracking and we're done processing it.
-    if (event.button() != WebMouseEvent::LeftButton) {
-        m_mouseIsDownOnButton = false;
-        return false;
-    }
-
-    if (!m_currentHighlight)
-        return false;
-
-    // Check and see if the mouse went up and we have a current mouse down highlight button.
-    if (event.type() == WebEvent::MouseUp) {
-        bool mouseWasDownOnButton = m_mouseIsDownOnButton;
-        m_mouseIsDownOnButton = false;
-
-        // If the mouse lifted while still over the highlight button that it went down on, then that is a click.
-        if (m_mouseIsOverHighlight &amp;&amp; onButton &amp;&amp; mouseWasDownOnButton) {
-            handleClick(m_mousePosition);
-            return true;
-        }
-        
-        return false;
-    }
-    
-    // Check and see if the mouse moved within the confines of the DD highlight button.
-    if (event.type() == WebEvent::MouseMove) {
-        // Moving with the mouse button down is okay as long as the mouse never leaves the highlight button.
-        if (m_mouseIsOverHighlight &amp;&amp; onButton)
-            return true;
-
-        m_mouseIsDownOnButton = false;
-        
-        return false;
-    }
-    
-    // Check and see if the mouse went down over a DD highlight button.
-    if (event.type() == WebEvent::MouseDown) {
-        if (m_mouseIsOverHighlight &amp;&amp; onButton) {
-            m_mouseIsDownOnButton = true;
-
-            // FIXME: We need to do the following, but SOFT_LINK isn't working for this method.
-            // DDHighlightSetButtonPressed(m_currentHighlight.get(), true);
-            
-            m_selectionOverlay-&gt;setNeedsDisplay();
-            return true;
-        }
-
-        return false;
-    }
-        
-    return false;
-}
-
-void SelectionOverlayController::handleClick(const WebCore::IntPoint&amp; point)
-{
-    m_webPage-&gt;handleSelectionServiceClick(m_webPage-&gt;corePage()-&gt;mainFrame().selection(), point);
-}
-
-void SelectionOverlayController::mouseHoverStateChanged()
-{
-    if (m_mouseIsOverHighlight) {
-        if (!m_hoverTimer.isActive())
-            m_hoverTimer.startOneShot(hoverTimerInterval);
-    } else {
-        m_visible = false;
-        m_hoverTimer.stop();
-    }
-}
-    
-} // namespace WebKit
-
-#endif // ENABLE(SERVICE_CONTROLS)
-
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacServicesOverlayControllermm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm (0 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -0,0 +1,350 @@
</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;ServicesOverlayController.h&quot;
+
+#if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; PLATFORM(MAC)
+
+#import &quot;WebPage.h&quot;
+#import &quot;WebProcess.h&quot;
+#import &lt;WebCore/Document.h&gt;
+#import &lt;WebCore/FloatQuad.h&gt;
+#import &lt;WebCore/FrameView.h&gt;
+#import &lt;WebCore/GraphicsContext.h&gt;
+#import &lt;WebCore/MainFrame.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+
+#if __has_include(&lt;DataDetectors/DDHighlightDrawing.h&gt;)
+#import &lt;DataDetectors/DDHighlightDrawing.h&gt;
+#else
+typedef void* DDHighlightRef;
+#endif
+
+#if __has_include(&lt;DataDetectors/DDHighlightDrawing_Private.h&gt;)
+#import &lt;DataDetectors/DDHighlightDrawing_Private.h&gt;
+#endif
+
+typedef NSUInteger DDHighlightStyle;
+static DDHighlightStyle DDHighlightNoOutlineWithArrow = 0;
+
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
+SOFT_LINK(DataDetectors, DDHighlightCreateWithRectsInVisibleRect, DDHighlightRef, (CFAllocatorRef allocator, CGRect * rects, CFIndex count, CGRect globalVisibleRect, Boolean withArrow), (allocator, rects, count, globalVisibleRect, withArrow))
+SOFT_LINK(DataDetectors, DDHighlightCreateWithRectsInVisibleRectWithStyle, DDHighlightRef, (CFAllocatorRef allocator, CGRect * rects, CFIndex count, CGRect globalVisibleRect, DDHighlightStyle style, Boolean withArrow), (allocator, rects, count, globalVisibleRect, style, withArrow))
+SOFT_LINK(DataDetectors, DDHighlightGetLayerWithContext, CGLayerRef, (DDHighlightRef highlight, CGContextRef context), (highlight, context))
+SOFT_LINK(DataDetectors, DDHighlightGetBoundingRect, CGRect, (DDHighlightRef highlight), (highlight))
+SOFT_LINK(DataDetectors, DDHighlightPointIsOnHighlight, Boolean, (DDHighlightRef highlight, CGPoint point, Boolean* onButton), (highlight, point, onButton))
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static IntRect textQuadsToBoundingRectForRange(Range&amp; range)
+{
+    Vector&lt;FloatQuad&gt; textQuads;
+    range.textQuads(textQuads);
+    FloatRect boundingRect;
+    for (auto&amp; quad : textQuads)
+        boundingRect.unite(quad.boundingBox());
+    return enclosingIntRect(boundingRect);
+}
+
+ServicesOverlayController::ServicesOverlayController(WebPage&amp; webPage)
+    : m_webPage(&amp;webPage)
+    , m_servicesOverlay(nullptr)
+    , m_mouseIsDownOnButton(false)
+    , m_mouseIsOverHighlight(false)
+    , m_drawingTelephoneNumberHighlight(false)
+    , m_currentHighlightIsDirty(false)
+{
+}
+
+ServicesOverlayController::~ServicesOverlayController()
+{
+    if (!m_servicesOverlay) {
+        ASSERT(m_webPage);
+        m_webPage-&gt;uninstallPageOverlay(m_servicesOverlay, PageOverlay::FadeMode::DoNotFade);
+    }
+}
+
+void ServicesOverlayController::pageOverlayDestroyed(PageOverlay*)
+{
+    // Before the overlay is destroyed, it should have moved out of the WebPage,
+    // at which point we already cleared our back pointer.
+    ASSERT(!m_servicesOverlay);
+}
+
+void ServicesOverlayController::willMoveToWebPage(PageOverlay*, WebPage* webPage)
+{
+    if (webPage)
+        return;
+
+    ASSERT(m_servicesOverlay);
+    m_servicesOverlay = nullptr;
+
+    ASSERT(m_webPage);
+    m_webPage = nullptr;
+}
+
+void ServicesOverlayController::didMoveToWebPage(PageOverlay*, WebPage*)
+{
+}
+
+void ServicesOverlayController::createOverlayIfNeeded()
+{
+    if (m_servicesOverlay) {
+        m_servicesOverlay-&gt;setNeedsDisplay();
+        return;
+    }
+
+    if (m_currentTelephoneNumberRanges.isEmpty() &amp;&amp; (!WebProcess::shared().hasSelectionServices() || m_currentSelectionRects.isEmpty()))
+        return;
+
+    RefPtr&lt;PageOverlay&gt; overlay = PageOverlay::create(this, PageOverlay::OverlayType::Document);
+    m_servicesOverlay = overlay.get();
+    m_webPage-&gt;installPageOverlay(overlay.release(), PageOverlay::FadeMode::Fade);
+    m_servicesOverlay-&gt;setNeedsDisplay();
+}
+
+void ServicesOverlayController::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects)
+{
+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 1090
+    m_currentHighlightIsDirty = true;
+    m_currentSelectionRects = rects;
+
+    createOverlayIfNeeded();
+#else
+    UNUSED_PARAM(rects);
+#endif
+}
+
+void ServicesOverlayController::selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;Range&gt;&gt;&amp; ranges)
+{
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 1090
+    m_currentHighlightIsDirty = true;
+    m_currentTelephoneNumberRanges = ranges;
+    m_drawingTelephoneNumberHighlight = false;
+
+    if (ranges.size() == 1) {
+        RefPtr&lt;Range&gt; selectionRange = m_webPage-&gt;corePage()-&gt;mainFrame().selection().toNormalizedRange();
+        if (ranges[0]-&gt;contains(*selectionRange))
+            m_drawingTelephoneNumberHighlight = true;
+    }
+    
+    createOverlayIfNeeded();
+#else
+    UNUSED_PARAM(ranges);
+#endif
+}
+
+void ServicesOverlayController::clearHighlightState()
+{
+    m_mouseIsDownOnButton = false;
+    m_mouseIsOverHighlight = false;
+    m_drawingTelephoneNumberHighlight = false;
+
+    m_currentHighlight = nullptr;
+}
+
+void ServicesOverlayController::drawRect(PageOverlay* overlay, WebCore::GraphicsContext&amp; graphicsContext, const WebCore::IntRect&amp; dirtyRect)
+{
+    if (m_currentSelectionRects.isEmpty() &amp;&amp; m_currentTelephoneNumberRanges.isEmpty()) {
+        clearHighlightState();
+        return;
+    }
+
+    if (m_drawingTelephoneNumberHighlight)
+        drawTelephoneNumberHighlight(graphicsContext, dirtyRect);
+    else
+        drawSelectionHighlight(graphicsContext, dirtyRect);
+}
+
+void ServicesOverlayController::drawSelectionHighlight(WebCore::GraphicsContext&amp; graphicsContext, const WebCore::IntRect&amp; dirtyRect)
+{
+    ASSERT(!m_drawingTelephoneNumberHighlight);
+    ASSERT(m_currentSelectionRects.size());
+
+    // If there are no installed selection services and we have no phone numbers detected, then we have nothing to draw.
+    if (!WebProcess::shared().hasSelectionServices() &amp;&amp; m_currentTelephoneNumberRanges.isEmpty())
+        return;
+
+    if (!m_currentHighlight || m_currentHighlightIsDirty) {
+        Vector&lt;CGRect&gt; cgRects;
+        cgRects.reserveCapacity(m_currentSelectionRects.size());
+
+        for (auto&amp; rect : m_currentSelectionRects) {
+            IntRect selectionRect(rect.pixelSnappedLocation(), rect.pixelSnappedSize());
+
+            if (!selectionRect.intersects(dirtyRect))
+                continue;
+
+            cgRects.append((CGRect)pixelSnappedIntRect(rect));
+        }
+
+        if (!cgRects.isEmpty()) {
+            CGRect bounds = m_webPage-&gt;corePage()-&gt;mainFrame().view()-&gt;boundsRect();
+            m_currentHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRectWithStyle(nullptr, cgRects.begin(), cgRects.size(), bounds, DDHighlightNoOutlineWithArrow, true));
+            m_currentHighlightIsDirty = false;
+        }
+    }
+
+    drawCurrentHighlight(graphicsContext);
+}
+
+void ServicesOverlayController::drawTelephoneNumberHighlight(WebCore::GraphicsContext&amp; graphicsContext, const WebCore::IntRect&amp; dirtyRect)
+{
+    ASSERT(m_drawingTelephoneNumberHighlight);
+    ASSERT(m_currentTelephoneNumberRanges.size() == 1);
+
+    auto&amp; range = m_currentTelephoneNumberRanges[0];
+
+    // FIXME: This will choke if the range wraps around the edge of the view.
+    // What should we do in that case?
+    IntRect rect = textQuadsToBoundingRectForRange(*range);
+
+    // Convert to the main document's coordinate space.
+    // FIXME: It's a little crazy to call contentsToWindow and then windowToContents in order to get the right coordinate space.
+    // We should consider adding conversion functions to ScrollView for contentsToDocument(). Right now, contentsToRootView() is
+    // not equivalent to what we need when you have a topContentInset or a header banner.
+    FrameView* viewForRange = range-&gt;ownerDocument().view();
+    if (!viewForRange)
+        return;
+    FrameView&amp; mainFrameView = *m_webPage-&gt;corePage()-&gt;mainFrame().view();
+    rect.setLocation(mainFrameView.windowToContents(viewForRange-&gt;contentsToWindow(rect.location())));
+
+    // If the selection rect is completely outside this drawing tile, don't process it further
+    if (!rect.intersects(dirtyRect))
+        return;
+
+    if (!m_currentHighlight || m_currentHighlightIsDirty) {
+        CGRect cgRect = (CGRect)rect;
+
+        m_currentHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, &amp;cgRect, 1, viewForRange-&gt;boundsRect(), true));
+        m_currentHighlightIsDirty = false;
+    }
+
+    drawCurrentHighlight(graphicsContext);
+}
+
+void ServicesOverlayController::drawCurrentHighlight(WebCore::GraphicsContext&amp; graphicsContext)
+{
+    Boolean onButton;
+    m_mouseIsOverHighlight = DDHighlightPointIsOnHighlight(m_currentHighlight.get(), (CGPoint)m_mousePosition, &amp;onButton);
+
+    // If the mouse is not over the DDHighlight we have no drawing to do.
+    if (!m_mouseIsOverHighlight)
+        return;
+
+    CGContextRef cgContext = graphicsContext.platformContext();
+    
+    CGLayerRef highlightLayer = DDHighlightGetLayerWithContext(m_currentHighlight.get(), cgContext);
+    CGRect highlightBoundingRect = DDHighlightGetBoundingRect(m_currentHighlight.get());
+    
+    GraphicsContextStateSaver stateSaver(graphicsContext);
+
+    graphicsContext.translate(toFloatSize(highlightBoundingRect.origin));
+    graphicsContext.scale(FloatSize(1, -1));
+    graphicsContext.translate(FloatSize(0, -highlightBoundingRect.size.height));
+    
+    CGRect highlightDrawRect = highlightBoundingRect;
+    highlightDrawRect.origin.x = 0;
+    highlightDrawRect.origin.y = 0;
+    
+    CGContextDrawLayerInRect(cgContext, highlightDrawRect, highlightLayer);
+}
+
+bool ServicesOverlayController::mouseEvent(PageOverlay*, const WebMouseEvent&amp; event)
+{
+    m_mousePosition = m_webPage-&gt;corePage()-&gt;mainFrame().view()-&gt;rootViewToContents(event.position());
+
+    bool mouseWasOverHighlight = m_mouseIsOverHighlight;
+    Boolean onButton = false;
+    m_mouseIsOverHighlight = m_currentHighlight ? DDHighlightPointIsOnHighlight(m_currentHighlight.get(), (CGPoint)m_mousePosition, &amp;onButton) : false;
+
+    if (mouseWasOverHighlight != m_mouseIsOverHighlight)
+        m_servicesOverlay-&gt;setNeedsDisplay();
+
+    // If this event has nothing to do with the left button, it clears the current mouse down tracking and we're done processing it.
+    if (event.button() != WebMouseEvent::LeftButton) {
+        m_mouseIsDownOnButton = false;
+        return false;
+    }
+
+    if (!m_currentHighlight)
+        return false;
+
+    // Check and see if the mouse went up and we have a current mouse down highlight button.
+    if (event.type() == WebEvent::MouseUp) {
+        bool mouseWasDownOnButton = m_mouseIsDownOnButton;
+        m_mouseIsDownOnButton = false;
+
+        // If the mouse lifted while still over the highlight button that it went down on, then that is a click.
+        if (m_mouseIsOverHighlight &amp;&amp; onButton &amp;&amp; mouseWasDownOnButton) {
+            handleClick(m_mousePosition);
+            return true;
+        }
+        
+        return false;
+    }
+    
+    // Check and see if the mouse moved within the confines of the DD highlight button.
+    if (event.type() == WebEvent::MouseMove) {
+        // Moving with the mouse button down is okay as long as the mouse never leaves the highlight button.
+        if (m_mouseIsOverHighlight &amp;&amp; onButton)
+            return true;
+
+        m_mouseIsDownOnButton = false;
+        
+        return false;
+    }
+    
+    // Check and see if the mouse went down over a DD highlight button.
+    if (event.type() == WebEvent::MouseDown) {
+        if (m_mouseIsOverHighlight &amp;&amp; onButton) {
+            m_mouseIsDownOnButton = true;
+            m_servicesOverlay-&gt;setNeedsDisplay();
+            return true;
+        }
+
+        return false;
+    }
+        
+    return false;
+}
+
+void ServicesOverlayController::handleClick(const WebCore::IntPoint&amp; point)
+{
+    if (m_drawingTelephoneNumberHighlight) {
+        ASSERT(m_currentTelephoneNumberRanges.size() == 1);
+        m_webPage-&gt;handleTelephoneNumberClick(m_currentTelephoneNumberRanges[0]-&gt;text(), point);
+    } else {
+        // FIXME: Include all selected telephone numbers so they can be added to the menu as well.
+        m_webPage-&gt;handleSelectionServiceClick(m_webPage-&gt;corePage()-&gt;mainFrame().selection(), point);
+    }
+}
+    
+} // namespace WebKit
+
+#endif // #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; PLATFORM(MAC)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacTelephoneNumberOverlayControllerMacmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm (170639 => 170640)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm        2014-07-01 15:22:44 UTC (rev 170639)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TelephoneNumberOverlayControllerMac.mm        2014-07-01 16:22:01 UTC (rev 170640)
</span><span class="lines">@@ -1,221 +0,0 @@
</span><del>-/*
- * 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;TelephoneNumberOverlayController.h&quot;
-
-#if ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; PLATFORM(MAC)
-
-#import &lt;WebCore/Document.h&gt;
-#import &lt;WebCore/FloatQuad.h&gt;
-#import &lt;WebCore/FrameView.h&gt;
-#import &lt;WebCore/GraphicsContext.h&gt;
-#import &lt;WebCore/MainFrame.h&gt;
-#import &lt;WebCore/SoftLinking.h&gt;
-
-#if __has_include(&lt;DataDetectors/DDHighlightDrawing.h&gt;)
-#import &lt;DataDetectors/DDHighlightDrawing.h&gt;
-#else
-typedef void* DDHighlightRef;
-#endif
-
-#if __has_include(&lt;DataDetectors/DDHighlightDrawing_Private.h&gt;)
-#import &lt;DataDetectors/DDHighlightDrawing_Private.h&gt;
-#endif
-
-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
-SOFT_LINK(DataDetectors, DDHighlightCreateWithRectsInVisibleRect, DDHighlightRef, (CFAllocatorRef allocator, CGRect * rects, CFIndex count, CGRect globalVisibleRect, Boolean withArrow), (allocator, rects, count, globalVisibleRect, withArrow))
-SOFT_LINK(DataDetectors, DDHighlightGetLayerWithContext, CGLayerRef, (DDHighlightRef highlight, CGContextRef context), (highlight, context))
-SOFT_LINK(DataDetectors, DDHighlightGetBoundingRect, CGRect, (DDHighlightRef highlight), (highlight))
-SOFT_LINK(DataDetectors, DDHighlightPointIsOnHighlight, Boolean, (DDHighlightRef highlight, CGPoint point, Boolean* onButton), (highlight, point, onButton))
-
-using namespace WebCore;
-
-namespace WebKit {
-
-static IntRect textQuadsToBoundingRectForRange(Range&amp; range)
-{
-    Vector&lt;FloatQuad&gt; textQuads;
-    range.textQuads(textQuads);
-    FloatRect boundingRect;
-    for (auto&amp; quad : textQuads)
-        boundingRect.unite(quad.boundingBox());
-    return enclosingIntRect(boundingRect);
-}
-
-void TelephoneNumberOverlayController::drawRect(PageOverlay* overlay, WebCore::GraphicsContext&amp; graphicsContext, const WebCore::IntRect&amp; dirtyRect)
-{
-    // Only draw an individual telephone number highlight if there is precisely one telephone number selected.
-    if (m_currentSelectionRanges.isEmpty() || m_currentSelectionRanges.size() &gt; 1) {
-        clearHighlights();
-        return;
-    }
-
-    CGContextRef cgContext = graphicsContext.platformContext();
-    auto&amp; range = m_currentSelectionRanges[0];
-
-    // FIXME: This will choke if the range wraps around the edge of the view.
-    // What should we do in that case?
-    IntRect rect = textQuadsToBoundingRectForRange(*range);
-
-    // Convert to the main document's coordinate space.
-    // FIXME: It's a little crazy to call contentsToWindow and then windowToContents in order to get the right coordinate space.
-    // We should consider adding conversion functions to ScrollView for contentsToDocument(). Right now, contentsToRootView() is
-    // not equivalent to what we need when you have a topContentInset or a header banner.
-    FrameView* viewForRange = range-&gt;ownerDocument().view();
-    if (!viewForRange)
-        return;
-    FrameView&amp; mainFrameView = *m_webPage-&gt;corePage()-&gt;mainFrame().view();
-    rect.setLocation(mainFrameView.windowToContents(viewForRange-&gt;contentsToWindow(rect.location())));
-
-    // If the selection rect is completely outside this drawing tile, don't process it further
-    if (!rect.intersects(dirtyRect))
-        return;
-
-    CGRect cgRects[] = { (CGRect)rect };
-
-    RetainPtr&lt;DDHighlightRef&gt; highlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, cgRects, 1, viewForRange-&gt;boundsRect(), true));
-    m_highlightedTelephoneNumberData = TelephoneNumberData::create(range.get(), highlight.get());
-
-    Boolean onButton;
-    bool onHighlight = DDHighlightPointIsOnHighlight(highlight.get(), (CGPoint)m_lastMouseMovePosition, &amp;onButton);
-
-    m_highlightedTelephoneNumberData-&gt;setHovered(onHighlight);
-
-    // Don't draw the highlight if the mouse is not hovered over it.
-    if (!onHighlight)
-        return;
-
-    // Check and see if the mouse is currently down inside this highlight's button.
-    if (m_mouseDownPosition != IntPoint() &amp;&amp; onButton)
-        m_currentMouseDownNumber = m_highlightedTelephoneNumberData;
-    
-    CGLayerRef highlightLayer = DDHighlightGetLayerWithContext(highlight.get(), cgContext);
-    CGRect highlightBoundingRect = DDHighlightGetBoundingRect(highlight.get());
-    
-    GraphicsContextStateSaver stateSaver(graphicsContext);
-
-    graphicsContext.translate(toFloatSize(highlightBoundingRect.origin));
-    graphicsContext.scale(FloatSize(1, -1));
-    graphicsContext.translate(FloatSize(0, -highlightBoundingRect.size.height));
-    
-    CGRect highlightDrawRect = highlightBoundingRect;
-    highlightDrawRect.origin.x = 0;
-    highlightDrawRect.origin.y = 0;
-    
-    CGContextDrawLayerInRect(cgContext, highlightDrawRect, highlightLayer);
-}
-    
-void TelephoneNumberOverlayController::handleTelephoneClick(TelephoneNumberData* number, const IntPoint&amp; point)
-{
-    ASSERT(number);
-
-    m_webPage-&gt;handleTelephoneNumberClick(number-&gt;range()-&gt;text(), point);
-}
-    
-bool TelephoneNumberOverlayController::mouseEvent(PageOverlay*, const WebMouseEvent&amp; event)
-{
-    m_lastMouseMovePosition = m_webPage-&gt;corePage()-&gt;mainFrame().view()-&gt;rootViewToContents(event.position());
-
-    if (m_highlightedTelephoneNumberData) {
-        Boolean onButton;
-        bool hovered = DDHighlightPointIsOnHighlight(m_highlightedTelephoneNumberData-&gt;highlight(), (CGPoint)m_lastMouseMovePosition, &amp;onButton);
-
-        if (hovered != m_highlightedTelephoneNumberData-&gt;isHovered())
-            m_telephoneNumberOverlay-&gt;setNeedsDisplay();
-
-        m_highlightedTelephoneNumberData-&gt;setHovered(hovered);
-    }
-
-    // If this event has nothing to do with the left button, it clears the current mouse down tracking and we're done processing it.
-    if (event.button() != WebMouseEvent::LeftButton) {
-        clearMouseDownInformation();
-        return false;
-    }
-    
-    RefPtr&lt;TelephoneNumberData&gt; currentNumber = m_currentMouseDownNumber;
-    
-    // Check and see if the mouse went up and we have a current mouse down highlight button.
-    if (event.type() == WebEvent::MouseUp &amp;&amp; currentNumber) {
-        clearMouseDownInformation();
-        
-        // If the mouse lifted while still over the highlight button that it went down on, then that is a click.
-        Boolean onButton;
-        if (DDHighlightPointIsOnHighlight(currentNumber-&gt;highlight(), (CGPoint)m_lastMouseMovePosition, &amp;onButton) &amp;&amp; onButton) {
-            handleTelephoneClick(currentNumber.get(), m_webPage-&gt;corePage()-&gt;mainFrame().view()-&gt;contentsToWindow(m_lastMouseMovePosition));
-            
-            return true;
-        }
-        
-        return false;
-    }
-    
-    // Check and see if the mouse moved within the confines of the DD highlight button.
-    if (event.type() == WebEvent::MouseMove &amp;&amp; currentNumber) {
-        Boolean onButton;
-        
-        // Moving with the mouse button down is okay as long as the mouse never leaves the highlight button.
-        if (DDHighlightPointIsOnHighlight(currentNumber-&gt;highlight(), (CGPoint)m_lastMouseMovePosition, &amp;onButton) &amp;&amp; onButton)
-            return true;
-        
-        clearMouseDownInformation();
-        
-        return false;
-    }
-    
-    // Check and see if the mouse went down over a DD highlight button.
-    if (event.type() == WebEvent::MouseDown) {
-        ASSERT(!m_currentMouseDownNumber);
-        
-        Boolean onButton;
-        if (DDHighlightPointIsOnHighlight(m_highlightedTelephoneNumberData-&gt;highlight(), (CGPoint)m_lastMouseMovePosition, &amp;onButton) &amp;&amp; onButton) {
-            m_mouseDownPosition = m_lastMouseMovePosition;
-            m_currentMouseDownNumber = m_highlightedTelephoneNumberData;
-            
-            m_telephoneNumberOverlay-&gt;setNeedsDisplay();
-            return true;
-        }
-
-        return false;
-    }
-        
-    return false;
-}
-    
-void TelephoneNumberOverlayController::clearMouseDownInformation()
-{
-    m_currentMouseDownNumber = nullptr;
-    m_mouseDownPosition = IntPoint();
-}
-    
-void TelephoneNumberOverlayController::clearHighlights()
-{
-    m_highlightedTelephoneNumberData = nullptr;
-    m_currentMouseDownNumber = nullptr;
-}
-    
-}
-
-#endif // ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; PLATFORM(MAC)
</del></span></pre>
</div>
</div>

</body>
</html>