From 0e9a6ec0386672dbea487edf2866ce1ae4e02d7c Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Fri, 1 Feb 2013 17:44:41 +0000 Subject: [PATCH] Merge revision 1070 changes: - Linux: Fix drag/drop crash in WebCore::DragData::modifierKeyState (issue #875). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1364@1071 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef1/libcef/web_drop_target_gtk.cc | 7 +++++++ cef1/libcef/web_drop_target_gtk.h | 1 + 2 files changed, 8 insertions(+) diff --git a/cef1/libcef/web_drop_target_gtk.cc b/cef1/libcef/web_drop_target_gtk.cc index 481f7c08d..44af7bcfe 100644 --- a/cef1/libcef/web_drop_target_gtk.cc +++ b/cef1/libcef/web_drop_target_gtk.cc @@ -83,6 +83,7 @@ WebDropTarget::WebDropTarget(CefBrowserImpl* browser) : browser_(browser), data_requests_(0), context_(NULL), + sent_drag_enter_(false), method_factory_(this) { GtkWidget* widget = browser->UIT_GetWebViewHost()->view_handle(); gtk_drag_dest_set(widget, (GtkDestDefaults)0, NULL, 0, @@ -148,6 +149,10 @@ void WebDropTarget::OnDragLeave(GtkWidget* widget, GdkDragContext* context, context_ = NULL; drop_data_.reset(); + // Don't send the drag leave if we didn't send the drag enter. + if (!sent_drag_enter_) + return; + // Sometimes we get a drag-leave event before getting a drag-data-received // event. In that case, we don't want to bother the renderer with a // DragLeave event. @@ -258,6 +263,7 @@ void WebDropTarget::OnDragDataReceived(GtkWidget* widget, if (handler->OnDragEnter(browser_, data, (cef_drag_operations_mask_t)_mask(context))) { operation = WebDragOperationNone; + sent_drag_enter_ = false; gdk_drag_status(context, (GdkDragAction)DragDropTypes::DragOperationToGdkDragAction( operation), @@ -270,6 +276,7 @@ void WebDropTarget::OnDragDataReceived(GtkWidget* widget, gtk_widget_translate_coordinates(gtk_widget_get_toplevel(widget), widget, x, y, &widget_x, &widget_y); WebView* webview = getView(); + sent_drag_enter_ = true; operation = webview->dragTargetDragEnter(drop_data_->ToDragData(), WebPoint(x, y), WebPoint(widget_x, widget_y), diff --git a/cef1/libcef/web_drop_target_gtk.h b/cef1/libcef/web_drop_target_gtk.h index 0032551e0..96c980bef 100644 --- a/cef1/libcef/web_drop_target_gtk.h +++ b/cef1/libcef/web_drop_target_gtk.h @@ -45,6 +45,7 @@ class WebDropTarget : public base::RefCounted { bool entered_; int data_requests_; GdkDragContext* context_; + bool sent_drag_enter_; base::WeakPtrFactory method_factory_; };