Mac: Update drag&drop image creation.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@943 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
33fad449b6
commit
086f3cb47d
|
@ -22,6 +22,9 @@
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPopupMenu.h"
|
||||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
||||||
|
#include "ui/base/layout.h"
|
||||||
|
#include "ui/gfx/image/image_skia.h"
|
||||||
|
#include "ui/gfx/image/image_skia_util_mac.h"
|
||||||
#include "webkit/glue/webcursor.h"
|
#include "webkit/glue/webcursor.h"
|
||||||
#include "webkit/glue/webdropdata.h"
|
#include "webkit/glue/webdropdata.h"
|
||||||
#include "webkit/plugins/npapi/plugin_list.h"
|
#include "webkit/plugins/npapi/plugin_list.h"
|
||||||
|
@ -396,9 +399,11 @@ void BrowserWebViewDelegate::startDragging(
|
||||||
|
|
||||||
NSImage* ns_image = nil;
|
NSImage* ns_image = nil;
|
||||||
if (!image.isNull()) {
|
if (!image.isNull()) {
|
||||||
const SkBitmap& bitmap = image.getSkBitmap();
|
ui::ScaleFactor scale_factor =
|
||||||
CGColorSpaceRef color_space = base::mac::GetSystemColorSpace();
|
ui::GetScaleFactorForNativeView(host->view_handle());
|
||||||
ns_image = gfx::SkBitmapToNSImageWithColorSpace(bitmap, color_space);
|
gfx::ImageSkia image_skia(
|
||||||
|
gfx::ImageSkiaRep(image.getSkBitmap(), scale_factor));
|
||||||
|
ns_image = gfx::NSImageFromImageSkia(image_skia);
|
||||||
}
|
}
|
||||||
NSPoint offset = NSPointFromCGPoint(gfx::Point(image_offset).ToCGPoint());
|
NSPoint offset = NSPointFromCGPoint(gfx::Point(image_offset).ToCGPoint());
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,6 @@ void PromiseWriterHelper(const WebDropData& drop_data,
|
||||||
@interface WebDragSource(Private)
|
@interface WebDragSource(Private)
|
||||||
|
|
||||||
- (void)fillPasteboard;
|
- (void)fillPasteboard;
|
||||||
- (NSImage*)dragImage;
|
|
||||||
|
|
||||||
@end // @interface WebDragSource(Private)
|
@end // @interface WebDragSource(Private)
|
||||||
|
|
||||||
|
@ -238,9 +237,10 @@ void PromiseWriterHelper(const WebDropData& drop_data,
|
||||||
// Deal with Cocoa's flipped coordinate system.
|
// Deal with Cocoa's flipped coordinate system.
|
||||||
position.y -= [dragImage_.get() size].height - imageOffset_.y;
|
position.y -= [dragImage_.get() size].height - imageOffset_.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Per kwebster, offset arg is ignored, see -_web_DragImageForElement: in
|
// Per kwebster, offset arg is ignored, see -_web_DragImageForElement: in
|
||||||
// third_party/WebKit/Source/WebKit/mac/Misc/WebNSViewExtras.m.
|
// third_party/WebKit/Source/WebKit/mac/Misc/WebNSViewExtras.m.
|
||||||
[window dragImage:[self dragImage]
|
[window dragImage:dragImage_
|
||||||
at:position
|
at:position
|
||||||
offset:NSZeroSize
|
offset:NSZeroSize
|
||||||
event:dragEvent
|
event:dragEvent
|
||||||
|
@ -423,12 +423,4 @@ void PromiseWriterHelper(const WebDropData& drop_data,
|
||||||
owner:view_];
|
owner:view_];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSImage*)dragImage {
|
|
||||||
if (dragImage_)
|
|
||||||
return dragImage_;
|
|
||||||
|
|
||||||
// Default to returning a generic image.
|
|
||||||
return gfx::GetCachedImageWithName(@"nav.pdf");
|
|
||||||
}
|
|
||||||
|
|
||||||
@end // @implementation WebDragSource (Private)
|
@end // @implementation WebDragSource (Private)
|
||||||
|
|
Loading…
Reference in New Issue