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
+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.
2005-03-02 John Sullivan <sullivan@apple.com>
Reviewed by Adele.
}
[[webView _UIDelegateForwarder] webView:webView willPerformDragSourceAction:WebDragSourceActionSelection fromPoint:mouseDownPoint withPasteboard:pasteboard];
if (dragImage == 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
}
_private->dragOffset.x = mouseDownPoint.x - dragLoc.x;
_private->dragOffset.y = dragLoc.y - mouseDownPoint.y; // inverted because we are flipped
}
_private->transparentBackground = f;
}
_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)
@end
@implementation NSView (WebHTMLViewFileInternal)
- (BOOL)_transparentBackground;
- (void)_setTransparentBackground:(BOOL)f;
- (BOOL)_transparentBackground;
- (void)_setTransparentBackground:(BOOL)f;
+// SPI's for Mail.
+- (NSImage *)_selectionDraggingImage;
+- (NSRect)_selectionDraggingRect;
+