diff options
author | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 18:12:17 +0000 |
---|---|---|
committer | arv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 18:12:17 +0000 |
commit | b7544eef7b81458a88597419eed6617c41e6d3dc (patch) | |
tree | 83260bfe7139473da102ee514f342175db1fba0d /chrome/browser | |
parent | e2e48a08938eff8a0d32ab1eb1231efe5ce2e974 (diff) | |
download | chromium_src-b7544eef7b81458a88597419eed6617c41e6d3dc.zip chromium_src-b7544eef7b81458a88597419eed6617c41e6d3dc.tar.gz chromium_src-b7544eef7b81458a88597419eed6617c41e6d3dc.tar.bz2 |
HTML5: Make sure that the drop event fires before the dragend event.
BUG=31292
TEST=bookmark_bar_view_test and I also ran the test case. NTP and Bookmark manager also works.
Review URL: http://codereview.chromium.org/1084014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42361 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/tab_contents/web_drag_source_win.cc | 17 | ||||
-rw-r--r-- | chrome/browser/tab_contents/web_drag_source_win.h | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/chrome/browser/tab_contents/web_drag_source_win.cc b/chrome/browser/tab_contents/web_drag_source_win.cc index 0f47aac..62fe910 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.cc +++ b/chrome/browser/tab_contents/web_drag_source_win.cc @@ -62,14 +62,17 @@ void WebDragSource::OnDragSourceCancel() { } void WebDragSource::OnDragSourceDrop() { - // Delegate to the UI thread if we do drag-and-drop in the background thread. - if (!ChromeThread::CurrentlyOn(ChromeThread::UI)) { - ChromeThread::PostTask( - ChromeThread::UI, FROM_HERE, - NewRunnableMethod(this, &WebDragSource::OnDragSourceDrop)); - return; - } + // On Windows, we check for drag end in IDropSource::QueryContinueDrag which + // happens before IDropTarget::Drop is called. HTML5 requires the "dragend" + // event to happen after the "drop" event. Since Windows calls these two + // directly after each other we can just post a task to handle the + // OnDragSourceDrop after the current task. + ChromeThread::PostTask( + ChromeThread::UI, FROM_HERE, + NewRunnableMethod(this, &WebDragSource::DelayedOnDragSourceDrop)); +} +void WebDragSource::DelayedOnDragSourceDrop() { if (!render_view_host_) return; diff --git a/chrome/browser/tab_contents/web_drag_source_win.h b/chrome/browser/tab_contents/web_drag_source_win.h index c851142..c0a8eb0 100644 --- a/chrome/browser/tab_contents/web_drag_source_win.h +++ b/chrome/browser/tab_contents/web_drag_source_win.h @@ -46,6 +46,10 @@ class WebDragSource : public BaseDragSource, // Cannot construct thusly. WebDragSource(); + // OnDragSourceDrop schedules its main work to be done after IDropTarget::Drop + // by posting a task to this function. + void DelayedOnDragSourceDrop(); + // Keep a reference to the window so we can translate the cursor position. gfx::NativeWindow source_wnd_; |