Changeset 61288 in webkit


Ignore:
Timestamp:
Jun 16, 2010 3:26:35 PM (14 years ago)
Author:
Martin Robinson
Message:

2010-06-16 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] Remove the abuse of GDK_CURRENT_TIME in the DRT
https://bugs.webkit.org/show_bug.cgi?id=40600

  • platform/gtk/Skipped: This change exposed some failures which were previously not reported. Skip them.

2010-06-16 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] Remove the abuse of GDK_CURRENT_TIME in the DRT
https://bugs.webkit.org/show_bug.cgi?id=40600

  • WebCoreSupport/DragClientGtk.cpp: (WebKit::DragClient::startDrag): Reset the click count after a drag starts.
  • WebCoreSupport/FrameLoaderClientGtk.cpp: (WebKit::postCommitFrameViewSetup): Reset the click count after a load is committed.
  • webkit/webkitprivate.h: Move static click counting variables to be per-view.
  • webkit/webkitwebview.cpp: (getEventTime): Added. (webkit_web_view_button_press_event): If the event time is zero, use the current time. (webkit_web_view_finalize): Clean up click counting member. (webkit_web_view_init): Initialize click counting member.

2010-06-16 Martin Robinson <mrobinson@igalia.com>

Reviewed by Gustavo Noronha Silva.

