[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.19-706-ge5415e9

bweinstein at apple.com bweinstein at apple.com
Thu Feb 4 21:32:50 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit 3eaf063390567c9625060a62593a7a028305fe26
Author: bweinstein at apple.com <bweinstein at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Jan 30 00:00:01 2010 +0000

    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: http://svn.webkit.org/repository/webkit/trunk@54083 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e3dfaf9..a183c56 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2010-01-29  Brian Weinstein  <bweinstein at 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 at chromium.org>
 
         Reviewed by darin at apple.com.
diff --git a/WebCore/page/EventHandler.cpp b/WebCore/page/EventHandler.cpp
index 9e4d47f..8a77867 100644
--- a/WebCore/page/EventHandler.cpp
+++ b/WebCore/page/EventHandler.cpp
@@ -2292,9 +2292,11 @@ bool EventHandler::handleDrag(const MouseEventWithHitTestResults& event)
         return !mouseDownMayStartSelect() && !m_mouseDownMayStartAutoscroll;
     
     // 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());
-    
+    }
+
     if (!dragHysteresisExceeded(event.event().pos())) 
         return true;
     
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index f3a2d05..6cc5d6e 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,29 @@
+2010-01-29  Brian Weinstein  <bweinstein at 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 at apple.com>
 
         MSAA: Crash when posting a notification for a detached object
diff --git a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
index cfd8e83..1293fb8 100644
--- a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
+++ b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
@@ -94,4 +94,7 @@ interface IWebPreferencesPrivate : IUnknown
 
     HRESULT setAcceleratedCompositingEnabled([in] BOOL);
     HRESULT acceleratedCompositingEnabled([out, retval] BOOL*);
+
+    HRESULT setCustomDragCursorsEnabled([in] BOOL);
+    HRESULT customDragCursorsEnabled([out, retval] BOOL*);
 }
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
index 3cd748c..94dc697 100644
--- a/WebKit/win/Interfaces/WebKit.idl
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -294,3 +294,4 @@ library WebKit
         [default] interface IWebGeolocationPosition;
     }
 }
+
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;
 }
diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h
index fd70ed2..3b4197c 100644
--- a/WebKit/win/WebPreferenceKeysPrivate.h
+++ b/WebKit/win/WebPreferenceKeysPrivate.h
@@ -131,3 +131,5 @@
 #define WebKitPluginAllowedRunTimePreferenceKey "WebKitPluginAllowedRunTime"
 
 #define WebKitAcceleratedCompositingEnabledPreferenceKey "WebKitAcceleratedCompositingEnabled"
+
+#define WebKitCustomDragCursorsEnabledPreferenceKey "WebKitCustomDragCursorsEnabled"
diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp
index cd982fd..c23f236 100644
--- a/WebKit/win/WebPreferences.cpp
+++ b/WebKit/win/WebPreferences.cpp
@@ -1374,6 +1374,18 @@ HRESULT WebPreferences::acceleratedCompositingEnabled(BOOL* enabled)
     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()
 {
     ++m_numWebViews;
diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h
index 8d15a06..1631e78 100644
--- a/WebKit/win/WebPreferences.h
+++ b/WebKit/win/WebPreferences.h
@@ -387,6 +387,9 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setAcceleratedCompositingEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE acceleratedCompositingEnabled(BOOL*);
 
+    virtual HRESULT STDMETHODCALLTYPE setCustomDragCursorsEnabled(BOOL);
+    virtual HRESULT STDMETHODCALLTYPE customDragCursorsEnabled(BOOL*);
+
     // WebPreferences
 
     // This method accesses a different preference key than developerExtrasEnabled.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list