Changeset 54083 in webkit


Ignore:
Timestamp:
Jan 29, 2010 4:00:01 PM (14 years ago)
Author:
bweinstein@apple.com
Message:

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.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r54082 r54083  
     12010-01-29  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Drag and Drop: Windows uses "stop" sign as cursor when dragging
     6        https://bugs.webkit.org/show_bug.cgi?id=34305
     7        <rdar://problem/7589672>
     8
     9        Add a FIXME for the code that needs to be changed to support full
     10        custom cursors.
     11
     12        * page/EventHandler.cpp:
     13        (WebCore::EventHandler::handleDrag):
     14
    1152010-01-29  Victor Wang  <victorw@chromium.org>
    216
  • trunk/WebCore/page/EventHandler.cpp

    r53994 r54083  
    22932293   
    22942294    // We are starting a text/image/url drag, so the cursor should be an arrow
    2295     if (FrameView* view = m_frame->view())
     2295    if (FrameView* view = m_frame->view()) {
     2296        // FIXME <rdar://7577595>: Custom cursors aren't supported during drag and drop (default to pointer).
    22962297        view->setCursor(pointerCursor());
    2297    
     2298    }
     2299
    22982300    if (!dragHysteresisExceeded(event.event().pos()))
    22992301        return true;
  • trunk/WebKit/win/ChangeLog

    r54078 r54083  
     12010-01-29  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Adam Roben.
     4
     5        Drag and Drop: Windows uses "stop" sign as cursor when dragging
     6        https://bugs.webkit.org/show_bug.cgi?id=34305
     7        <rdar://problem/7589672>
     8       
     9        Add a preference in WebKit (that defaults to false), for whether or not
     10        we should show the custom cursors during drag and drop. However, this is
     11        currently only used on Windows, and only used to hide the "drop not allowed"
     12        icon inside the WebView is the preference is set to true.
     13
     14        This will be off by default, so no change in behavior.
     15
     16        * Interfaces/IWebPreferencesPrivate.idl: Added new functions.
     17        * Interfaces/WebKit.idl: Touched to force Interfaces build.
     18        * WebDropSource.cpp:
     19        (WebDropSource::GiveFeedback): Implementation of conditional showing cursor
     20            logic.
     21        * WebPreferenceKeysPrivate.h: Added new preference key.
     22        * WebPreferences.cpp: Added new functions.
     23        (WebPreferences::setCustomDragCursorsEnabled):
     24        (WebPreferences::customDragCursorsEnabled):
     25        * WebPreferences.h: Added new functions.
     26
    1272010-01-28  Jon Honeycutt  <jhoneycutt@apple.com>
    228
  • trunk/WebKit/win/Interfaces/IWebPreferencesPrivate.idl

    r52442 r54083  
    9595    HRESULT setAcceleratedCompositingEnabled([in] BOOL);
    9696    HRESULT acceleratedCompositingEnabled([out, retval] BOOL*);
     97
     98    HRESULT setCustomDragCursorsEnabled([in] BOOL);
     99    HRESULT customDragCursorsEnabled([out, retval] BOOL*);
    97100}
  • trunk/WebKit/win/Interfaces/WebKit.idl

    r54078 r54083  
    295295    }
    296296}
     297
  • trunk/WebKit/win/WebDropSource.cpp

    r50786 r54083  
    3030#include "WebView.h"
    3131
     32#include <WebCore/Cursor.h>
    3233#include <WebCore/DragActions.h>
    3334#include <WebCore/EventHandler.h>
    3435#include <WebCore/Frame.h>
     36#include <WebCore/FrameView.h>
    3537#include <WebCore/Page.h>
    3638#include <WebCore/PlatformMouseEvent.h>
     
    113115}
    114116
    115 STDMETHODIMP WebDropSource::GiveFeedback(DWORD)
     117STDMETHODIMP WebDropSource::GiveFeedback(DWORD dwEffect)
    116118{
    117     return DRAGDROP_S_USEDEFAULTCURSORS;
     119    BOOL showCustomCursors;
     120    if (FAILED(WebPreferences::sharedStandardPreferences()->customDragCursorsEnabled(&showCustomCursors)))
     121        return DRAGDROP_S_USEDEFAULTCURSORS;
     122
     123    // If we don't want to hide the stop icon, let Windows select the cursor.
     124    if (!showCustomCursors)
     125        return DRAGDROP_S_USEDEFAULTCURSORS;
     126
     127    // If we are going to show something other than the not allowed arrow, then let Windows
     128    // show the cursor.
     129    if (dwEffect != DROPEFFECT_NONE)
     130        return DRAGDROP_S_USEDEFAULTCURSORS;
     131   
     132    HWND viewWindow;
     133    if (FAILED(m_webView->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow))))
     134        return DRAGDROP_S_USEDEFAULTCURSORS;
     135
     136    RECT webViewRect;
     137    GetWindowRect(viewWindow, &webViewRect);
     138
     139    POINT cursorPoint;
     140    GetCursorPos(&cursorPoint);
     141
     142    if (!PtInRect(&webViewRect, cursorPoint)) {
     143        // If our cursor is outside the bounds of the webView, we want to let Windows select the cursor.
     144        return DRAGDROP_S_USEDEFAULTCURSORS;
     145    }
     146
     147    FrameView* view = m_webView->page()->mainFrame()->view();
     148    if (!view)
     149        return DRAGDROP_S_USEDEFAULTCURSORS;
     150
     151    // When dragging inside a WebView and the drag is not allowed, don't show the not allowed icon,
     152    // instead, show the pointer cursor.   
     153    // FIXME <rdar://7577595>: Custom cursors aren't supported during drag and drop (default to pointer).
     154    view->setCursor(pointerCursor());
     155    return S_OK;
    118156}
  • trunk/WebKit/win/WebPreferenceKeysPrivate.h

    r52442 r54083  
    132132
    133133#define WebKitAcceleratedCompositingEnabledPreferenceKey "WebKitAcceleratedCompositingEnabled"
     134
     135#define WebKitCustomDragCursorsEnabledPreferenceKey "WebKitCustomDragCursorsEnabled"
  • trunk/WebKit/win/WebPreferences.cpp

    r53773 r54083  
    13751375}
    13761376
     1377HRESULT WebPreferences::setCustomDragCursorsEnabled(BOOL enabled)
     1378{
     1379    setBoolValue(CFSTR(WebKitCustomDragCursorsEnabledPreferenceKey), enabled);
     1380    return S_OK;
     1381}
     1382
     1383HRESULT WebPreferences::customDragCursorsEnabled(BOOL* enabled)
     1384{
     1385    *enabled = boolValueForKey(CFSTR(WebKitCustomDragCursorsEnabledPreferenceKey));
     1386    return S_OK;
     1387}
     1388
    13771389void WebPreferences::willAddToWebView()
    13781390{
  • trunk/WebKit/win/WebPreferences.h

    r52442 r54083  
    388388    virtual HRESULT STDMETHODCALLTYPE acceleratedCompositingEnabled(BOOL*);
    389389
     390    virtual HRESULT STDMETHODCALLTYPE setCustomDragCursorsEnabled(BOOL);
     391    virtual HRESULT STDMETHODCALLTYPE customDragCursorsEnabled(BOOL*);
     392
    390393    // WebPreferences
    391394
Note: See TracChangeset for help on using the changeset viewer.