зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1562048 - Draw the fallback drag image using a different API. r=spohl
This also fixes a leak - the return value is expected to be autoreleased. Differential Revision: https://phabricator.services.mozilla.com/D36252 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b6e7a0b743
Коммит
5f8ce768ac
|
@ -72,18 +72,15 @@ NSImage* nsDragService::ConstructDragImage(nsINode* aDOMNode, const Maybe<CSSInt
|
|||
NSSize size;
|
||||
size.width = nsCocoaUtils::DevPixelsToCocoaPoints(dragRect.width, scaleFactor);
|
||||
size.height = nsCocoaUtils::DevPixelsToCocoaPoints(dragRect.height, scaleFactor);
|
||||
image = [[NSImage alloc] initWithSize:size];
|
||||
[image lockFocus];
|
||||
[[NSColor grayColor] set];
|
||||
NSBezierPath* path = [NSBezierPath bezierPath];
|
||||
[path setLineWidth:2.0];
|
||||
[path moveToPoint:NSMakePoint(0, 0)];
|
||||
[path lineToPoint:NSMakePoint(0, size.height)];
|
||||
[path lineToPoint:NSMakePoint(size.width, size.height)];
|
||||
[path lineToPoint:NSMakePoint(size.width, 0)];
|
||||
[path lineToPoint:NSMakePoint(0, 0)];
|
||||
[path stroke];
|
||||
[image unlockFocus];
|
||||
image = [NSImage imageWithSize:size
|
||||
flipped:YES
|
||||
drawingHandler:^BOOL(NSRect dstRect) {
|
||||
[[NSColor grayColor] set];
|
||||
NSBezierPath* path = [NSBezierPath bezierPathWithRect:dstRect];
|
||||
[path setLineWidth:2.0];
|
||||
[path stroke];
|
||||
return YES;
|
||||
}];
|
||||
}
|
||||
|
||||
LayoutDeviceIntPoint pt(dragRect.x, dragRect.YMost());
|
||||
|
|
Загрузка…
Ссылка в новой задаче