<!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>[167830] 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/167830">167830</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2014-04-25 15:22:14 -0700 (Fri, 25 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add a selection overlay.
&lt;rdar://problem/16727797&gt; and https://bugs.webkit.org/show_bug.cgi?id=132200

Reviewed by David Hyatt.

Source/WebCore:
No new tests (WK2 feature in development).

* WebCore.xcodeproj/project.pbxproj:

Add a SelectionRectGathterer class.
It creates a Notifier (given a RenderView) then accepts Rects from the RenderView.
When the Notifier is destroyed, the appropriate EditorClient is notified of the gathered rects.
* editing/SelectionRectGatherer.cpp: Added.
(WebCore::SelectionRectGatherer::SelectionRectGatherer):
(WebCore::SelectionRectGatherer::addRect):
(WebCore::SelectionRectGatherer::addRects):
(WebCore::SelectionRectGatherer::Notifier::Notifier):
(WebCore::SelectionRectGatherer::Notifier::~Notifier):
(WebCore::SelectionRectGatherer::clearAndCreateNotifier):
* editing/SelectionRectGatherer.h: Added.

* page/EditorClient.h:
(WebCore::EditorClient::selectionRectsDidChange):

* rendering/RenderView.cpp:
(WebCore::RenderView::RenderView):
(WebCore::RenderView::setSelection): Clear the gatherer’s rects then create a Notifier.
(WebCore::RenderView::setSubtreeSelection): Give all the selection rects to be painted to
  the SelectionRectGatherer.
* rendering/RenderView.h:

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

* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::selectionRectsDidChange): Pass the new selection rects on
  to the selection overlay controller.
* WebProcess/WebCoreSupport/WebEditorClient.h:

