diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebKit/win/WebDropSource.cpp | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebKit/win/WebDropSource.cpp')
-rw-r--r-- | WebKit/win/WebDropSource.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/WebKit/win/WebDropSource.cpp b/WebKit/win/WebDropSource.cpp index 294c337..8cf0588 100644 --- a/WebKit/win/WebDropSource.cpp +++ b/WebKit/win/WebDropSource.cpp @@ -29,9 +29,11 @@ #include "WebKitDLL.h" #include "WebView.h" +#include <WebCore/Cursor.h> #include <WebCore/DragActions.h> #include <WebCore/EventHandler.h> #include <WebCore/Frame.h> +#include <WebCore/FrameView.h> #include <WebCore/Page.h> #include <WebCore/PlatformMouseEvent.h> #include <wtf/CurrentTime.h> @@ -112,7 +114,43 @@ STDMETHODIMP WebDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyS return S_OK; } -STDMETHODIMP WebDropSource::GiveFeedback(DWORD) +STDMETHODIMP WebDropSource::GiveFeedback(DWORD dwEffect) { - return DRAGDROP_S_USEDEFAULTCURSORS; + BOOL showCustomCursors; + if (FAILED(WebPreferences::sharedStandardPreferences()->customDragCursorsEnabled(&showCustomCursors))) + return DRAGDROP_S_USEDEFAULTCURSORS; + + // If we don't want to hide the stop icon, let Windows select the cursor. + if (!showCustomCursors) + return DRAGDROP_S_USEDEFAULTCURSORS; + + // If we are going to show something other than the not allowed arrow, then let Windows + // show the cursor. + if (dwEffect != DROPEFFECT_NONE) + return DRAGDROP_S_USEDEFAULTCURSORS; + + HWND viewWindow; + if (FAILED(m_webView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)))) + return DRAGDROP_S_USEDEFAULTCURSORS; + + RECT webViewRect; + GetWindowRect(viewWindow, &webViewRect); + + POINT cursorPoint; + GetCursorPos(&cursorPoint); + + if (!PtInRect(&webViewRect, cursorPoint)) { + // If our cursor is outside the bounds of the webView, we want to let Windows select the cursor. + return DRAGDROP_S_USEDEFAULTCURSORS; + } + + FrameView* view = m_webView->page()->mainFrame()->view(); + if (!view) + return DRAGDROP_S_USEDEFAULTCURSORS; + + // When dragging inside a WebView and the drag is not allowed, don't show the not allowed icon, + // instead, show the pointer cursor. + // FIXME <rdar://7577595>: Custom cursors aren't supported during drag and drop (default to pointer). + view->setCursor(pointerCursor()); + return S_OK; } |