Commit 28e89396 authored by bweinstein@apple.com's avatar bweinstein@apple.com

WebCore: Drag and Drop: Windows uses "stop" sign as cursor when dragging

https://bugs.webkit.org/show_bug.cgi?id=34305
<rdar://problem/7589672>

Reviewed by Adam Roben.

Add a FIXME for the code that needs to be changed to support full
custom cursors.

* page/EventHandler.cpp:
(WebCore::EventHandler::handleDrag):

WebKit/win: Drag and Drop: Windows uses "stop" sign as cursor when dragging
https://bugs.webkit.org/show_bug.cgi?id=34305
<rdar://problem/7589672>
        
Reviewed by Adam Roben.

Add a preference in WebKit (that defaults to false), for whether or not
we should show the custom cursors during drag and drop. However, this is
currently only used on Windows, and only used to hide the "drop not allowed"
icon inside the WebView is the preference is set to true.

This will be off by default, so no change in behavior.

* Interfaces/IWebPreferencesPrivate.idl: Added new functions.
* Interfaces/WebKit.idl: Touched to force Interfaces build.
* WebDropSource.cpp:
(WebDropSource::GiveFeedback): Implementation of conditional showing cursor
    logic.
* WebPreferenceKeysPrivate.h: Added new preference key.
* WebPreferences.cpp: Added new functions.
(WebPreferences::setCustomDragCursorsEnabled):
(WebPreferences::customDragCursorsEnabled):
* WebPreferences.h: Added new functions.



