<!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>[177148] 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/177148">177148</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-12-11 09:07:42 -0800 (Thu, 11 Dec 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Move click counter logic back to WebKitWebViewBase
https://bugs.webkit.org/show_bug.cgi?id=137685
Reviewed by Martin Robinson.
Source/WebCore:
Remove GtkClickCounter.
* PlatformGTK.cmake:
* platform/gtk/GtkClickCounter.cpp: Removed.
* platform/gtk/GtkClickCounter.h: Removed.
Source/WebKit2:
It was moved to a shared class in platform to be used by both
WebKit1 and WebKit2, but it's currently only used by WebKitWebViewBase.
* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(ClickCounter::reset):
(ClickCounter::currentClickCountForGdkButtonEvent):
(webkitWebViewBaseButtonPressEvent):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformgtkGtkClickCountercpp">trunk/Source/WebCore/platform/gtk/GtkClickCounter.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGtkClickCounterh">trunk/Source/WebCore/platform/gtk/GtkClickCounter.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (177147 => 177148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-11 17:02:46 UTC (rev 177147)
+++ trunk/Source/WebCore/ChangeLog        2014-12-11 17:07:42 UTC (rev 177148)
</span><span class="lines">@@ -1,5 +1,18 @@
</span><span class="cx"> 2014-12-11 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ [GTK] Move click counter logic back to WebKitWebViewBase
+ https://bugs.webkit.org/show_bug.cgi?id=137685
+
+ Reviewed by Martin Robinson.
+
+ Remove GtkClickCounter.
+
+ * PlatformGTK.cmake:
+ * platform/gtk/GtkClickCounter.cpp: Removed.
+ * platform/gtk/GtkClickCounter.h: Removed.
+
+2014-12-11 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> [GTK] Implement sizes attribute for link tag
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=125775
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (177147 => 177148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2014-12-11 17:02:46 UTC (rev 177147)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2014-12-11 17:07:42 UTC (rev 177148)
</span><span class="lines">@@ -223,7 +223,6 @@
</span><span class="cx"> platform/gtk/DragIcon.cpp
</span><span class="cx"> platform/gtk/DragImageGtk.cpp
</span><span class="cx"> platform/gtk/GRefPtrGtk.cpp
</span><del>- platform/gtk/GtkClickCounter.cpp
</del><span class="cx"> platform/gtk/GtkUtilities.cpp
</span><span class="cx"> platform/gtk/GtkVersioning.c
</span><span class="cx"> platform/gtk/KeyBindingTranslator.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGtkClickCountercpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/GtkClickCounter.cpp (177147 => 177148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GtkClickCounter.cpp        2014-12-11 17:02:46 UTC (rev 177147)
+++ trunk/Source/WebCore/platform/gtk/GtkClickCounter.cpp        2014-12-11 17:07:42 UTC (rev 177148)
</span><span class="lines">@@ -1,105 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "GtkClickCounter.h"
-
-#include "GUniquePtrGtk.h"
-#include <gtk/gtk.h>
-
-namespace WebCore {
-
-GtkClickCounter::GtkClickCounter()
- : m_currentClickCount(0)
- , m_previousClickButton(0)
- , m_previousClickTime(0)
-{
-}
-
-void GtkClickCounter::reset()
-{
- m_currentClickCount = 0;
- m_previousClickPoint = IntPoint();
- m_previousClickTime = 0;
- m_previousClickButton = 0;
-}
-
-bool GtkClickCounter::shouldProcessButtonEvent(GdkEventButton*)
-{
- // For double and triple clicks GDK sends both a normal button press event
- // and a specific type (like GDK_2BUTTON_PRESS). If we detect a special press
- // coming up, ignore this event as it certainly generated the double or triple
- // click. The consequence of not eating this event is two DOM button press events
- // are generated.
- GUniquePtr<GdkEvent> nextEvent(gdk_event_peek());
- if (!nextEvent)
- return true;
- if (nextEvent->any.type == GDK_2BUTTON_PRESS || nextEvent->any.type == GDK_3BUTTON_PRESS)
- return false;
- return true;
-}
-
-static guint32 getEventTime(GdkEvent* event)
-{
- guint32 time = gdk_event_get_time(event);
- if (time)
- return time;
-
- // Real events always have a non-zero time, but events synthesized
- // by the DRT do not and we must calculate a time manually. This time
- // is not calculated in the DRT, because GTK+ does not work well with
- // anything other than GDK_CURRENT_TIME on synthesized events.
- GTimeVal timeValue;
- g_get_current_time(&timeValue);
- return (timeValue.tv_sec * 1000) + (timeValue.tv_usec / 1000);
-}
-
-int GtkClickCounter::clickCountForGdkButtonEvent(GtkWidget* widget, GdkEventButton* buttonEvent)
-{
- gint doubleClickDistance = 250;
- gint doubleClickTime = 5;
- GtkSettings* settings = gtk_settings_get_for_screen(gtk_widget_get_screen(widget));
- g_object_get(settings,
- "gtk-double-click-distance", &doubleClickDistance,
- "gtk-double-click-time", &doubleClickTime, NULL);
-
- // GTK+ only counts up to triple clicks, but WebCore wants to know about
- // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the
- // GDK logic for counting clicks.
- GdkEvent* event(reinterpret_cast<GdkEvent*>(buttonEvent));
- guint32 eventTime = getEventTime(event);
-
- if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
- || ((abs(buttonEvent->x - m_previousClickPoint.x()) < doubleClickDistance)
- && (abs(buttonEvent->y - m_previousClickPoint.y()) < doubleClickDistance)
- && (eventTime - m_previousClickTime < static_cast<guint>(doubleClickTime))
- && (buttonEvent->button == m_previousClickButton)))
- m_currentClickCount++;
- else
- m_currentClickCount = 1;
-
- gdouble x, y;
- gdk_event_get_coords(event, &x, &y);
- m_previousClickPoint = IntPoint(x, y);
- m_previousClickButton = buttonEvent->button;
- m_previousClickTime = eventTime;
-
- return m_currentClickCount;
-}
-
-} // namespace WebCore
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGtkClickCounterh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/gtk/GtkClickCounter.h (177147 => 177148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GtkClickCounter.h        2014-12-11 17:02:46 UTC (rev 177147)
+++ trunk/Source/WebCore/platform/gtk/GtkClickCounter.h        2014-12-11 17:07:42 UTC (rev 177148)
</span><span class="lines">@@ -1,45 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010, 2011 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef GtkClickCounter_h
-#define GtkClickCounter_h
-
-#include "IntPoint.h"
-
-typedef struct _GdkEventButton GdkEventButton;
-
-namespace WebCore {
-
-class GtkClickCounter {
-public:
- GtkClickCounter();
- void reset();
- bool shouldProcessButtonEvent(GdkEventButton*);
- int clickCountForGdkButtonEvent(GtkWidget*, GdkEventButton*);
-
-private:
- int m_currentClickCount;
- IntPoint m_previousClickPoint;
- unsigned int m_previousClickButton;
- int m_previousClickTime;
-};
-
-} // namespace WebCore
-
-#endif
-
</del></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177147 => 177148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-11 17:02:46 UTC (rev 177147)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-11 17:07:42 UTC (rev 177148)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-12-11 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Move click counter logic back to WebKitWebViewBase
+ https://bugs.webkit.org/show_bug.cgi?id=137685
+
+ Reviewed by Martin Robinson.
+
+ It was moved to a shared class in platform to be used by both
+ WebKit1 and WebKit2, but it's currently only used by WebKitWebViewBase.
+
+ * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+ (ClickCounter::reset):
+ (ClickCounter::currentClickCountForGdkButtonEvent):
+ (webkitWebViewBaseButtonPressEvent):
+
</ins><span class="cx"> 2014-12-11 Carlos Alberto Lopez Perez <clopez@igalia.com>
</span><span class="cx">
</span><span class="cx"> [SOUP] [GTK] warning: unused parameter at NetworkProcessSoup.cpp after r177056.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (177147 => 177148)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-12-11 17:02:46 UTC (rev 177147)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2014-12-11 17:07:42 UTC (rev 177148)
</span><span class="lines">@@ -50,7 +50,6 @@
</span><span class="cx"> #include "WebUserContentControllerProxy.h"
</span><span class="cx"> #include <WebCore/CairoUtilities.h>
</span><span class="cx"> #include <WebCore/GUniquePtrGtk.h>
</span><del>-#include <WebCore/GtkClickCounter.h>
</del><span class="cx"> #include <WebCore/GtkUtilities.h>
</span><span class="cx"> #include <WebCore/GtkVersioning.h>
</span><span class="cx"> #include <WebCore/NotImplemented.h>
</span><span class="lines">@@ -78,6 +77,63 @@
</span><span class="cx"> using namespace WebKit;
</span><span class="cx"> using namespace WebCore;
</span><span class="cx">
</span><ins>+struct ClickCounter {
+public:
+ void reset()
+ {
+ currentClickCount = 0;
+ previousClickPoint = IntPoint();
+ previousClickTime = 0;
+ previousClickButton = 0;
+ }
+
+ int currentClickCountForGdkButtonEvent(GdkEventButton* buttonEvent)
+ {
+ GdkEvent* event = reinterpret_cast<GdkEvent*>(buttonEvent);
+ int doubleClickDistance = 250;
+ int doubleClickTime = 5;
+ g_object_get(gtk_settings_get_for_screen(gdk_event_get_screen(event)),
+ "gtk-double-click-distance", &doubleClickDistance, "gtk-double-click-time", &doubleClickTime, nullptr);
+
+ // GTK+ only counts up to triple clicks, but WebCore wants to know about
+ // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the
+ // GDK logic for counting clicks.
+ guint32 eventTime = gdk_event_get_time(event);
+ if (!eventTime) {
+ // Real events always have a non-zero time, but events synthesized
+ // by the WTR do not and we must calculate a time manually. This time
+ // is not calculated in the WTR, because GTK+ does not work well with
+ // anything other than GDK_CURRENT_TIME on synthesized events.
+ GTimeVal timeValue;
+ g_get_current_time(&timeValue);
+ eventTime = (timeValue.tv_sec * 1000) + (timeValue.tv_usec / 1000);
+ }
+
+ if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
+ || ((abs(buttonEvent->x - previousClickPoint.x()) < doubleClickDistance)
+ && (abs(buttonEvent->y - previousClickPoint.y()) < doubleClickDistance)
+ && (eventTime - previousClickTime < static_cast<unsigned>(doubleClickTime))
+ && (buttonEvent->button == previousClickButton)))
+ currentClickCount++;
+ else
+ currentClickCount = 1;
+
+ double x, y;
+ gdk_event_get_coords(event, &x, &y);
+ previousClickPoint = IntPoint(x, y);
+ previousClickButton = buttonEvent->button;
+ previousClickTime = eventTime;
+
+ return currentClickCount;
+ }
+
+private:
+ int currentClickCount;
+ IntPoint previousClickPoint;
+ unsigned previousClickButton;
+ int previousClickTime;
+};
+
</ins><span class="cx"> typedef HashMap<GtkWidget*, IntRect> WebKitWebViewChildrenMap;
</span><span class="cx"> typedef HashMap<uint32_t, GUniquePtr<GdkEvent>> TouchEventsMap;
</span><span class="cx">
</span><span class="lines">@@ -86,7 +142,7 @@
</span><span class="cx"> std::unique_ptr<PageClientImpl> pageClient;
</span><span class="cx"> RefPtr<WebPageProxy> pageProxy;
</span><span class="cx"> bool shouldForwardNextKeyEvent;
</span><del>- GtkClickCounter clickCounter;
</del><ins>+ ClickCounter clickCounter;
</ins><span class="cx"> CString tooltipText;
</span><span class="cx"> IntRect tooltipArea;
</span><span class="cx"> #if !GTK_CHECK_VERSION(3, 13, 4)
</span><span class="lines">@@ -702,14 +758,21 @@
</span><span class="cx">
</span><span class="cx"> priv->inputMethodFilter.notifyMouseButtonPress();
</span><span class="cx">
</span><del>- if (!priv->clickCounter.shouldProcessButtonEvent(buttonEvent))
</del><ins>+ // For double and triple clicks GDK sends both a normal button press event
+ // and a specific type (like GDK_2BUTTON_PRESS). If we detect a special press
+ // coming up, ignore this event as it certainly generated the double or triple
+ // click. The consequence of not eating this event is two DOM button press events
+ // are generated.
+ GUniquePtr<GdkEvent> nextEvent(gdk_event_peek());
+ if (nextEvent && (nextEvent->any.type == GDK_2BUTTON_PRESS || nextEvent->any.type == GDK_3BUTTON_PRESS))
</ins><span class="cx"> return TRUE;
</span><span class="cx">
</span><span class="cx"> // If it's a right click event save it as a possible context menu event.
</span><span class="cx"> if (buttonEvent->button == 3)
</span><span class="cx"> priv->contextMenuEvent.reset(gdk_event_copy(reinterpret_cast<GdkEvent*>(buttonEvent)));
</span><ins>+
</ins><span class="cx"> priv->pageProxy->handleMouseEvent(NativeWebMouseEvent(reinterpret_cast<GdkEvent*>(buttonEvent),
</span><del>- priv->clickCounter.clickCountForGdkButtonEvent(widget, buttonEvent)));
</del><ins>+ priv->clickCounter.currentClickCountForGdkButtonEvent(buttonEvent)));
</ins><span class="cx"> return TRUE;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>