Index: ui/app_list/cocoa/apps_collection_view_drag_manager.mm |
diff --git a/ui/app_list/cocoa/apps_collection_view_drag_manager.mm b/ui/app_list/cocoa/apps_collection_view_drag_manager.mm |
index ba5200f3016742105ff413ab06244780f63e6e61..42b955a18157731ef2b95084496d83c8d2e82433 100644 |
--- a/ui/app_list/cocoa/apps_collection_view_drag_manager.mm |
+++ b/ui/app_list/cocoa/apps_collection_view_drag_manager.mm |
@@ -145,7 +145,7 @@ const CGFloat kDragThreshold = 5; |
if (!itemDragController_) { |
itemDragController_.reset( |
[[ItemDragController alloc] initWithGridCellSize:cellSize_]); |
- [[gridController_ view] addSubview:[itemDragController_ view]]; |
+ [[[gridController_ view] superview] addSubview:[itemDragController_ view]]; |
} |
[itemDragController_ initiate:[gridController_ itemAtIndex:itemHitIndex_] |
@@ -160,6 +160,8 @@ const CGFloat kDragThreshold = 5; |
- (void)updateDrag:(NSEvent*)theEvent { |
[itemDragController_ update:[theEvent locationInWindow] |
timestamp:[theEvent timestamp]]; |
+ [gridController_ maybeChangePageForPoint:[theEvent locationInWindow]]; |
+ |
size_t visiblePage = [gridController_ visiblePage]; |
size_t itemIndexOver = [self itemIndexForPage:visiblePage |
hitWithEvent:theEvent]; |
@@ -195,6 +197,7 @@ const CGFloat kDragThreshold = 5; |
- (void)completeDrag { |
DCHECK_GE(itemDragIndex_, 0u); |
+ [gridController_ cancelScrollTimer]; |
AppsGridViewItem* item = [gridController_ itemAtIndex:itemDragIndex_]; |
// The item could still be animating in the NSCollectionView, so ask it where |
@@ -202,7 +205,7 @@ const CGFloat kDragThreshold = 5; |
NSCollectionView* pageView = base::mac::ObjCCastStrict<NSCollectionView>( |
[[item view] superview]); |
size_t indexInPage = itemDragIndex_ % (rows_ * columns_); |
- NSPoint targetOrigin = [[gridController_ view] |
+ NSPoint targetOrigin = [[[itemDragController_ view] superview] |
convertPoint:[pageView frameForItemAtIndex:indexInPage].origin |
fromView:pageView]; |