diff options
author | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:29:25 +0000 |
---|---|---|
committer | snej@chromium.org <snej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-08 17:29:25 +0000 |
commit | 1d9f4137eff50f1305e288767bb770151526552d (patch) | |
tree | 4ae1750d34778e7b0ae23dfe315118cf124c3715 /chrome/renderer | |
parent | c7f475ed4a9fd8f198468df696c55e1c75d65526 (diff) | |
download | chromium_src-1d9f4137eff50f1305e288767bb770151526552d.zip chromium_src-1d9f4137eff50f1305e288767bb770151526552d.tar.gz chromium_src-1d9f4137eff50f1305e288767bb770151526552d.tar.bz2 |
Plumb the DragOperation through all the layers between the platform Drag-n-drop code and WebCore.
This allows the HTML5 DataTransfer effectAllowed and dropEffect properties to be set correctly in JS handlers, as per the HTML5 spec.
(The drag-dropeffect test isn't in WebKit yet -- it's part of a separate WebKit patch that's been in review for weeks.)
R=darin,pink
BUG=http://code.google.com/p/chromium/issues/detail?id=14654, http://code.google.com/p/chromium/issues/detail?id=20985
TEST=LayoutTests/fast/events/drag-dropeffect.html, LayoutTests/editing/pasteboard/files-during-page-drags.html
Review URL: http://codereview.chromium.org/174364
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25629 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 39 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 13 |
2 files changed, 33 insertions, 19 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 339c092..0e2a5ae 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -108,6 +108,8 @@ using WebKit::WebConsoleMessage; using WebKit::WebData; using WebKit::WebDataSource; using WebKit::WebDragData; +using WebKit::WebDragOperation; +using WebKit::WebDragOperationsMask; using WebKit::WebEditingAction; using WebKit::WebForm; using WebKit::WebFrame; @@ -2235,8 +2237,12 @@ void RenderView::ShowContextMenu(WebView* webview, } void RenderView::StartDragging(WebView* webview, - const WebDragData& drag_data) { - Send(new ViewHostMsg_StartDragging(routing_id_, WebDropData(drag_data))); + const WebKit::WebPoint &mouseCoords, + const WebDragData& drag_data, + WebDragOperationsMask allowed_ops) { + Send(new ViewHostMsg_StartDragging(routing_id_, + WebDropData(drag_data), + allowed_ops)); } void RenderView::TakeFocus(WebView* webview, bool reverse) { @@ -2709,12 +2715,10 @@ void RenderView::OnReservePageIDRange(int size_of_range) { void RenderView::OnDragSourceEndedOrMoved(const gfx::Point& client_point, const gfx::Point& screen_point, - bool ended, bool cancelled) { + bool ended, + WebDragOperation op) { if (ended) { - if (cancelled) - webview()->DragSourceCancelledAt(client_point, screen_point); - else - webview()->DragSourceEndedAt(client_point, screen_point); + webview()->DragSourceEndedAt(client_point, screen_point, op); } else { webview()->DragSourceMovedTo(client_point, screen_point); } @@ -2771,22 +2775,27 @@ void RenderView::OnFillPasswordForm( void RenderView::OnDragTargetDragEnter(const WebDropData& drop_data, const gfx::Point& client_point, - const gfx::Point& screen_point) { - bool is_drop_target = webview()->DragTargetDragEnter( + const gfx::Point& screen_point, + WebDragOperationsMask ops) { + WebDragOperation operation = webview()->DragTargetDragEnter( drop_data.ToDragData(), drop_data.identity, client_point, - screen_point); + screen_point, + ops); - Send(new ViewHostMsg_UpdateDragCursor(routing_id_, is_drop_target)); + Send(new ViewHostMsg_UpdateDragCursor(routing_id_, operation)); } void RenderView::OnDragTargetDragOver(const gfx::Point& client_point, - const gfx::Point& screen_point) { - bool is_drop_target = - webview()->DragTargetDragOver(client_point, screen_point); + const gfx::Point& screen_point, + WebDragOperationsMask ops) { + WebDragOperation operation = webview()->DragTargetDragOver( + client_point, + screen_point, + ops); - Send(new ViewHostMsg_UpdateDragCursor(routing_id_, is_drop_target)); + Send(new ViewHostMsg_UpdateDragCursor(routing_id_, operation)); } void RenderView::OnDragTargetDragLeave() { diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index aa6bc74..b9fbee2 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -299,7 +299,9 @@ class RenderView : public RenderWidget, const std::string& security_info, const std::string& frame_charset); virtual void StartDragging(WebView* webview, - const WebKit::WebDragData& drag_data); + const WebKit::WebPoint &mouseCoords, + const WebKit::WebDragData& drag_data, + WebKit::WebDragOperationsMask operations_mask); virtual void TakeFocus(WebView* webview, bool reverse); virtual void JSOutOfMemory(); virtual void NavigateBackForwardSoon(int offset); @@ -552,9 +554,11 @@ class RenderView : public RenderWidget, const webkit_glue::PasswordFormDomManager::FillData& form_data); void OnDragTargetDragEnter(const WebDropData& drop_data, const gfx::Point& client_pt, - const gfx::Point& screen_pt); + const gfx::Point& screen_pt, + WebKit::WebDragOperationsMask operations_allowed); void OnDragTargetDragOver(const gfx::Point& client_pt, - const gfx::Point& screen_pt); + const gfx::Point& screen_pt, + WebKit::WebDragOperationsMask operations_allowed); void OnDragTargetDragLeave(); void OnDragTargetDrop(const gfx::Point& client_pt, const gfx::Point& screen_pt); @@ -579,7 +583,8 @@ class RenderView : public RenderWidget, void OnDragSourceEndedOrMoved(const gfx::Point& client_point, const gfx::Point& screen_point, - bool ended, bool cancelled); + bool ended, + WebKit::WebDragOperation drag_operation); void OnDragSourceSystemDragEnded(); void OnInstallMissingPlugin(); void OnFileChooserResponse(const std::vector<FilePath>& file_names); |