* WebProcess/WebPage/SelectionOverlayController.cpp: Added.
(WebKit::SelectionOverlayController::SelectionOverlayController):
(WebKit::SelectionOverlayController::createOverlayIfNeeded):
(WebKit::SelectionOverlayController::destroyOverlay):
(WebKit::SelectionOverlayController::pageOverlayDestroyed):
(WebKit::SelectionOverlayController::willMoveToWebPage):
(WebKit::SelectionOverlayController::didMoveToWebPage):
(WebKit::SelectionOverlayController::selectionRectsDidChange):
(WebKit::SelectionOverlayController::drawRect):
(WebKit::SelectionOverlayController::mouseEvent):
* WebProcess/WebPage/SelectionOverlayController.h: Added.
(WebKit::SelectionOverlayController::create):
* WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm: Added.
(WebKit::SelectionOverlayController::drawRect):
(WebKit::SelectionOverlayController::mouseEvent):
(WebKit::SelectionOverlayController::handleClick):
(WebKit::SelectionOverlayController::clearHighlight):

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::selectionOverlayController):
* WebProcess/WebPage/WebPage.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepageEditorClienth">trunk/Source/WebCore/page/EditorClient.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderViewcpp">trunk/Source/WebCore/rendering/RenderView.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderViewh">trunk/Source/WebCore/rendering/RenderView.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="#trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h</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="#trunkSourceWebCoreeditingSelectionRectGatherercpp">trunk/Source/WebCore/editing/SelectionRectGatherer.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingSelectionRectGathererh">trunk/Source/WebCore/editing/SelectionRectGatherer.h</a></li>
<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="#trunkSourceWebKit2WebProcessWebPagemacSelectionOverlayControllerMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebCore/ChangeLog        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -1,3 +1,36 @@
</span><ins>+2014-04-25  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add a selection overlay.
+        &lt;rdar://problem/16727797&gt; and https://bugs.webkit.org/show_bug.cgi?id=132200
+
+        Reviewed by David Hyatt.
+
+        No new tests (WK2 feature in development).
+
+        * WebCore.xcodeproj/project.pbxproj:
+
+        Add a SelectionRectGathterer class.
+        It creates a Notifier (given a RenderView) then accepts Rects from the RenderView.
+        When the Notifier is destroyed, the appropriate EditorClient is notified of the gathered rects.
+        * editing/SelectionRectGatherer.cpp: Added.
+        (WebCore::SelectionRectGatherer::SelectionRectGatherer):
+        (WebCore::SelectionRectGatherer::addRect):
+        (WebCore::SelectionRectGatherer::addRects):
+        (WebCore::SelectionRectGatherer::Notifier::Notifier):
+        (WebCore::SelectionRectGatherer::Notifier::~Notifier):
+        (WebCore::SelectionRectGatherer::clearAndCreateNotifier):
+        * editing/SelectionRectGatherer.h: Added.
+
+        * page/EditorClient.h:
+        (WebCore::EditorClient::selectionRectsDidChange):
+
+        * rendering/RenderView.cpp:
+        (WebCore::RenderView::RenderView):
+        (WebCore::RenderView::setSelection): Clear the gatherer’s rects then create a Notifier.
+        (WebCore::RenderView::setSubtreeSelection): Give all the selection rects to be painted to
+          the SelectionRectGatherer.
+        * rendering/RenderView.h:
+
</ins><span class="cx"> 2014-04-08  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Support &quot;Live&quot; streams in media controls.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -1817,6 +1817,8 @@
</span><span class="cx">                 51327D6111A33A2B004F9D65 /* SinkDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */; };
</span><span class="cx">                 513F14530AB634C400094DDF /* IconLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 513F14510AB634C400094DDF /* IconLoader.cpp */; };
</span><span class="cx">                 513F14540AB634C400094DDF /* IconLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 513F14520AB634C400094DDF /* IconLoader.h */; };
</span><ins>+                51405C88190B014400754F94 /* SelectionRectGatherer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51405C86190B014400754F94 /* SelectionRectGatherer.cpp */; };
+                51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */ = {isa = PBXBuildFile; fileRef = 51405C87190B014400754F94 /* SelectionRectGatherer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 514B3F730C722047000530DF /* FileSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 514B3F720C722047000530DF /* FileSystem.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 514B3F760C722055000530DF /* FileSystemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514B3F750C722055000530DF /* FileSystemMac.mm */; };
</span><span class="cx">                 514BC83F161CF04A004D52F4 /* ResourceBuffer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 514BC83D161CF043004D52F4 /* ResourceBuffer.mm */; };
</span><span class="lines">@@ -8808,6 +8810,8 @@
</span><span class="cx">                 51327D5F11A33A2B004F9D65 /* SinkDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SinkDocument.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 513F14510AB634C400094DDF /* IconLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconLoader.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 513F14520AB634C400094DDF /* IconLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconLoader.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51405C86190B014400754F94 /* SelectionRectGatherer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionRectGatherer.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51405C87190B014400754F94 /* SelectionRectGatherer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionRectGatherer.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 514B3F720C722047000530DF /* FileSystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileSystem.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 514B3F750C722055000530DF /* FileSystemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FileSystemMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 514BC83D161CF043004D52F4 /* ResourceBuffer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceBuffer.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17190,6 +17194,8 @@
</span><span class="cx">                                 A89CCC510F44E98100B5DA10 /* ReplaceNodeWithSpanCommand.h */,
</span><span class="cx">                                 93309DBA099E64910056E581 /* ReplaceSelectionCommand.cpp */,
</span><span class="cx">                                 93309DBB099E64910056E581 /* ReplaceSelectionCommand.h */,
</span><ins>+                                51405C86190B014400754F94 /* SelectionRectGatherer.cpp */,
+                                51405C87190B014400754F94 /* SelectionRectGatherer.h */,
</ins><span class="cx">                                 93309DC0099E64910056E581 /* SetNodeAttributeCommand.cpp */,
</span><span class="cx">                                 93309DC1099E64910056E581 /* SetNodeAttributeCommand.h */,
</span><span class="cx">                                 B8DBDB47130B0F8A00F5CDB1 /* SetSelectionCommand.cpp */,
</span><span class="lines">@@ -23642,6 +23648,7 @@
</span><span class="cx">                                 85E711C60AC5D5350053270F /* DOMHTMLSelectElementInternal.h in Headers */,
</span><span class="cx">                                 859A9C4F0AA5E3BD00B694B2 /* DOMHTMLStyleElement.h in Headers */,
</span><span class="cx">                                 85E711C70AC5D5350053270F /* DOMHTMLStyleElementInternal.h in Headers */,
</span><ins>+                                51405C89190B014400754F94 /* SelectionRectGatherer.h in Headers */,
</ins><span class="cx">                                 85DF821D0AA7849E00486AD7 /* DOMHTMLTableCaptionElement.h in Headers */,
</span><span class="cx">                                 85E711C80AC5D5350053270F /* DOMHTMLTableCaptionElementInternal.h in Headers */,
</span><span class="cx">                                 85DF821F0AA7849E00486AD7 /* DOMHTMLTableCellElement.h in Headers */,
</span><span class="lines">@@ -28520,6 +28527,7 @@
</span><span class="cx">                                 FDB1700514A2BAB200A2B5D9 /* MultiChannelResampler.cpp in Sources */,
</span><span class="cx">                                 85031B490A44EFC700F992E0 /* MutationEvent.cpp in Sources */,
</span><span class="cx">                                 C6F0900E14327B6100685849 /* MutationObserver.cpp in Sources */,
</span><ins>+                                51405C88190B014400754F94 /* SelectionRectGatherer.cpp in Sources */,
</ins><span class="cx">                                 D6E528A3149A926D00EFE1F3 /* MutationObserverInterestGroup.cpp in Sources */,
</span><span class="cx">                                 D6E276AF14637455001D280A /* MutationObserverRegistration.cpp in Sources */,
</span><span class="cx">                                 C6F08FBC1430FE8F00685849 /* MutationRecord.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingSelectionRectGatherercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/editing/SelectionRectGatherer.cpp (0 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/SelectionRectGatherer.cpp                                (rev 0)
+++ trunk/Source/WebCore/editing/SelectionRectGatherer.cpp        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -0,0 +1,79 @@
</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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;SelectionRectGatherer.h&quot;
+
+#include &quot;Editor.h&quot;
+#include &quot;EditorClient.h&quot;
+#include &quot;Frame.h&quot;
+#include &quot;RenderView.h&quot;
+
+#if ENABLE(SERVICE_CONTROLS)
+
+namespace WebCore {
+
+SelectionRectGatherer::SelectionRectGatherer(RenderView&amp; renderView)
+    : m_renderView(renderView)
+{
+}
+
+void SelectionRectGatherer::addRect(const LayoutRect&amp; rect)
+{
+    if (!rect.isEmpty())
+        m_rects.append(rect);
+}
+
+void SelectionRectGatherer::addRects(const GapRects&amp; rects)
+{
+    if (!rects.left().isEmpty())
+        m_rects.append(rects.left());
+    if (!rects.right().isEmpty())
+        m_rects.append(rects.right());
+    if (!rects.center().isEmpty())
+        m_rects.append(rects.center());
+}
+
+SelectionRectGatherer::Notifier::Notifier(SelectionRectGatherer&amp; gatherer)
+    : m_gatherer(gatherer)
+{
+}
+
+SelectionRectGatherer::Notifier::~Notifier()
+{
+    if (EditorClient* client = m_gatherer.m_renderView.view().frame().editor().client())
+        client-&gt;selectionRectsDidChange(m_gatherer.m_rects);
+}
+
+std::unique_ptr&lt;SelectionRectGatherer::Notifier&gt; SelectionRectGatherer::clearAndCreateNotifier()
+{
+    m_rects.clear();
+
+    return std::make_unique&lt;Notifier&gt;(*this);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_CONTROLS)
</ins></span></pre></div>
<a id="trunkSourceWebCoreeditingSelectionRectGathererh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/editing/SelectionRectGatherer.h (0 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/SelectionRectGatherer.h                                (rev 0)
+++ trunk/Source/WebCore/editing/SelectionRectGatherer.h        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -0,0 +1,70 @@
</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 SelectionRectGatherer_h
+#define SelectionRectGatherer_h
+
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+#if ENABLE(SERVICE_CONTROLS)
+
+namespace WebCore {
+
+class LayoutRect;
+class RenderView;
+
+struct GapRects;
+
+class SelectionRectGatherer {
+    WTF_MAKE_NONCOPYABLE(SelectionRectGatherer);
+
+public:
+    SelectionRectGatherer(RenderView&amp;);
+
+    void addRect(const LayoutRect&amp;);
+    void addRects(const GapRects&amp;);
+
+    class Notifier {
+        WTF_MAKE_NONCOPYABLE(Notifier);
+    public:
+        Notifier(SelectionRectGatherer&amp;);
+        ~Notifier();
+
+    private:
+        SelectionRectGatherer&amp; m_gatherer;
+    };
+
+    std::unique_ptr&lt;Notifier&gt; clearAndCreateNotifier();
+    
+private:
+    RenderView&amp; m_renderView;
+    Vector&lt;LayoutRect&gt; m_rects;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_CONTROLS)
+#endif // SelectionRectGatherer_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepageEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EditorClient.h (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EditorClient.h        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebCore/page/EditorClient.h        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> class Frame;
</span><span class="cx"> class HTMLElement;
</span><span class="cx"> class KeyboardEvent;
</span><ins>+class LayoutRect;
</ins><span class="cx"> class Node;
</span><span class="cx"> class Range;
</span><span class="cx"> class SharedBuffer;
</span><span class="lines">@@ -182,6 +183,10 @@
</span><span class="cx">     virtual void selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;Range&gt;&gt;&amp;) { }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+    virtual void selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp;) { }
+#endif
+
</ins><span class="cx">     // Support for global selections, used on platforms like the X Window System that treat
</span><span class="cx">     // selection as a type of clipboard.
</span><span class="cx">     virtual bool supportsGlobalSelection() { return false; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderView.cpp (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderView.cpp        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebCore/rendering/RenderView.cpp        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -72,6 +72,9 @@
</span><span class="cx"> #if ENABLE(CSS_FILTERS)
</span><span class="cx">     , m_hasSoftwareFilters(false)
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+    , m_selectionRectGatherer(*this)
+#endif
</ins><span class="cx"> {
</span><span class="cx">     setIsRenderView();
</span><span class="cx"> 
</span><span class="lines">@@ -760,6 +763,12 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* end, int endPos, SelectionRepaintMode blockRepaintMode)
</span><span class="cx"> {
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+    // Clear the current rects and create a notifier for the new rects we are about to gather.
+    // The Notifier updates the Editor when it goes out of scope and is destroyed.
+    std::unique_ptr&lt;SelectionRectGatherer::Notifier&gt; rectNotifier = m_selectionRectGatherer.clearAndCreateNotifier();
+#endif // ENABLE(SERVICE_CONTROLS)
+
</ins><span class="cx">     // Make sure both our start and end objects are defined.
</span><span class="cx">     // Check www.msnbc.com and try clicking around to find the case where this happened.
</span><span class="cx">     if ((start &amp;&amp; !end) || (end &amp;&amp; !start))
</span><span class="lines">@@ -933,7 +942,14 @@
</span><span class="cx">     o = start;
</span><span class="cx">     while (o &amp;&amp; o != stop) {
</span><span class="cx">         if ((o-&gt;canBeSelectionLeaf() || o == start || o == end) &amp;&amp; o-&gt;selectionState() != SelectionNone) {
</span><del>-            newSelectedObjects.set(o, std::make_unique&lt;RenderSelectionInfo&gt;(o, true));
</del><ins>+            std::unique_ptr&lt;RenderSelectionInfo&gt; selectionInfo = std::make_unique&lt;RenderSelectionInfo&gt;(o, true);
+
+#if ENABLE(SERVICE_CONTROLS)
+            m_selectionRectGatherer.addRect(selectionInfo-&gt;rect());
+#endif
+
+            newSelectedObjects.set(o, std::move(selectionInfo));
+
</ins><span class="cx">             RenderBlock* cb = o-&gt;containingBlock();
</span><span class="cx">             while (cb &amp;&amp; !cb-&gt;isRenderView()) {
</span><span class="cx">                 std::unique_ptr&lt;RenderBlockSelectionInfo&gt;&amp; blockInfo = newSelectedBlocks.add(cb, nullptr).iterator-&gt;value;
</span><span class="lines">@@ -941,6 +957,10 @@
</span><span class="cx">                     break;
</span><span class="cx">                 blockInfo = std::make_unique&lt;RenderBlockSelectionInfo&gt;(cb);
</span><span class="cx">                 cb = cb-&gt;containingBlock();
</span><ins>+
+#if ENABLE(SERVICE_CONTROLS)
+                m_selectionRectGatherer.addRects(blockInfo-&gt;rects());
+#endif
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderView.h (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderView.h        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebCore/rendering/RenderView.h        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -32,6 +32,10 @@
</span><span class="cx"> #include &lt;wtf/HashSet.h&gt;
</span><span class="cx"> #include &lt;wtf/OwnPtr.h&gt;
</span><span class="cx"> 
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+#include &quot;SelectionRectGatherer.h&quot;
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class FlowThreadController;
</span><span class="lines">@@ -354,6 +358,10 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     HashSet&lt;RenderElement*&gt; m_renderersWithPausedImageAnimation;
</span><ins>+
+#if ENABLE(SERVICE_CONTROLS)
+    SelectionRectGatherer m_selectionRectGatherer;
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> RENDER_OBJECT_TYPE_CASTS(RenderView, isRenderView())
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebKit2/ChangeLog        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-04-25  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        Add a selection overlay.
+        &lt;rdar://problem/16727797&gt; and https://bugs.webkit.org/show_bug.cgi?id=132200
+
+        Reviewed by David Hyatt.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::selectionRectsDidChange): Pass the new selection rects on
+          to the selection overlay controller.
+        * WebProcess/WebCoreSupport/WebEditorClient.h:
+
+        * WebProcess/WebPage/SelectionOverlayController.cpp: Added.
+        (WebKit::SelectionOverlayController::SelectionOverlayController):
+        (WebKit::SelectionOverlayController::createOverlayIfNeeded):
+        (WebKit::SelectionOverlayController::destroyOverlay):
+        (WebKit::SelectionOverlayController::pageOverlayDestroyed):
+        (WebKit::SelectionOverlayController::willMoveToWebPage):
+        (WebKit::SelectionOverlayController::didMoveToWebPage):
+        (WebKit::SelectionOverlayController::selectionRectsDidChange):
+        (WebKit::SelectionOverlayController::drawRect):
+        (WebKit::SelectionOverlayController::mouseEvent):
+        * WebProcess/WebPage/SelectionOverlayController.h: Added.
+        (WebKit::SelectionOverlayController::create):
+        * WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm: Added.
+        (WebKit::SelectionOverlayController::drawRect):
+        (WebKit::SelectionOverlayController::mouseEvent):
+        (WebKit::SelectionOverlayController::handleClick):
+        (WebKit::SelectionOverlayController::clearHighlight):
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::selectionOverlayController):
+        * WebProcess/WebPage/WebPage.h:
+
</ins><span class="cx"> 2014-04-25  Enrica Casucci  &lt;enrica@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove duplicate member variable in WKAutocorrectionRects and WKAutocorrectionContext.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -905,6 +905,9 @@
</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><ins>+                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 */; };
</ins><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">@@ -2757,6 +2760,9 @@
</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><ins>+                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;; };
</ins><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">@@ -5316,6 +5322,8 @@
</span><span class="cx">                                 1A90C23512650717003E44D4 /* PageOverlay.h */,
</span><span class="cx">                                 2D140EAD18F37BE0005E75A0 /* PageOverlayController.cpp */,
</span><span class="cx">                                 2D140EAE18F37BE0005E75A0 /* PageOverlayController.h */,
</span><ins>+                                51EF124C19098522008A6532 /* SelectionOverlayController.cpp */,
+                                51EF124D19098522008A6532 /* SelectionOverlayController.h */,
</ins><span class="cx">                                 519EF58F18EF77210003B7F4 /* TelephoneNumberOverlayController.cpp */,
</span><span class="cx">                                 519EF59018EF77210003B7F4 /* TelephoneNumberOverlayController.h */,
</span><span class="cx">                                 2D819B99186275B3001F03D1 /* ViewGestureGeometryCollector.cpp */,
</span><span class="lines">@@ -6071,6 +6079,7 @@
</span><span class="cx">                                 1AB16AE7164B3A8800290D62 /* RemoteLayerTreeContext.mm */,
</span><span class="cx">                                 1AB16ADC1648598400290D62 /* RemoteLayerTreeDrawingArea.h */,
</span><span class="cx">                                 1AB16ADB1648598400290D62 /* RemoteLayerTreeDrawingArea.mm */,
</span><ins>+                                51EF125019098531008A6532 /* SelectionOverlayControllerMac.mm */,
</ins><span class="cx">                                 519EF58D18EF770D0003B7F4 /* TelephoneNumberOverlayControllerMac.mm */,
</span><span class="cx">                                 1AAF263714687C39004A1E8A /* TiledCoreAnimationDrawingArea.h */,
</span><span class="cx">                                 1AAF263614687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm */,
</span><span class="lines">@@ -7346,6 +7355,7 @@
</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><ins>+                                51EF124F19098523008A6532 /* SelectionOverlayController.h in Headers */,
</ins><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">@@ -8447,6 +8457,7 @@
</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><ins>+                                51EF125119098531008A6532 /* SelectionOverlayControllerMac.mm in Sources */,
</ins><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">@@ -8589,6 +8600,7 @@
</span><span class="cx">                                 3336762F130C9998006C9DE2 /* WebResourceCacheManager.cpp in Sources */,
</span><span class="cx">                                 33F9D5B91312F1EE000D683F /* WebResourceCacheManagerCFNet.cpp in Sources */,
</span><span class="cx">                                 33367655130C9ECA006C9DE2 /* WebResourceCacheManagerMessageReceiver.cpp in Sources */,
</span><ins>+                                51EF124E19098522008A6532 /* SelectionOverlayController.cpp in Sources */,
</ins><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 (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -27,6 +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><ins>+#include &quot;SelectionOverlayController.h&quot;
</ins><span class="cx"> #include &quot;TelephoneNumberOverlayController.h&quot;
</span><span class="cx"> #include &quot;WebCoreArgumentCoders.h&quot;
</span><span class="cx"> #include &quot;WebFrame.h&quot;
</span><span class="lines">@@ -531,4 +532,11 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+void WebEditorClient::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects)
+{
+    m_page-&gt;selectionOverlayController().selectionRectsDidChange(rects);
+}
+#endif // ENABLE(SERVICE_CONTROLS)
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -170,6 +170,9 @@
</span><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><span class="cx">     virtual void selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;WebCore::Range&gt;&gt;&amp;) override;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+    virtual void selectionRectsDidChange(const Vector&lt;WebCore::LayoutRect&gt;&amp;) override;
+#endif
</ins><span class="cx"> 
</span><span class="cx">     WebPage* m_page;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageSelectionOverlayControllercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp (0 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.cpp        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -0,0 +1,118 @@
</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.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;SelectionOverlayController.h&quot;
+
+#if ENABLE(SERVICE_CONTROLS)
+
+#include &quot;WebPage.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)
+{
+}
+
+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_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
+    clearHighlight();
+
+    m_currentSelectionRects = rects;
+
+    if (m_currentSelectionRects.isEmpty())
+        destroyOverlay();
+    else
+        createOverlayIfNeeded();
+#else
+    UNUSED_PARAM(rects);
+#endif
+}
+
+#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)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageSelectionOverlayControllerh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h (0 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/SelectionOverlayController.h        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -0,0 +1,89 @@
</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 SelectionOverlayController_h
+
+#if ENABLE(SERVICE_CONTROLS)
+
+#include &quot;PageOverlay.h&quot;
+#include &quot;WebPage.h&quot;
+#include &lt;wtf/RefCounted.h&gt;
+
+#if PLATFORM(MAC)
+typedef void* DDHighlightRef;
+#endif
+
+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 clearHighlight();
+
+    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;
+
+#if PLATFORM(MAC)
+    RetainPtr&lt;DDHighlightRef&gt; m_currentHighlight;
+#endif
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_CONTROLS)
+#endif // SelectionOverlayController_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -49,6 +49,7 @@
</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><ins>+#include &quot;SelectionOverlayController.h&quot;
</ins><span class="cx"> #include &quot;SessionState.h&quot;
</span><span class="cx"> #include &quot;SessionTracker.h&quot;
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><span class="lines">@@ -4570,6 +4571,16 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+SelectionOverlayController&amp; WebPage::selectionOverlayController()
+{
+    if (!m_selectionOverlayController)
+        m_selectionOverlayController = SelectionOverlayController::create(this);
+
+    return *m_selectionOverlayController;
+}
+#endif
+
</ins><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 (167829 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-04-25 22:18:36 UTC (rev 167829)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -140,6 +140,7 @@
</span><span class="cx"> class PageBanner;
</span><span class="cx"> class PageOverlay;
</span><span class="cx"> class PluginView;
</span><ins>+class SelectionOverlayController;
</ins><span class="cx"> class SessionState;
</span><span class="cx"> class VisibleContentRectUpdateInfo;
</span><span class="cx"> class WebColorChooser;
</span><span class="lines">@@ -783,6 +784,9 @@
</span><span class="cx">     TelephoneNumberOverlayController&amp; telephoneNumberOverlayController();
</span><span class="cx">     void handleTelephoneNumberClick(const String&amp; number, const WebCore::IntPoint&amp;);
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+    SelectionOverlayController&amp; selectionOverlayController();
+#endif
</ins><span class="cx"> 
</span><span class="cx">     void didChangeScrollOffsetForFrame(WebCore::Frame*);
</span><span class="cx"> 
</span><span class="lines">@@ -1200,6 +1204,9 @@
</span><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><span class="cx">     RefPtr&lt;TelephoneNumberOverlayController&gt; m_telephoneNumberOverlayController;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(SERVICE_CONTROLS)
+    RefPtr&lt;SelectionOverlayController&gt; m_selectionOverlayController;
+#endif
</ins><span class="cx"> 
</span><span class="cx">     PageOverlayController m_pageOverlayController;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacSelectionOverlayControllerMacmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm (0 => 167830)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/SelectionOverlayControllerMac.mm        2014-04-25 22:22:14 UTC (rev 167830)
</span><span class="lines">@@ -0,0 +1,174 @@
</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;SelectionOverlayController.h&quot;
+
+#if ENABLE(SERVICE_CONTROLS)
+
+#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 {
+
+void SelectionOverlayController::drawRect(PageOverlay* overlay, WebCore::GraphicsContext&amp; graphicsContext, const WebCore::IntRect&amp; dirtyRect)
+{
+    if (m_currentSelectionRects.isEmpty())
+        return;
+
+    if (!m_currentHighlight) {
+        Vector&lt;CGRect&gt; cgRects;
+        cgRects.reserveCapacity(m_currentSelectionRects.size());
+
+        for (auto&amp; rect : m_currentSelectionRects)
+            cgRects.append((CGRect)pixelSnappedIntRect(rect));
+
+        m_currentHighlight = adoptCF(DDHighlightCreateWithRectsInVisibleRect(nullptr, cgRects.begin(), cgRects.size(), (CGRect)dirtyRect, true));
+
+        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 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();
+
+    // 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)
+{
+    // FIXME: Handle the click here.
+}
+    
+void SelectionOverlayController::clearHighlight()
+{
+    m_currentHighlight.clear();
+    m_mouseIsOverHighlight = false;
+}
+    
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_CONTROLS)
+
</ins></span></pre>
</div>
</div>

</body>
</html>