Commit f3403612 authored by edchin's avatar edchin Committed by Commit Bot

[ios] Allow drop into last position in tabgrid

Previously, a nil destinationIndexPath would be interpreted
as position zero. This interprets nil as the last position.

Bug: 1102570
Change-Id: I030c32eaf1bf400b6b7d08bb9b0293c858cf6366
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2339405
Commit-Queue: edchin <edchin@chromium.org>
Commit-Queue: Sergio Collazos <sczs@chromium.org>
Auto-Submit: edchin <edchin@chromium.org>
Reviewed-by: default avatarSergio Collazos <sczs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795292}
parent 22ea9310
......@@ -452,10 +452,15 @@ NSIndexPath* CreateIndexPath(NSInteger index) {
performDropWithCoordinator:
(id<UICollectionViewDropCoordinator>)coordinator {
id<UICollectionViewDropItem> item = coordinator.items.firstObject;
NSIndexPath* dropIndexPath = coordinator.destinationIndexPath;
if (!dropIndexPath) {
dropIndexPath = [NSIndexPath indexPathForItem:self.items.count inSection:0];
}
NSUInteger destinationIndex =
base::checked_cast<NSUInteger>(coordinator.destinationIndexPath.item);
[coordinator dropItem:item.dragItem
toItemAtIndexPath:coordinator.destinationIndexPath];
base::checked_cast<NSUInteger>(dropIndexPath.item);
[coordinator dropItem:item.dragItem toItemAtIndexPath:dropIndexPath];
// TODO(crbug.com/1095200): Handle the edge case that two windows are
// simultaneously dragging and dropping.
......
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