[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
cblu
cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:08:07 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit ab385f553a234792c112312219f22bdf75f0b544
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Nov 25 16:50:20 2002 +0000
Fixed: 3084350 - No URL flavors provided for images
* Misc.subproj/WebNSViewExtras.h:
* Misc.subproj/WebNSViewExtras.m:
(-[NSView _web_dragPromisedImage:fromOrigin:withURL:title:event:]): renamed, simplifies dragging an image
(-[WebFilePromiseDragSource initWithSource:]): subclass of NSFilePromiseDragSource, to be used later
(-[WebFilePromiseDragSource draggingSource]):
(-[WebFilePromiseDragSource dealloc]):
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView mouseDragged:]): call _web_dragPromisedImage:fromOrigin:withURL:title:event:, retain self
(-[WebHTMLView draggedImage:endedAt:operation:]): added, release self
* WebView.subproj/WebImageView.m:
(-[WebImageView mouseDragged:]): call _web_dragPromisedImage:fromOrigin:withURL:title:event:, retain self
(-[WebImageView draggedImage:endedAt:operation:]): added, release self
* WebView.subproj/WebView.m:
(-[WebView isDocumentHTML]): call isKindOfClass instead of className
(-[WebView draggingEntered:]): check for WebFilePromiseDragSource
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2859 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ef5d3ac..ff9a987 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2002-11-25 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: 3084350 - No URL flavors provided for images
+
+ * Misc.subproj/WebNSViewExtras.h:
+ * Misc.subproj/WebNSViewExtras.m:
+ (-[NSView _web_dragPromisedImage:fromOrigin:withURL:title:event:]): renamed, simplifies dragging an image
+ (-[WebFilePromiseDragSource initWithSource:]): subclass of NSFilePromiseDragSource, to be used later
+ (-[WebFilePromiseDragSource draggingSource]):
+ (-[WebFilePromiseDragSource dealloc]):
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView mouseDragged:]): call _web_dragPromisedImage:fromOrigin:withURL:title:event:, retain self
+ (-[WebHTMLView draggedImage:endedAt:operation:]): added, release self
+ * WebView.subproj/WebImageView.m:
+ (-[WebImageView mouseDragged:]): call _web_dragPromisedImage:fromOrigin:withURL:title:event:, retain self
+ (-[WebImageView draggedImage:endedAt:operation:]): added, release self
+ * WebView.subproj/WebView.m:
+ (-[WebView isDocumentHTML]): call isKindOfClass instead of className
+ (-[WebView draggingEntered:]): check for WebFilePromiseDragSource
+
2002-11-24 Trey Matteson <trey at apple.com>
Added URLString method to WebHistoryItem to avoid silly conversions between
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index ef5d3ac..ff9a987 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,23 @@
+2002-11-25 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: 3084350 - No URL flavors provided for images
+
+ * Misc.subproj/WebNSViewExtras.h:
+ * Misc.subproj/WebNSViewExtras.m:
+ (-[NSView _web_dragPromisedImage:fromOrigin:withURL:title:event:]): renamed, simplifies dragging an image
+ (-[WebFilePromiseDragSource initWithSource:]): subclass of NSFilePromiseDragSource, to be used later
+ (-[WebFilePromiseDragSource draggingSource]):
+ (-[WebFilePromiseDragSource dealloc]):
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView mouseDragged:]): call _web_dragPromisedImage:fromOrigin:withURL:title:event:, retain self
+ (-[WebHTMLView draggedImage:endedAt:operation:]): added, release self
+ * WebView.subproj/WebImageView.m:
+ (-[WebImageView mouseDragged:]): call _web_dragPromisedImage:fromOrigin:withURL:title:event:, retain self
+ (-[WebImageView draggedImage:endedAt:operation:]): added, release self
+ * WebView.subproj/WebView.m:
+ (-[WebView isDocumentHTML]): call isKindOfClass instead of className
+ (-[WebView draggingEntered:]): check for WebFilePromiseDragSource
+
2002-11-24 Trey Matteson <trey at apple.com>
Added URLString method to WebHistoryItem to avoid silly conversions between
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.h b/WebKit/Misc.subproj/WebNSViewExtras.h
index 79d0454..7f41a62 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.h
+++ b/WebKit/Misc.subproj/WebNSViewExtras.h
@@ -35,15 +35,23 @@
// Returns NSDragOperationNone otherwise.
- (NSDragOperation)_web_dragOperationForDraggingInfo:(id <NSDraggingInfo>)sender;
-// Resizes and applies alpha to image, extends pboard and sets drag origins for dragging promised images.
-// Only call from within your overidden dragImage:at:offset:event:pasteboard:source:slideBack: method
-// after calling dragPromisedFilesOfTypes:fromRect:source:slideBack:event:
-// Only really needed by WebImageView and WebHTMLView.
-- (void)_web_setPromisedImageDragImage:(NSImage **)dragImage
- at:(NSPoint *)imageLoc
- offset:(NSSize *)mouseOffset
- andPasteboard:(NSPasteboard *)pboard
- withImage:(NSImage *)image
- andEvent:(NSEvent *)theEvent;
+// Resizes and applies alpha to image, extends pboard and sets drag origins for dragging promised image files.
+- (void)_web_dragPromisedImage:(NSImage *)image
+ fromOrigin:(NSPoint)origin
+ withURL:(NSURL *)URL
+ title:(NSString *)title
+ event:(NSEvent *)event;
@end
+
+ at interface NSFilePromiseDragSource : NSObject
+- initWithSource:(id)draggingSource;
+- (void)setTypes:(NSArray *)types onPasteboard:(NSPasteboard *)pboard;
+ at end
+
+ at interface WebFilePromiseDragSource : NSFilePromiseDragSource
+{
+ id _draggingSource;
+}
+- (id)draggingSource;
+ at end;
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.m b/WebKit/Misc.subproj/WebNSViewExtras.m
index ac26065..3a99bb7 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.m
+++ b/WebKit/Misc.subproj/WebNSViewExtras.m
@@ -158,34 +158,63 @@
}
#endif
-- (void)_web_setPromisedImageDragImage:(NSImage **)dragImage
- at:(NSPoint *)imageLoc
- offset:(NSSize *)mouseOffset
- andPasteboard:(NSPasteboard *)pboard
- withImage:(NSImage *)image
- andEvent:(NSEvent *)theEvent;
+- (void)_web_dragPromisedImage:(NSImage *)image
+ fromOrigin:(NSPoint)origin
+ withURL:(NSURL *)URL
+ title:(NSString *)title
+ event:(NSEvent *)event
{
- *dragImage = [[image copy] autorelease];
+ image = [[image copy] autorelease];
- NSSize originalSize = [*dragImage size];
- [*dragImage _web_scaleToMaxSize:WebMaxDragImageSize];
- NSSize newSize = [*dragImage size];
+ NSSize originalSize = [image size];
+ [image _web_scaleToMaxSize:WebMaxDragImageSize];
+ NSSize newSize = [image size];
- [*dragImage _web_dissolveToFraction:WebDragImageAlpha];
+ [image _web_dissolveToFraction:WebDragImageAlpha];
- NSPoint mouseDownPoint = [self convertPoint:[theEvent locationInWindow] fromView:nil];
+ NSPoint mouseDownPoint = [self convertPoint:[event locationInWindow] fromView:nil];
NSPoint currentPoint = [self convertPoint:[[_window currentEvent] locationInWindow] fromView:nil];
// Properly orient the drag image and orient it differently if it's smaller than the original
- imageLoc->x = mouseDownPoint.x - (((mouseDownPoint.x - imageLoc->x) / originalSize.width) * newSize.width);
- imageLoc->y = imageLoc->y + originalSize.height;
- imageLoc->y = mouseDownPoint.y - (((mouseDownPoint.y - imageLoc->y) / originalSize.height) * newSize.height);
+ origin.x = mouseDownPoint.x - (((mouseDownPoint.x - origin.x) / originalSize.width) * newSize.width);
+ origin.y = origin.y + originalSize.height;
+ origin.y = mouseDownPoint.y - (((mouseDownPoint.y - origin.y) / originalSize.height) * newSize.height);
NSSize offset = NSMakeSize(currentPoint.x - mouseDownPoint.x, currentPoint.y - mouseDownPoint.y);
- mouseOffset = &offset;
+
+ NSArray *filesTypes = [NSArray arrayWithObject:[[URL path] pathExtension]];
- [pboard addTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:self];
+ NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+ [pboard declareTypes:[NSArray arrayWithObjects:NSFilesPromisePboardType, NSTIFFPboardType] owner:self];
+ [pboard setPropertyList:filesTypes forType:NSFilesPromisePboardType];
[pboard setData:[image TIFFRepresentation] forType:NSTIFFPboardType];
+ [pboard _web_writeURL:URL andTitle:title withOwner:self];
+
+ id source = [[NSFilePromiseDragSource alloc] initWithSource:(id)self];
+ [source setTypes:filesTypes onPasteboard:pboard];
+
+ [self dragImage:image at:origin offset:offset event:event pasteboard:pboard source:source slideBack:YES];
}
@end
+
+ at implementation WebFilePromiseDragSource
+
+- initWithSource:(id)draggingSource
+{
+ [super initWithSource:draggingSource];
+ _draggingSource = draggingSource;
+ return self;
+}
+
+- (id)draggingSource
+{
+ return _draggingSource;
+}
+
+- (void)dealloc
+{
+ //[super dealloc];
+}
+
+ at end;
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebFrameView.m b/WebKit/WebView.subproj/WebFrameView.m
index f392cdc..65e6945 100644
--- a/WebKit/WebView.subproj/WebFrameView.m
+++ b/WebKit/WebView.subproj/WebFrameView.m
@@ -143,18 +143,22 @@ NSString *WebErrorDomainWebKit = @"WebErrorDomainWebKit";
- (BOOL)isDocumentHTML
{
- return [[[self documentView] className] isEqualToString:@"WebHTMLView"];
+ return [[self documentView] isKindOfClass:[WebHTMLView class]];
}
-
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
- if((![self documentView] || ([sender draggingSource] != [self documentView])) &&
- [[sender draggingPasteboard] _web_bestURL]) {
+ id draggingSource = [sender draggingSource];
+ if([draggingSource isKindOfClass:[WebFilePromiseDragSource class]]){
+ draggingSource = [draggingSource draggingSource];
+ }
+
+ if([[sender draggingPasteboard] _web_bestURL] &&
+ (![self documentView] || (draggingSource != [self documentView]))){
return NSDragOperationCopy;
- } else {
- return NSDragOperationNone;
}
+
+ return NSDragOperationNone;
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index eb197d7..f4d759d 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -598,41 +598,6 @@
[[self _bridge] mouseDown:event];
}
-- (void)dragImage:(NSImage *)anImage
- at:(NSPoint)imageLoc
- offset:(NSSize)mouseOffset
- event:(NSEvent *)theEvent
- pasteboard:(NSPasteboard *)pboard
- source:(id)sourceObject
- slideBack:(BOOL)slideBack
-{
- if (_private->draggingImageElement) {
- // Subclassing dragImage for image drags let's us change aspects of the drag that the
- // promised file API doesn't provide such as a different drag image, other pboard types etc.
-
- imageLoc = [[_private->draggingImageElement objectForKey:WebElementImageLocationKey] pointValue];
-
- [self _web_setPromisedImageDragImage:&anImage
- at:&imageLoc
- offset:&mouseOffset
- andPasteboard:pboard
- withImage:[_private->draggingImageElement objectForKey:WebElementImageKey]
- andEvent:theEvent];
- }
-
- [super dragImage:anImage
- at:imageLoc
- offset:mouseOffset
- event:theEvent
- pasteboard:pboard
- source:sourceObject
- slideBack:slideBack];
-
- // During a drag, we don't get any mouseMoved or flagsChanged events.
- // So after the drag we need to explicitly update the mouseover state.
- [self _updateMouseoverWithEvent:[NSApp currentEvent]];
-}
-
- (void)mouseDragged:(NSEvent *)event
{
// If the frame has a provisional data source, this view may be released.
@@ -668,13 +633,14 @@
if (imageURL){
_private->draggingImageElement = [element retain];
- // FIXME: Getting the file type this way doesn't always work
- [self dragPromisedFilesOfTypes:[NSArray arrayWithObject:[[imageURL path] pathExtension]]
- fromRect:NSZeroRect
- source:self
- slideBack:YES
- event:_private->mouseDownEvent];
+ // Retain this view during the drag because it may be released before the drag ends.
+ [self retain];
+ [self _web_dragPromisedImage:[element objectForKey:WebElementImageKey]
+ fromOrigin:[[element objectForKey:WebElementImageLocationKey] pointValue]
+ withURL:linkURL ? linkURL : imageURL
+ title:[element objectForKey:WebElementImageAltStringKey]
+ event:_private->mouseDownEvent];
}else if (linkURL) {
BOOL drawURLString = YES;
BOOL clipURLString = NO;
@@ -687,6 +653,7 @@
label = urlString;
}
+ // FIXME: This mega-block of code needs to be cleaned-up or put into another method.
NSFont *labelFont = [NSFont systemFontOfSize: 12.0];
NSFont *urlFont = [NSFont systemFontOfSize: 8.0];
NSDictionary *labelAttributes = [NSDictionary dictionaryWithObjectsAndKeys: labelFont, NSFontAttributeName, [NSColor whiteColor], NSForegroundColorAttributeName, nil];
@@ -757,7 +724,7 @@
NSPoint mousePoint = [self convertPoint:[event locationInWindow] fromView:nil];
NSSize centerOffset = NSMakeSize(imageSize.width / 2, -DRAG_LABEL_BORDER_Y);
NSPoint imagePoint = NSMakePoint(mousePoint.x - centerOffset.width, mousePoint.y - centerOffset.height);
-
+
[self dragImage:dragImage
at:imagePoint
offset:centerOffset
@@ -783,6 +750,16 @@
return NSDragOperationCopy;
}
+- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
+{
+ // During a drag, we don't get any mouseMoved or flagsChanged events.
+ // So after the drag we need to explicitly update the mouseover state.
+ [self _updateMouseoverWithEvent:[NSApp currentEvent]];
+
+ // Balance the previous retain from when the drag started.
+ [self release];
+}
+
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
NSURL *imageURL = [_private->draggingImageElement objectForKey: WebElementImageURLKey];
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index f66a217..0fea9e2 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -161,49 +161,32 @@
- (void)mouseDragged:(NSEvent *)event
{
if(acceptsDrags){
- [self dragPromisedFilesOfTypes:[NSArray arrayWithObject:[[[representation URL] path] pathExtension]]
- fromRect:NSZeroRect
- source:self
- slideBack:YES
- event:event];
+ // Retain this view during the drag because it may be released before the drag ends.
+ [self retain];
+
+ [self _web_dragPromisedImage:[representation image]
+ fromOrigin:NSZeroPoint
+ withURL:[representation URL]
+ title:nil
+ event:event];
}
}
-// Subclassing dragImage for image drags let's us change aspects of the drag that the
-// promised file API doesn't provide such as a different drag image, other pboard types etc.
-- (void)dragImage:(NSImage *)anImage
- at:(NSPoint)imageLoc
- offset:(NSSize)mouseOffset
- event:(NSEvent *)theEvent
- pasteboard:(NSPasteboard *)pboard
- source:(id)sourceObject
- slideBack:(BOOL)slideBack
-{
- [self _web_setPromisedImageDragImage:&anImage
- at:&imageLoc
- offset:&mouseOffset
- andPasteboard:pboard
- withImage:[representation image]
- andEvent:theEvent];
-
- [super dragImage:anImage
- at:imageLoc
- offset:mouseOffset
- event:theEvent
- pasteboard:pboard
- source:sourceObject
- slideBack:slideBack];
-}
-
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
{
NSURL *URL = [representation URL];
NSString *filename = [[URL path] lastPathComponent];
NSString *path = [[dropDestination path] stringByAppendingPathComponent:filename];
-
+
[[self controller] _downloadURL:URL toPath:path];
return [NSArray arrayWithObject:filename];
}
+- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
+{
+ // Balance the previous retain from when the drag started.
+ [self release];
+}
+
@end
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list