Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(536)

Unified Diff: ui/app_list/views/apps_grid_view.cc

Issue 583263004: Fix app list duplication on drag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@start_page_padding
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/app_list/views/app_list_main_view_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/apps_grid_view.cc
diff --git a/ui/app_list/views/apps_grid_view.cc b/ui/app_list/views/apps_grid_view.cc
index 6388e05c4673c2ee8d58245e657fc35f55f2a36d..af37ebdb9908f92b14131114451806f8f1f7d0e0 100644
--- a/ui/app_list/views/apps_grid_view.cc
+++ b/ui/app_list/views/apps_grid_view.cc
@@ -1400,6 +1400,7 @@ bool AppsGridView::CalculateFolderDropTarget(const gfx::Point& point,
!IsFolderItem(drag_view_->item()) &&
CanDropIntoTarget(nearest_tile_index)) {
*drop_target = nearest_tile_index;
+ DCHECK(IsValidIndex(*drop_target));
return true;
}
@@ -1436,6 +1437,7 @@ void AppsGridView::CalculateReorderDropTarget(const gfx::Point& point,
*drop_target =
std::min(Index(pagination_model_.selected_page(), row * cols_ + col),
GetLastViewIndex());
+ DCHECK(IsValidIndex(*drop_target));
}
void AppsGridView::OnReorderTimer() {
@@ -1550,6 +1552,8 @@ void AppsGridView::EndDragFromReparentItemInRootLevel(
} else if (drop_attempt_ == DROP_FOR_FOLDER &&
IsValidIndex(folder_drop_target_)) {
ReparentItemToAnotherFolder(drag_view_, folder_drop_target_);
+ } else {
+ NOTREACHED();
}
SetViewHidden(drag_view_, false /* show */, true /* no animate */);
}
@@ -2095,9 +2099,10 @@ AppsGridView::Index AppsGridView::GetNearestTileIndexForPoint(
gfx::Rect bounds = GetContentsBounds();
gfx::Size total_tile_size = GetTotalTileSize();
int col = ClampToRange(
- (point.x() - bounds.x()) / total_tile_size.width(), 0, cols_);
- int row = ClampToRange(
- (point.y() - bounds.y()) / total_tile_size.height(), 0, rows_per_page_);
+ (point.x() - bounds.x()) / total_tile_size.width(), 0, cols_ - 1);
+ int row = ClampToRange((point.y() - bounds.y()) / total_tile_size.height(),
+ 0,
+ rows_per_page_ - 1);
return Index(pagination_model_.selected_page(), row * cols_ + col);
}
« no previous file with comments | « ui/app_list/views/app_list_main_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698