summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/event_conversion.cc58
-rw-r--r--webkit/glue/event_conversion.h16
-rw-r--r--webkit/glue/webkit_glue.cc7
-rw-r--r--webkit/glue/webview_impl.cc2
-rw-r--r--webkit/glue/webwidget_impl.cc2
5 files changed, 11 insertions, 74 deletions
diff --git a/webkit/glue/event_conversion.cc b/webkit/glue/event_conversion.cc
index 6014107..2a3bbff 100644
--- a/webkit/glue/event_conversion.cc
+++ b/webkit/glue/event_conversion.cc
@@ -29,9 +29,6 @@ using WebKit::WebMouseWheelEvent;
// MakePlatformMouseEvent -----------------------------------------------------
-int MakePlatformMouseEvent::last_click_count_ = 0;
-uint32 MakePlatformMouseEvent::last_click_time_ = 0;
-
MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
const WebMouseEvent& e) {
// TODO(mpcomplete): widget is always toplevel, unless it's a popup. We
@@ -45,78 +42,25 @@ MakePlatformMouseEvent::MakePlatformMouseEvent(Widget* widget,
m_metaKey = (e.modifiers & WebInputEvent::MetaKey) != 0;
m_modifierFlags = e.modifiers;
m_timestamp = e.timeStampSeconds;
-
- // This differs slightly from the WebKit code in WebKit/win/WebView.cpp where
- // their original code looks buggy.
- static IntPoint last_click_position;
- static MouseButton last_click_button = LeftButton;
-
- const uint32 current_time = static_cast<uint32>(m_timestamp * 1000);
-#if defined(OS_WIN)
- const bool cancel_previous_click =
- (abs(last_click_position.x() - m_position.x()) >
- (GetSystemMetrics(SM_CXDOUBLECLK) / 2)) ||
- (abs(last_click_position.y() - m_position.y()) >
- (GetSystemMetrics(SM_CYDOUBLECLK) / 2)) ||
- ((current_time - last_click_time_) > GetDoubleClickTime());
-#elif defined(OS_MACOSX) || defined(OS_LINUX)
- const bool cancel_previous_click = false;
-#endif
+ m_clickCount = e.clickCount;
switch (e.type) {
case WebInputEvent::MouseMove:
case WebInputEvent::MouseLeave: // synthesize a move event
- if (cancel_previous_click) {
- last_click_count_ = 0;
- last_click_position = IntPoint();
- last_click_time_ = 0;
- }
- m_clickCount = last_click_count_;
m_eventType = MouseEventMoved;
break;
-// TODO(port): make these platform agnostic when we restructure this code.
-#if defined(OS_LINUX) || defined(OS_MACOSX)
- case WebInputEvent::MouseTripleClick:
- ++m_clickCount;
- // fall through
- case WebInputEvent::MouseDoubleClick:
- ++m_clickCount;
- // fall through
case WebInputEvent::MouseDown:
- ++m_clickCount;
- last_click_time_ = current_time;
- last_click_button = m_button;
m_eventType = MouseEventPressed;
break;
-#else
- case WebInputEvent::MouseDown:
- case WebInputEvent::MouseDoubleClick:
- if (!cancel_previous_click && (m_button == last_click_button)) {
- ++last_click_count_;
- } else {
- last_click_count_ = 1;
- last_click_position = m_position;
- }
- last_click_time_ = current_time;
- last_click_button = m_button;
- m_clickCount = last_click_count_;
- m_eventType = MouseEventPressed;
- break;
-#endif
case WebInputEvent::MouseUp:
- m_clickCount = last_click_count_;
m_eventType = MouseEventReleased;
break;
default:
NOTREACHED() << "unexpected mouse event type";
}
-
- if (WebKit::layoutTestMode()) {
- m_clickCount = e.layoutTestClickCount;
- }
}
// MakePlatformWheelEvent -----------------------------------------------------
diff --git a/webkit/glue/event_conversion.h b/webkit/glue/event_conversion.h
index 3f49938..5b83c97 100644
--- a/webkit/glue/event_conversion.h
+++ b/webkit/glue/event_conversion.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_GLUE_EVENT_CONVERSION_H__
-#define WEBKIT_GLUE_EVENT_CONVERSION_H__
+#ifndef WEBKIT_GLUE_EVENT_CONVERSION_H_
+#define WEBKIT_GLUE_EVENT_CONVERSION_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -31,14 +31,6 @@ class MakePlatformMouseEvent : public WebCore::PlatformMouseEvent {
public:
MakePlatformMouseEvent(
WebCore::Widget* widget, const WebKit::WebMouseEvent& e);
-
- static void ResetLastClick() {
- last_click_time_ = last_click_count_ = 0;
- }
-
- private:
- static int last_click_count_;
- static uint32 last_click_time_;
};
class MakePlatformWheelEvent : public WebCore::PlatformWheelEvent {
@@ -54,4 +46,4 @@ class MakePlatformKeyboardEvent : public WebCore::PlatformKeyboardEvent {
bool IsCharacterKey() const;
};
-#endif // WEBKIT_GLUE_EVENT_CONVERSION_H__
+#endif // WEBKIT_GLUE_EVENT_CONVERSION_H_
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 5a6ca45..09a72cd 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -36,6 +36,9 @@
#include "base/sys_string_conversions.h"
#include "skia/include/SkBitmap.h"
#include "webkit/api/public/WebString.h"
+#if defined(OS_WIN)
+#include "webkit/api/public/win/WebInputEventFactory.h"
+#endif
#include "webkit/glue/event_conversion.h"
#include "webkit/glue/glue_util.h"
#include "webkit/glue/weburlrequest_impl.h"
@@ -219,9 +222,11 @@ void ResetBeforeTestRun(WebView* view) {
if (frame && frame->script())
frame->script()->setEventHandlerLineNumber(0);
+#if defined(OS_WIN)
// Reset the last click information so the clicks generated from previous
// test aren't inherited (otherwise can mistake single/double/triple clicks)
- MakePlatformMouseEvent::ResetLastClick();
+ WebKit::WebInputEventFactory::resetLastClickState();
+#endif
}
#ifndef NDEBUG
diff --git a/webkit/glue/webview_impl.cc b/webkit/glue/webview_impl.cc
index 06a6b7e..6830fd8 100644
--- a/webkit/glue/webview_impl.cc
+++ b/webkit/glue/webview_impl.cc
@@ -1051,8 +1051,6 @@ bool WebViewImpl::HandleInputEvent(const WebInputEvent* input_event) {
break;
case WebInputEvent::MouseDown:
- case WebInputEvent::MouseDoubleClick:
- case WebInputEvent::MouseTripleClick:
MouseDown(*static_cast<const WebMouseEvent*>(input_event));
break;
diff --git a/webkit/glue/webwidget_impl.cc b/webkit/glue/webwidget_impl.cc
index 3fd60c5..8418617 100644
--- a/webkit/glue/webwidget_impl.cc
+++ b/webkit/glue/webwidget_impl.cc
@@ -182,8 +182,6 @@ bool WebWidgetImpl::HandleInputEvent(const WebInputEvent* input_event) {
return true;
case WebInputEvent::MouseDown:
- case WebInputEvent::MouseDoubleClick:
- case WebInputEvent::MouseTripleClick:
MouseDown(*static_cast<const WebMouseEvent*>(input_event));
return true;