<!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>[175597] 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/175597">175597</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-11-04 17:39:47 -0800 (Tue, 04 Nov 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add bundle SPI allowing PageOverlay to customize the action menu
https://bugs.webkit.org/show_bug.cgi?id=138388
<rdar://problem/18875579>
Reviewed by Anders Carlsson.
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
Bump the BundlePageOverlay client version.
(WKBundlePageOverlayCreate):
(WKBundlePageOverlaySetAccessibilityClient):
Don't return if we have a version; the version check happens later anyway,
and now it is valid to have a version >0.
* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h:
Bump the BundlePageOverlay client version.
Add prepareForActionMenu callback.
* WebProcess/WebPage/WebPageOverlay.h:
(WebKit::WebPageOverlay::Client::prepareForActionMenu):
* WebProcess/WebPage/WebPageOverlay.cpp:
(WebKit::overlayMap):
(WebKit::WebPageOverlay::WebPageOverlay):
(WebKit::WebPageOverlay::~WebPageOverlay):
(WebKit::WebPageOverlay::fromCoreOverlay):
(WebKit::WebPageOverlay::pageOverlayDestroyed):
Keep track of a map of PageOverlay to WebPageOverlay.
(WebKit::WebPageOverlay::prepareForActionMenu):
Forward prepareForActionMenu to the client.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performActionMenuHitTestAtLocation):
Iterate through the overlays and let them prepareForActionMenu;
the first overlay that returns true wins. If no overlays want to
do anything, hand preparation along to the context menu client.
* page/PageOverlayController.h:
Expose the list of all overlays.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagePageOverlayControllerh">trunk/Source/WebCore/page/PageOverlayController.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageOverlaycpp">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageOverlayh">trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageOverlaycpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageOverlayh">trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebCore/ChangeLog        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-11-04 Tim Horton <timothy_horton@apple.com>
+
+ Add bundle SPI allowing PageOverlay to customize the action menu
+ https://bugs.webkit.org/show_bug.cgi?id=138388
+ <rdar://problem/18875579>
+
+ Reviewed by Anders Carlsson.
+
+ * page/PageOverlayController.h:
+ Expose the list of all overlays.
+
</ins><span class="cx"> 2014-11-03 Jeremy Jones <jeremyj@apple.com>
</span><span class="cx">
</span><span class="cx"> Add button and enable optimized fullscreen.
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageOverlayControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageOverlayController.h (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageOverlayController.h        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebCore/page/PageOverlayController.h        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -49,6 +49,8 @@
</span><span class="cx"> GraphicsLayer& documentOverlayRootLayer();
</span><span class="cx"> GraphicsLayer& viewOverlayRootLayer();
</span><span class="cx">
</span><ins>+ const Vector<RefPtr<PageOverlay>>& pageOverlays() const { return m_pageOverlays; }
+
</ins><span class="cx"> void installPageOverlay(PassRefPtr<PageOverlay>, PageOverlay::FadeMode);
</span><span class="cx"> void uninstallPageOverlay(PageOverlay*, PageOverlay::FadeMode);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebKit2/ChangeLog        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2014-11-04 Tim Horton <timothy_horton@apple.com>
+
+ Add bundle SPI allowing PageOverlay to customize the action menu
+ https://bugs.webkit.org/show_bug.cgi?id=138388
+ <rdar://problem/18875579>
+
+ Reviewed by Anders Carlsson.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
+ Bump the BundlePageOverlay client version.
+
+ (WKBundlePageOverlayCreate):
+ (WKBundlePageOverlaySetAccessibilityClient):
+ Don't return if we have a version; the version check happens later anyway,
+ and now it is valid to have a version >0.
+
+ * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h:
+ Bump the BundlePageOverlay client version.
+ Add prepareForActionMenu callback.
+
+ * WebProcess/WebPage/WebPageOverlay.h:
+ (WebKit::WebPageOverlay::Client::prepareForActionMenu):
+ * WebProcess/WebPage/WebPageOverlay.cpp:
+ (WebKit::overlayMap):
+ (WebKit::WebPageOverlay::WebPageOverlay):
+ (WebKit::WebPageOverlay::~WebPageOverlay):
+ (WebKit::WebPageOverlay::fromCoreOverlay):
+ (WebKit::WebPageOverlay::pageOverlayDestroyed):
+ Keep track of a map of PageOverlay to WebPageOverlay.
+
+ (WebKit::WebPageOverlay::prepareForActionMenu):
+ Forward prepareForActionMenu to the client.
+
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performActionMenuHitTestAtLocation):
+ Iterate through the overlays and let them prepareForActionMenu;
+ the first overlay that returns true wins. If no overlays want to
+ do anything, hand preparation along to the context menu client.
+
</ins><span class="cx"> 2014-11-03 Jeremy Jones <jeremyj@apple.com>
</span><span class="cx">
</span><span class="cx"> Add button and enable optimized fullscreen.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> namespace API {
</span><span class="cx">
</span><span class="cx"> template<> struct ClientTraits<WKBundlePageOverlayClientBase> {
</span><del>- typedef std::tuple<WKBundlePageOverlayClientV0> Versions;
</del><ins>+ typedef std::tuple<WKBundlePageOverlayClientV0, WKBundlePageOverlayClientV1> Versions;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> template<> struct ClientTraits<WKBundlePageOverlayAccessibilityClientBase> {
</span><span class="lines">@@ -131,6 +131,20 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><ins>+
+ virtual bool prepareForActionMenu(WebPageOverlay& pageOverlay, RefPtr<API::Object>& userData) override
+ {
+ if (!m_client.prepareForActionMenu)
+ return false;
+
+ WKTypeRef userDataToPass = nullptr;
+ if (m_client.prepareForActionMenu(toAPI(&pageOverlay), &userDataToPass, m_client.base.clientInfo)) {
+ userData = adoptRef(toImpl(userDataToPass));
+ return true;
+ }
+
+ return false;
+ }
</ins><span class="cx">
</span><span class="cx"> virtual bool copyAccessibilityAttributeStringValueForPoint(WebPageOverlay& pageOverlay, String attribute, WebCore::FloatPoint parameter, String& value) override
</span><span class="cx"> {
</span><span class="lines">@@ -181,9 +195,6 @@
</span><span class="cx">
</span><span class="cx"> WKBundlePageOverlayRef WKBundlePageOverlayCreate(WKBundlePageOverlayClientBase* wkClient)
</span><span class="cx"> {
</span><del>- if (wkClient && wkClient->version)
- return nullptr;
-
</del><span class="cx"> auto clientImpl = std::make_unique<PageOverlayClientImpl>(wkClient);
</span><span class="cx">
</span><span class="cx"> // FIXME: Looks like this leaks the clientImpl.
</span><span class="lines">@@ -192,8 +203,6 @@
</span><span class="cx">
</span><span class="cx"> void WKBundlePageOverlaySetAccessibilityClient(WKBundlePageOverlayRef bundlePageOverlayRef, WKBundlePageOverlayAccessibilityClientBase* client)
</span><span class="cx"> {
</span><del>- if (client && client->version)
- return;
</del><span class="cx"> static_cast<PageOverlayClientImpl&>(toImpl(bundlePageOverlayRef)->client()).setAccessibilityClient(client);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageOverlayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.h        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> typedef bool (*WKBundlePageOverlayMouseUpCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo);
</span><span class="cx"> typedef bool (*WKBundlePageOverlayMouseMovedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, const void* clientInfo);
</span><span class="cx"> typedef bool (*WKBundlePageOverlayMouseDraggedCallback)(WKBundlePageOverlayRef pageOverlay, WKPoint position, WKEventMouseButton mouseButton, const void* clientInfo);
</span><ins>+typedef bool (*WKBundlePageOverlayPrepareForActionMenuCallback)(WKBundlePageOverlayRef pageOverlay, WKTypeRef* userData, const void* clientInfo);
</ins><span class="cx">
</span><span class="cx"> typedef struct WKBundlePageOverlayClientBase {
</span><span class="cx"> int version;
</span><span class="lines">@@ -57,7 +58,6 @@
</span><span class="cx"> typedef struct WKBundlePageOverlayClientV0 {
</span><span class="cx"> WKBundlePageOverlayClientBase base;
</span><span class="cx">
</span><del>- // Version 0.
</del><span class="cx"> WKBundlePageOverlayWillMoveToPageCallback willMoveToPage;
</span><span class="cx"> WKBundlePageOverlayDidMoveToPageCallback didMoveToPage;
</span><span class="cx"> WKBundlePageOverlayDrawRectCallback drawRect;
</span><span class="lines">@@ -67,12 +67,25 @@
</span><span class="cx"> WKBundlePageOverlayMouseDraggedCallback mouseDragged;
</span><span class="cx"> } WKBundlePageOverlayClientV0;
</span><span class="cx">
</span><ins>+typedef struct WKBundlePageOverlayClientV1 {
+ WKBundlePageOverlayClientBase base;
+
+ WKBundlePageOverlayWillMoveToPageCallback willMoveToPage;
+ WKBundlePageOverlayDidMoveToPageCallback didMoveToPage;
+ WKBundlePageOverlayDrawRectCallback drawRect;
+ WKBundlePageOverlayMouseDownCallback mouseDown;
+ WKBundlePageOverlayMouseUpCallback mouseUp;
+ WKBundlePageOverlayMouseMovedCallback mouseMoved;
+ WKBundlePageOverlayMouseDraggedCallback mouseDragged;
+
+ WKBundlePageOverlayPrepareForActionMenuCallback prepareForActionMenu;
+} WKBundlePageOverlayClientV1;
+
</ins><span class="cx"> enum { kWKBundlePageOverlayClientCurrentVersion WK_ENUM_DEPRECATED("Use an explicit version number instead") = 0 };
</span><span class="cx"> typedef struct WKBundlePageOverlayClient {
</span><span class="cx"> int version;
</span><span class="cx"> const void * clientInfo;
</span><span class="cx">
</span><del>- // Version 0.
</del><span class="cx"> WKBundlePageOverlayWillMoveToPageCallback willMoveToPage;
</span><span class="cx"> WKBundlePageOverlayDidMoveToPageCallback didMoveToPage;
</span><span class="cx"> WKBundlePageOverlayDrawRectCallback drawRect;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.cpp        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -30,11 +30,18 @@
</span><span class="cx"> #include "WebPage.h"
</span><span class="cx"> #include <WebCore/GraphicsLayer.h>
</span><span class="cx"> #include <WebCore/PageOverlay.h>
</span><ins>+#include <wtf/NeverDestroyed.h>
</ins><span class="cx">
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><ins>+static HashMap<PageOverlay*, WebPageOverlay*>& overlayMap()
+{
+ static NeverDestroyed<HashMap<PageOverlay*, WebPageOverlay*>> map;
+ return map;
+}
+
</ins><span class="cx"> PassRefPtr<WebPageOverlay> WebPageOverlay::create(WebPageOverlay::Client& client, PageOverlay::OverlayType overlayType)
</span><span class="cx"> {
</span><span class="cx"> return adoptRef(new WebPageOverlay(client, overlayType));
</span><span class="lines">@@ -44,12 +51,23 @@
</span><span class="cx"> : m_overlay(PageOverlay::create(*this, overlayType))
</span><span class="cx"> , m_client(client)
</span><span class="cx"> {
</span><ins>+ overlayMap().add(m_overlay.get(), this);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebPageOverlay::~WebPageOverlay()
</span><span class="cx"> {
</span><ins>+ if (!m_overlay)
+ return;
+
+ overlayMap().remove(m_overlay.get());
+ m_overlay = nullptr;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+WebPageOverlay* WebPageOverlay::fromCoreOverlay(PageOverlay& overlay)
+{
+ return overlayMap().get(&overlay);
+}
+
</ins><span class="cx"> void WebPageOverlay::setNeedsDisplay(const IntRect& dirtyRect)
</span><span class="cx"> {
</span><span class="cx"> m_overlay->setNeedsDisplay(dirtyRect);
</span><span class="lines">@@ -67,6 +85,11 @@
</span><span class="cx">
</span><span class="cx"> void WebPageOverlay::pageOverlayDestroyed(PageOverlay&)
</span><span class="cx"> {
</span><ins>+ if (m_overlay) {
+ overlayMap().remove(m_overlay.get());
+ m_overlay = nullptr;
+ }
+
</ins><span class="cx"> m_client.pageOverlayDestroyed(*this);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -95,6 +118,11 @@
</span><span class="cx"> m_client.didScrollFrame(*this, WebFrame::fromCoreFrame(frame));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebPageOverlay::prepareForActionMenu(RefPtr<API::Object>& userData)
+{
+ return m_client.prepareForActionMenu(*this, userData);
+}
+
</ins><span class="cx"> bool WebPageOverlay::copyAccessibilityAttributeStringValueForPoint(PageOverlay&, String attribute, FloatPoint parameter, String& value)
</span><span class="cx"> {
</span><span class="cx"> return m_client.copyAccessibilityAttributeStringValueForPoint(*this, attribute, parameter, value);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageOverlayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPageOverlay.h        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> virtual void drawRect(WebPageOverlay&, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) = 0;
</span><span class="cx"> virtual bool mouseEvent(WebPageOverlay&, const WebCore::PlatformMouseEvent&) = 0;
</span><span class="cx"> virtual void didScrollFrame(WebPageOverlay&, WebFrame*) { }
</span><ins>+ virtual bool prepareForActionMenu(WebPageOverlay&, RefPtr<API::Object>& userData) { return false; }
</ins><span class="cx">
</span><span class="cx"> virtual bool copyAccessibilityAttributeStringValueForPoint(WebPageOverlay&, String /* attribute */, WebCore::FloatPoint /* parameter */, String& /* value */) { return false; }
</span><span class="cx"> virtual bool copyAccessibilityAttributeBoolValueForPoint(WebPageOverlay&, String /* attribute */, WebCore::FloatPoint /* parameter */, bool& /* value */) { return false; }
</span><span class="lines">@@ -57,6 +58,7 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> static PassRefPtr<WebPageOverlay> create(Client&, WebCore::PageOverlay::OverlayType = WebCore::PageOverlay::OverlayType::View);
</span><ins>+ static WebPageOverlay* fromCoreOverlay(WebCore::PageOverlay&);
</ins><span class="cx"> virtual ~WebPageOverlay();
</span><span class="cx">
</span><span class="cx"> void setNeedsDisplay(const WebCore::IntRect& dirtyRect);
</span><span class="lines">@@ -67,6 +69,8 @@
</span><span class="cx"> WebCore::PageOverlay* coreOverlay() const { return m_overlay.get(); }
</span><span class="cx"> Client& client() const { return m_client; }
</span><span class="cx">
</span><ins>+ bool prepareForActionMenu(RefPtr<API::Object>& userData);
+
</ins><span class="cx"> private:
</span><span class="cx"> WebPageOverlay(Client&, WebCore::PageOverlay::OverlayType);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (175596 => 175597)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-11-05 01:36:42 UTC (rev 175596)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-11-05 01:39:47 UTC (rev 175597)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> #import "WebFrame.h"
</span><span class="cx"> #import "WebImage.h"
</span><span class="cx"> #import "WebInspector.h"
</span><ins>+#import "WebPageOverlay.h"
</ins><span class="cx"> #import "WebPageProxyMessages.h"
</span><span class="cx"> #import "WebPasteboardOverrides.h"
</span><span class="cx"> #import "WebPreferencesStore.h"
</span><span class="lines">@@ -68,6 +69,7 @@
</span><span class="cx"> #import <WebCore/MainFrame.h>
</span><span class="cx"> #import <WebCore/NetworkingContext.h>
</span><span class="cx"> #import <WebCore/Page.h>
</span><ins>+#import <WebCore/PageOverlayController.h>
</ins><span class="cx"> #import <WebCore/PlatformKeyboardEvent.h>
</span><span class="cx"> #import <WebCore/PluginDocument.h>
</span><span class="cx"> #import <WebCore/RenderElement.h>
</span><span class="lines">@@ -1198,9 +1200,23 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> RefPtr<API::Object> userData;
</span><del>- RefPtr<InjectedBundleHitTestResult> injectedBundleHitTestResult = InjectedBundleHitTestResult::create(hitTestResult);
- injectedBundleContextMenuClient().prepareForActionMenu(this, injectedBundleHitTestResult.get(), userData);
</del><span class="cx">
</span><ins>+ bool handled = false;
+ for (const auto& overlay : mainFrame.pageOverlayController().pageOverlays()) {
+ WebPageOverlay* webOverlay = WebPageOverlay::fromCoreOverlay(*overlay);
+ if (!webOverlay)
+ continue;
+ if (webOverlay->prepareForActionMenu(userData)) {
+ handled = true;
+ break;
+ }
+ }
+
+ if (!handled) {
+ RefPtr<InjectedBundleHitTestResult> injectedBundleHitTestResult = InjectedBundleHitTestResult::create(hitTestResult);
+ injectedBundleContextMenuClient().prepareForActionMenu(this, injectedBundleHitTestResult.get(), userData);
+ }
+
</ins><span class="cx"> send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult, InjectedBundleUserMessageEncoder(userData.get())));
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>