<!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>[160059] trunk/Source/WebKit2</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/160059">160059</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2013-12-03 16:36:00 -0800 (Tue, 03 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>PageOverlayClientImpl should be a proper API::Client
https://bugs.webkit.org/show_bug.cgi?id=125199

Reviewed by Tim Horton.

* WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
(PageOverlayClientImpl::PageOverlayClientImpl):
(PageOverlayClientImpl::setAccessibilityClient):
(PageOverlayClientImpl::willMoveToWebPage):
(PageOverlayClientImpl::didMoveToWebPage):
(PageOverlayClientImpl::drawRect):
(PageOverlayClientImpl::mouseEvent):
(PageOverlayClientImpl::copyAccessibilityAttributeValue):
(PageOverlayClientImpl::copyAccessibilityAttributeNames):
(WKBundlePageOverlayCreate):
(WKBundlePageOverlaySetAccessibilityClient):</pre>

<h3>Modified Paths</h3>
<ul>
<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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (160058 => 160059)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2013-12-04 00:19:12 UTC (rev 160058)
+++ trunk/Source/WebKit2/ChangeLog        2013-12-04 00:36:00 UTC (rev 160059)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2013-12-03  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        PageOverlayClientImpl should be a proper API::Client
+        https://bugs.webkit.org/show_bug.cgi?id=125199
+
+        Reviewed by Tim Horton.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp:
+        (PageOverlayClientImpl::PageOverlayClientImpl):
+        (PageOverlayClientImpl::setAccessibilityClient):
+        (PageOverlayClientImpl::willMoveToWebPage):
+        (PageOverlayClientImpl::didMoveToWebPage):
+        (PageOverlayClientImpl::drawRect):
+        (PageOverlayClientImpl::mouseEvent):
+        (PageOverlayClientImpl::copyAccessibilityAttributeValue):
+        (PageOverlayClientImpl::copyAccessibilityAttributeNames):
+        (WKBundlePageOverlayCreate):
+        (WKBundlePageOverlaySetAccessibilityClient):
+
+2013-12-03  Anders Carlsson  &lt;andersca@apple.com&gt;
+
</ins><span class="cx">         Initialize the PageBannerClientImpl API::Client
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=125198
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessInjectedBundleAPIcWKBundlePageOverlaycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp (160058 => 160059)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp        2013-12-04 00:19:12 UTC (rev 160058)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePageOverlay.cpp        2013-12-04 00:36:00 UTC (rev 160059)
</span><span class="lines">@@ -26,28 +26,37 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WKBundlePageOverlay.h&quot;
</span><span class="cx"> 
</span><ins>+#include &quot;APIClient.h&quot;
</ins><span class="cx"> #include &quot;PageOverlay.h&quot;
</span><span class="cx"> #include &quot;WKAPICast.h&quot;
</span><span class="cx"> #include &quot;WKBundleAPICast.h&quot;
</span><span class="cx"> #include &lt;WebCore/GraphicsContext.h&gt;
</span><span class="cx"> 
</span><ins>+namespace API {
+
+template&lt;&gt; struct ClientTraits&lt;WKBundlePageOverlayClientBase&gt; {
+    typedef std::tuple&lt;WKBundlePageOverlayClientV0&gt; Versions;
+};
+
+template&lt;&gt; struct ClientTraits&lt;WKBundlePageOverlayAccessibilityClientBase&gt; {
+    typedef std::tuple&lt;WKBundlePageOverlayAccessibilityClientV0&gt; Versions;
+};
+
+}
+
</ins><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> 
</span><del>-class PageOverlayClientImpl : public PageOverlay::Client {
</del><ins>+class PageOverlayClientImpl : API::Client&lt;WKBundlePageOverlayClientBase&gt;, public PageOverlay::Client {
</ins><span class="cx"> public:
</span><del>-    explicit PageOverlayClientImpl(WKBundlePageOverlayClient* client)
-        : m_client()
-        , m_accessibilityClient()
</del><ins>+    explicit PageOverlayClientImpl(WKBundlePageOverlayClientBase* client)
</ins><span class="cx">     {
</span><del>-        if (client)
-            m_client = *client;
</del><ins>+        initialize(client);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    virtual void setAccessibilityClient(WKBundlePageOverlayAccessibilityClient* client)
</del><ins>+    virtual void setAccessibilityClient(WKBundlePageOverlayAccessibilityClientBase* client)
</ins><span class="cx">     {
</span><del>-        if (client)
-            m_accessibilityClient = *client;
</del><ins>+        m_accessibilityClient.initialize(client);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -62,7 +71,7 @@
</span><span class="cx">         if (!m_client.willMoveToPage)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        m_client.willMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.clientInfo);
</del><ins>+        m_client.willMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.base.clientInfo);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     virtual void didMoveToWebPage(PageOverlay* pageOverlay, WebPage* page)
</span><span class="lines">@@ -70,7 +79,7 @@
</span><span class="cx">         if (!m_client.didMoveToPage)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        m_client.didMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.clientInfo);
</del><ins>+        m_client.didMoveToPage(toAPI(pageOverlay), toAPI(page), m_client.base.clientInfo);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual void drawRect(PageOverlay* pageOverlay, GraphicsContext&amp; graphicsContext, const IntRect&amp; dirtyRect)
</span><span class="lines">@@ -78,7 +87,7 @@
</span><span class="cx">         if (!m_client.drawRect)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        m_client.drawRect(toAPI(pageOverlay), graphicsContext.platformContext(), toAPI(dirtyRect), m_client.clientInfo);
</del><ins>+        m_client.drawRect(toAPI(pageOverlay), graphicsContext.platformContext(), toAPI(dirtyRect), m_client.base.clientInfo);
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     virtual bool mouseEvent(PageOverlay* pageOverlay, const WebMouseEvent&amp; event)
</span><span class="lines">@@ -88,27 +97,27 @@
</span><span class="cx">             if (!m_client.mouseDown)
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-            return m_client.mouseDown(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.clientInfo);
</del><ins>+            return m_client.mouseDown(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo);
</ins><span class="cx">         }
</span><span class="cx">         case WebEvent::MouseUp: {
</span><span class="cx">             if (!m_client.mouseUp)
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-            return m_client.mouseUp(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.clientInfo);
</del><ins>+            return m_client.mouseUp(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo);
</ins><span class="cx">         }
</span><span class="cx">         case WebEvent::MouseMove: {
</span><span class="cx">             if (event.button() == WebMouseEvent::NoButton) {
</span><span class="cx">                 if (!m_client.mouseMoved)
</span><span class="cx">                     return false;
</span><span class="cx"> 
</span><del>-                return m_client.mouseMoved(toAPI(pageOverlay), toAPI(event.position()), m_client.clientInfo);
</del><ins>+                return m_client.mouseMoved(toAPI(pageOverlay), toAPI(event.position()), m_client.base.clientInfo);
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             // This is a MouseMove event with a mouse button pressed. Call mouseDragged.
</span><span class="cx">             if (!m_client.mouseDragged)
</span><span class="cx">                 return false;
</span><span class="cx"> 
</span><del>-            return m_client.mouseDragged(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.clientInfo);
</del><ins>+            return m_client.mouseDragged(toAPI(pageOverlay), toAPI(event.position()), toAPI(event.button()), m_client.base.clientInfo);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         default:
</span><span class="lines">@@ -118,20 +127,19 @@
</span><span class="cx">     
</span><span class="cx">     virtual WKTypeRef copyAccessibilityAttributeValue(PageOverlay* pageOverlay, WKStringRef attribute, WKTypeRef parameter)
</span><span class="cx">     {
</span><del>-        if (!m_accessibilityClient.copyAccessibilityAttributeValue)
</del><ins>+        if (!m_accessibilityClient.client().copyAccessibilityAttributeValue)
</ins><span class="cx">             return 0;
</span><del>-        return m_accessibilityClient.copyAccessibilityAttributeValue(toAPI(pageOverlay), attribute, parameter, m_client.clientInfo);
</del><ins>+        return m_accessibilityClient.client().copyAccessibilityAttributeValue(toAPI(pageOverlay), attribute, parameter, m_accessibilityClient.client().base.clientInfo);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     virtual WKArrayRef copyAccessibilityAttributeNames(PageOverlay* pageOverlay, bool paramerizedNames)
</span><span class="cx">     {
</span><del>-        if (!m_accessibilityClient.copyAccessibilityAttributeNames)
</del><ins>+        if (!m_accessibilityClient.client().copyAccessibilityAttributeNames)
</ins><span class="cx">             return 0;
</span><del>-        return m_accessibilityClient.copyAccessibilityAttributeNames(toAPI(pageOverlay), paramerizedNames, m_client.clientInfo);
</del><ins>+        return m_accessibilityClient.client().copyAccessibilityAttributeNames(toAPI(pageOverlay), paramerizedNames, m_accessibilityClient.client().base.clientInfo);
</ins><span class="cx">     }
</span><span class="cx">     
</span><del>-    WKBundlePageOverlayClient m_client;
-    WKBundlePageOverlayAccessibilityClient m_accessibilityClient;
</del><ins>+    API::Client&lt;WKBundlePageOverlayAccessibilityClientBase&gt; m_accessibilityClient;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WKTypeID WKBundlePageOverlayGetTypeID()
</span><span class="lines">@@ -144,7 +152,7 @@
</span><span class="cx">     if (wkClient &amp;&amp; wkClient-&gt;version)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span><del>-    auto clientImpl = std::make_unique&lt;PageOverlayClientImpl&gt;(wkClient);
</del><ins>+    auto clientImpl = std::make_unique&lt;PageOverlayClientImpl&gt;(reinterpret_cast&lt;WKBundlePageOverlayClientBase*&gt;(wkClient));
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: Looks like this leaks the clientImpl.
</span><span class="cx">     return toAPI(PageOverlay::create(clientImpl.release()).leakRef());
</span><span class="lines">@@ -154,7 +162,7 @@
</span><span class="cx"> {
</span><span class="cx">     if (client &amp;&amp; client-&gt;version)
</span><span class="cx">         return;
</span><del>-    static_cast&lt;PageOverlayClientImpl*&gt;(toImpl(bundlePageOverlayRef)-&gt;client())-&gt;setAccessibilityClient(client);
</del><ins>+    static_cast&lt;PageOverlayClientImpl*&gt;(toImpl(bundlePageOverlayRef)-&gt;client())-&gt;setAccessibilityClient(reinterpret_cast&lt;WKBundlePageOverlayAccessibilityClientBase*&gt;(client));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WKBundlePageOverlaySetNeedsDisplay(WKBundlePageOverlayRef bundlePageOverlayRef, WKRect rect)
</span></span></pre>
</div>
</div>

</body>
</html>