git-svn-id: svn://svn.chromium.org/blink/trunk@54083 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7df37d74
2010-01-29 Brian Weinstein <bweinstein@apple.com>
Reviewed by Adam Roben.
Drag and Drop: Windows uses "stop" sign as cursor when dragging
https://bugs.webkit.org/show_bug.cgi?id=34305
<rdar://problem/7589672>
Add a FIXME for the code that needs to be changed to support full
custom cursors.
* page/EventHandler.cpp:
(WebCore::EventHandler::handleDrag):
2010-01-29 Victor Wang <victorw@chromium.org> 2010-01-29 Victor Wang <victorw@chromium.org>
Reviewed by darin@apple.com. Reviewed by darin@apple.com.
...@@ -2292,9 +2292,11 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event) ...@@ -2292,9 +2292,11 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event)
return !mouseDownMayStartSelect() && !m_mouseDownMayStartAutoscroll; return !mouseDownMayStartSelect() && !m_mouseDownMayStartAutoscroll;
// We are starting a text/image/url drag, so the cursor should be an arrow // We are starting a text/image/url drag, so the cursor should be an arrow
if (FrameView* view = m_frame->view()) if (FrameView* view = m_frame->view()) {
// FIXME <rdar://7577595>: Custom cursors aren't supported during drag and drop (default to pointer).
view->setCursor(pointerCursor()); view->setCursor(pointerCursor());
}
if (!dragHysteresisExceeded(event.event().pos())) if (!dragHysteresisExceeded(event.event().pos()))
return true; return true;
......
2010-01-29 Brian Weinstein <bweinstein@apple.com>
Reviewed by Adam Roben.
Drag and Drop: Windows uses "stop" sign as cursor when dragging
https://bugs.webkit.org/show_bug.cgi?id=34305
<rdar://problem/7589672>
Add a preference in WebKit (that defaults to false), for whether or not
we should show the custom cursors during drag and drop. However, this is
currently only used on Windows, and only used to hide the "drop not allowed"
icon inside the WebView is the preference is set to true.
This will be off by default, so no change in behavior.
* Interfaces/IWebPreferencesPrivate.idl: Added new functions.
* Interfaces/WebKit.idl: Touched to force Interfaces build.
* WebDropSource.cpp:
(WebDropSource::GiveFeedback): Implementation of conditional showing cursor
logic.
* WebPreferenceKeysPrivate.h: Added new preference key.
* WebPreferences.cpp: Added new functions.
(WebPreferences::setCustomDragCursorsEnabled):
(WebPreferences::customDragCursorsEnabled):
* WebPreferences.h: Added new functions.
2010-01-28 Jon Honeycutt <jhoneycutt@apple.com> 2010-01-28 Jon Honeycutt <jhoneycutt@apple.com>
MSAA: Crash when posting a notification for a detached object MSAA: Crash when posting a notification for a detached object
......
...@@ -94,4 +94,7 @@ interface IWebPreferencesPrivate : IUnknown ...@@ -94,4 +94,7 @@ interface IWebPreferencesPrivate : IUnknown
HRESULT setAcceleratedCompositingEnabled([in] BOOL); HRESULT setAcceleratedCompositingEnabled([in] BOOL);
HRESULT acceleratedCompositingEnabled([out, retval] BOOL*); HRESULT acceleratedCompositingEnabled([out, retval] BOOL*);
HRESULT setCustomDragCursorsEnabled([in] BOOL);
HRESULT customDragCursorsEnabled([out, retval] BOOL*);
} }
...@@ -294,3 +294,4 @@ library WebKit ...@@ -294,3 +294,4 @@ library WebKit
[default] interface IWebGeolocationPosition; [default] interface IWebGeolocationPosition;
} }
} }
...@@ -29,9 +29,11 @@ ...@@ -29,9 +29,11 @@
#include "WebKitDLL.h" #include "WebKitDLL.h"
#include "WebView.h" #include "WebView.h"
#include <WebCore/Cursor.h>
#include <WebCore/DragActions.h> #include <WebCore/DragActions.h>
#include <WebCore/EventHandler.h> #include <WebCore/EventHandler.h>
#include <WebCore/Frame.h> #include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
#include <WebCore/Page.h> #include <WebCore/Page.h>
#include <WebCore/PlatformMouseEvent.h> #include <WebCore/PlatformMouseEvent.h>
#include <wtf/CurrentTime.h> #include <wtf/CurrentTime.h>
...@@ -112,7 +114,43 @@ STDMETHODIMP WebDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyS ...@@ -112,7 +114,43 @@ STDMETHODIMP WebDropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyS
return S_OK; 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;
} }
...@@ -131,3 +131,5 @@ ...@@ -131,3 +131,5 @@
#define WebKitPluginAllowedRunTimePreferenceKey "WebKitPluginAllowedRunTime" #define WebKitPluginAllowedRunTimePreferenceKey "WebKitPluginAllowedRunTime"
#define WebKitAcceleratedCompositingEnabledPreferenceKey "WebKitAcceleratedCompositingEnabled" #define WebKitAcceleratedCompositingEnabledPreferenceKey "WebKitAcceleratedCompositingEnabled"
#define WebKitCustomDragCursorsEnabledPreferenceKey "WebKitCustomDragCursorsEnabled"
...@@ -1374,6 +1374,18 @@ HRESULT WebPreferences::acceleratedCompositingEnabled(BOOL* enabled) ...@@ -1374,6 +1374,18 @@ HRESULT WebPreferences::acceleratedCompositingEnabled(BOOL* enabled)
return S_OK; return S_OK;
} }
HRESULT WebPreferences::setCustomDragCursorsEnabled(BOOL enabled)
{
setBoolValue(CFSTR(WebKitCustomDragCursorsEnabledPreferenceKey), enabled);
return S_OK;
}
HRESULT WebPreferences::customDragCursorsEnabled(BOOL* enabled)
{
*enabled = boolValueForKey(CFSTR(WebKitCustomDragCursorsEnabledPreferenceKey));
return S_OK;
}
void WebPreferences::willAddToWebView() void WebPreferences::willAddToWebView()
{ {
++m_numWebViews; ++m_numWebViews;
......
...@@ -387,6 +387,9 @@ public: ...@@ -387,6 +387,9 @@ public:
virtual HRESULT STDMETHODCALLTYPE setAcceleratedCompositingEnabled(BOOL); virtual HRESULT STDMETHODCALLTYPE setAcceleratedCompositingEnabled(BOOL);
virtual HRESULT STDMETHODCALLTYPE acceleratedCompositingEnabled(BOOL*); virtual HRESULT STDMETHODCALLTYPE acceleratedCompositingEnabled(BOOL*);
virtual HRESULT STDMETHODCALLTYPE setCustomDragCursorsEnabled(BOOL);
virtual HRESULT STDMETHODCALLTYPE customDragCursorsEnabled(BOOL*);
// WebPreferences // WebPreferences
// This method accesses a different preference key than developerExtrasEnabled. // This method accesses a different preference key than developerExtrasEnabled.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment