Commit 1dd7d7fe authored by Sidney San Martín's avatar Sidney San Martín Committed by Commit Bot

Revert an incorrect workaround for a crash.

This reverts commit 80e335a5.

Bug: 826632
Change-Id: I159ce3037f96af582b6095dca69d4d1cd4318843
Reviewed-on: https://chromium-review.googlesource.com/1014363
Commit-Queue: Sidney San Martín <sdy@chromium.org>
Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551320}
parent c295dd83
...@@ -654,38 +654,26 @@ NSTextField* MakeLabel( ...@@ -654,38 +654,26 @@ NSTextField* MakeLabel(
draggingItem.draggingFrame = dragRect; draggingItem.draggingFrame = dragRect;
draggingItem.imageComponentsProvider = ^{ draggingItem.imageComponentsProvider = ^{
// If either component is zero sized (which shouldn't generally happen, but NSDraggingImageComponent* imageComponent =
// apparently can… maybe a missing icon or empty string title?), omit it, [[[NSDraggingImageComponent alloc]
// else the dragging session will create layers with NaN components and initWithKey:NSDraggingImageComponentIconKey] autorelease];
// crash. NSImage* image = imageView_.image;
auto* components = [NSMutableArray<NSDraggingImageComponent*> array]; imageComponent.contents = image;
if (imageRect.size.width != 0 && imageRect.size.height != 0) { imageComponent.frame =
NSDraggingImageComponent* imageComponent = NSOffsetRect(imageRect, -dragRect.origin.x, -dragRect.origin.y);
[[[NSDraggingImageComponent alloc] NSDraggingImageComponent* labelComponent =
initWithKey:NSDraggingImageComponentIconKey] autorelease]; [[[NSDraggingImageComponent alloc]
NSImage* image = imageView_.image; initWithKey:NSDraggingImageComponentLabelKey] autorelease];
imageComponent.contents = image;
imageComponent.frame = labelComponent.contents = [NSImage imageWithSize:labelRect.size
NSOffsetRect(imageRect, -dragRect.origin.x, -dragRect.origin.y); flipped:NO
[components addObject:imageComponent]; drawingHandler:^(NSRect rect) {
} [filename drawAtPoint:NSZeroPoint];
if (labelRect.size.width != 0 && labelRect.size.height != 0) { return YES;
NSDraggingImageComponent* labelComponent = }];
[[[NSDraggingImageComponent alloc] labelComponent.frame =
initWithKey:NSDraggingImageComponentLabelKey] autorelease]; NSOffsetRect(labelRect, -dragRect.origin.x, -dragRect.origin.y);
return @[ imageComponent, labelComponent ];
labelComponent.contents = [NSImage imageWithSize:labelRect.size
flipped:NO
drawingHandler:^(NSRect rect) {
[filename drawAtPoint:NSZeroPoint];
return YES;
}];
labelComponent.frame =
NSOffsetRect(labelRect, -dragRect.origin.x, -dragRect.origin.y);
[components addObject:labelComponent];
}
return components;
}; };
[self beginDraggingSessionWithItems:@[ draggingItem ] [self beginDraggingSessionWithItems:@[ draggingItem ]
event:event event:event
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment