Fixed: <rdar://problem/4029010> Expose method to retrieve drag image for WebView...
authorcblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2005 01:13:06 +0000 (01:13 +0000)
committercblu <cblu@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Mar 2005 01:13:06 +0000 (01:13 +0000)
        Reviewed by sullivan.

        * WebView.subproj/WebHTMLView.m:
        (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]): call _selectionDraggingImage
        (-[WebHTMLView _selectionDraggingImage]): new SPI for Mail, factored from previous method
        (-[WebHTMLView _selectionDraggingRect]): new SPI for Mail
        * WebView.subproj/WebHTMLViewPrivate.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8763 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/ChangeLog
WebKit/WebView.subproj/WebHTMLView.m
WebKit/WebView.subproj/WebHTMLViewPrivate.h

index 78c17ebd9326bdc9b3eb901677a551ff21b279bb..f24ddc015319c2e51d59be7e490b32aeaae62c27 100644 (file)
@@ -1,3 +1,15 @@
+2005-03-02  Chris Blumenberg  <cblu@apple.com>
+
+       Fixed: <rdar://problem/4029010> Expose method to retrieve drag image for WebView's selection
+
+        Reviewed by sullivan.
+
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]): call _selectionDraggingImage
+        (-[WebHTMLView _selectionDraggingImage]): new SPI for Mail, factored from previous method
+        (-[WebHTMLView _selectionDraggingRect]): new SPI for Mail
+        * WebView.subproj/WebHTMLViewPrivate.h:
+
 2005-03-02  John Sullivan  <sullivan@apple.com>
 
         Reviewed by Adele.
index 166bca70c7df8e2d5a246b3c340784db19a82326..f7cc005e438eded4d27b785f0ac16d8e320b4893 100644 (file)
@@ -1228,10 +1228,9 @@ static WebHTMLView *lastHitView = nil;
         }
         [[webView _UIDelegateForwarder] webView:webView willPerformDragSourceAction:WebDragSourceActionSelection fromPoint:mouseDownPoint withPasteboard:pasteboard];
         if (dragImage == nil) {
-            dragImage = [[self _bridge] selectionImage];
-            [dragImage _web_dissolveToFraction:WebDragImageAlpha];
-            NSRect visibleSelectionRect = [[self _bridge] visibleSelectionRect];
-            dragLoc = NSMakePoint(NSMinX(visibleSelectionRect), NSMaxY(visibleSelectionRect));
+            dragImage = [self _selectionDraggingImage];
+            NSRect draggingRect = [self _selectionDraggingRect];
+            dragLoc = NSMakePoint(NSMinX(draggingRect), NSMaxY(draggingRect));
             _private->dragOffset.x = mouseDownPoint.x - dragLoc.x;
             _private->dragOffset.y = dragLoc.y - mouseDownPoint.y;        // inverted because we are flipped
         }
@@ -1567,6 +1566,24 @@ static WebHTMLView *lastHitView = nil;
     _private->transparentBackground = f;
 }
 
+- (NSImage *)_selectionDraggingImage
+{
+    if ([self _hasSelection]) {
+        NSImage *dragImage = [[self _bridge] selectionImage];
+        [dragImage _web_dissolveToFraction:WebDragImageAlpha];
+        return dragImage;
+    }
+    return nil;
+}
+
+- (NSRect)_selectionDraggingRect
+{
+    if ([self _hasSelection]) {
+        return [[self _bridge] visibleSelectionRect];
+    }
+    return NSZeroRect;
+}
+
 @end
 
 @implementation NSView (WebHTMLViewFileInternal)
index b64a2d9f7dfe0fbf7c0f67a606ce63af58d9ed56..d093dcac05ad660eb269256b6c61888c9891c0aa 100644 (file)
@@ -63,4 +63,8 @@
 - (BOOL)_transparentBackground;
 - (void)_setTransparentBackground:(BOOL)f;
 
+// SPI's for Mail.
+- (NSImage *)_selectionDraggingImage;
+- (NSRect)_selectionDraggingRect;
+
 @end