[GTK] Remove the abuse of GDK_CURRENT_TIME in the DRT
https://bugs.webkit.org/show_bug.cgi?id=40600

  • DumpRenderTree/gtk/EventSender.cpp: (prepareMouseButtonEvent): Remove logic adding an offset to GDK_CURRENT_TIME.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61286 r61288  
     12010-06-16  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Remove the abuse of GDK_CURRENT_TIME in the DRT
     6        https://bugs.webkit.org/show_bug.cgi?id=40600
     7
     8        * platform/gtk/Skipped: This change exposed some failures which were previously not reported. Skip them.
     9
    1102010-06-16  Adam Barth  <abarth@webkit.org>
    211
  • trunk/LayoutTests/platform/gtk/Skipped

    r61260 r61288  
    59325932# https://bugs.webkit.org/show_bug.cgi?id=40664
    59335933inspector/timeline-script-tag-1.html
     5934
     5935# Tests failing because the context menu is grabbing mouse events.
     5936# https://bugs.webkit.org/show_bug.cgi?id=40601
     5937fast/events/mouse-click-events.html
     5938fast/events/right-click-focus.html
     5939editing/selection/5354455-1.html
     5940editing/selection/5354455-2.html
  • trunk/WebKit/gtk/ChangeLog

    r61224 r61288  
     12010-06-16  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Remove the abuse of GDK_CURRENT_TIME in the DRT
     6        https://bugs.webkit.org/show_bug.cgi?id=40600
     7
     8        * WebCoreSupport/DragClientGtk.cpp:
     9        (WebKit::DragClient::startDrag): Reset the click count after a drag starts.
     10        * WebCoreSupport/FrameLoaderClientGtk.cpp:
     11        (WebKit::postCommitFrameViewSetup): Reset the click count after a load is committed.
     12        * webkit/webkitprivate.h: Move static click counting variables to be per-view.
     13        * webkit/webkitwebview.cpp:
     14        (getEventTime): Added.
     15        (webkit_web_view_button_press_event): If the event time is zero, use the current time.
     16        (webkit_web_view_finalize): Clean up click counting member.
     17        (webkit_web_view_init): Initialize click counting member.
     18
    1192010-06-15  Xan Lopez  <xlopez@igalia.com>
    220
  • trunk/WebKit/gtk/WebCoreSupport/DragClientGtk.cpp

    r60785 r61288  
    8080    webView->priv->draggingDataObjects.set(context, dataObject);
    8181
     82    // A drag starting should prevent a double-click from happening. This might
     83    // happen if a drag is followed very quickly by another click (like in the DRT).
     84    webView->priv->previousClickTime = 0;
     85
    8286    if (image)
    8387        gtk_drag_set_icon_pixbuf(context, image, eventPos.x() - dragImageOrigin.x(), eventPos.y() - dragImageOrigin.y());
  • trunk/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp

    r60498 r61288  
    11461146        g_object_unref(menu);
    11471147    }
     1148
     1149    // Do not allow click counting between main frame loads.
     1150    priv->previousClickTime = 0;
    11481151}
    11491152
  • trunk/WebKit/gtk/webkit/webkitprivate.h

    r60841 r61288  
    5757#include "Frame.h"
    5858#include "InspectorClientGtk.h"
     59#include "IntPoint.h"
    5960#include "FrameLoaderClient.h"
    6061#include "ResourceHandle.h"
     
    153154        char* tooltipText;
    154155
     156        int currentClickCount;
     157        WebCore::IntPoint* previousClickPoint;
     158        guint previousClickButton;
     159        guint32 previousClickTime;
     160
    155161        HashMap<GdkDragContext*, RefPtr<WebCore::DataObjectGtk> > draggingDataObjects;
    156162    };
  • trunk/WebKit/gtk/webkit/webkitwebview.cpp

    r61206 r61288  
    588588}
    589589
     590static guint32 getEventTime(GdkEvent* event)
     591{
     592    guint32 time = gdk_event_get_time(event);
     593    if (time)
     594        return time;
     595
     596    // Real events always have a non-zero time, but events synthesized
     597    // by the DRT do not and we must calculate a time manually. This time
     598    // is not calculated in the DRT, because GTK+ does not work well with
     599    // anything other than GDK_CURRENT_TIME on synthesized events.
     600    GTimeVal timeValue;
     601    g_get_current_time(&timeValue);
     602    return (timeValue.tv_sec * 1000) + (timeValue.tv_usec / 1000);
     603}
     604
    590605static gboolean webkit_web_view_button_press_event(GtkWidget* widget, GdkEventButton* event)
    591606{
    592     // Eventually it may make sense for these to be per-view and per-device,
    593     // but at this time the implementation matches the Windows port.
    594     static int currentClickCount = 1;
    595     static IntPoint previousPoint;
    596     static guint previousButton;
    597     static guint32 previousTime;
    598 
    599607    WebKitWebView* webView = WEBKIT_WEB_VIEW(widget);
     608    WebKitWebViewPrivate* priv = webView->priv;
    600609
    601610    // FIXME: need to keep track of subframe focus for key events
     
    621630    // quadruple clicks, quintuple clicks, ad infinitum. Here, we replicate the
    622631    // GDK logic for counting clicks.
     632    guint32 eventTime = getEventTime(reinterpret_cast<GdkEvent*>(event));
    623633    if ((event->type == GDK_2BUTTON_PRESS || event->type == GDK_3BUTTON_PRESS)
    624         || ((abs(event->x - previousPoint.x()) < doubleClickDistance)
    625             && (abs(event->y - previousPoint.y()) < doubleClickDistance)
    626             && (event->time - previousTime < static_cast<guint>(doubleClickTime))
    627             && (event->button == previousButton)))
    628         currentClickCount++;
     634        || ((abs(event->x - priv->previousClickPoint->x()) < doubleClickDistance)
     635            && (abs(event->y - priv->previousClickPoint->y()) < doubleClickDistance)
     636            && (eventTime - priv->previousClickTime < static_cast<guint>(doubleClickTime))
     637            && (event->button == priv->previousClickButton)))
     638        priv->currentClickCount++;
    629639    else
    630         currentClickCount = 1;
     640        priv->currentClickCount = 1;
    631641
    632642    PlatformMouseEvent platformEvent(event);
    633     platformEvent.setClickCount(currentClickCount);
    634     previousPoint = platformEvent.pos();
    635     previousButton = event->button;
    636     previousTime = event->time;
     643    platformEvent.setClickCount(priv->currentClickCount);
     644    *priv->previousClickPoint = platformEvent.pos();
     645    priv->previousClickButton = event->button;
     646    priv->previousClickTime = eventTime;
    637647
    638648    if (event->button == 3)
     
    11961206    g_free(priv->customEncoding);
    11971207    g_free(priv->iconURI);
     1208
     1209    delete priv->previousClickPoint;
    11981210
    11991211    G_OBJECT_CLASS(webkit_web_view_parent_class)->finalize(object);
     
    29132925
    29142926    priv->tooltipText = 0;
     2927    priv->currentClickCount = 0;
     2928    priv->previousClickPoint = new IntPoint(0, 0);
     2929    priv->previousClickButton = 0;
     2930    priv->previousClickTime = 0;
    29152931}
    29162932
  • trunk/WebKitTools/ChangeLog

    r61287 r61288  
     12010-06-16  Martin Robinson  <mrobinson@igalia.com>
     2
     3        Reviewed by Gustavo Noronha Silva.
     4
     5        [GTK] Remove the abuse of GDK_CURRENT_TIME in the DRT
     6        https://bugs.webkit.org/show_bug.cgi?id=40600
     7
     8        * DumpRenderTree/gtk/EventSender.cpp:
     9        (prepareMouseButtonEvent): Remove logic adding an offset to GDK_CURRENT_TIME.
     10
    1112010-06-16  Adam Barth  <abarth@webkit.org>
    212
  • trunk/WebKitTools/DumpRenderTree/gtk/EventSender.cpp

    r61153 r61288  
    149149    event->button.device = gdk_device_get_core_pointer();
    150150    event->button.state = getStateFlags();
    151 
    152     // Mouse up & down events dispatched via g_signal_emit_by_name must offset
    153     // their time value, so that WebKit can detect where sequences of mouse
    154     // clicks begin and end. This should not interfere with GDK or GTK+ event
    155     // processing, because the event is only seen by the widget.
    156     event->button.time = GDK_CURRENT_TIME + timeOffset;
     151    event->button.time = GDK_CURRENT_TIME;
    157152
    158153    int xRoot, yRoot;
Note: See TracChangeset for help on using the changeset viewer.