| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shelf/shelf_view.h" | 5 #include "ash/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 if (overflow_bubble_) | 310 if (overflow_bubble_) |
| 311 overflow_bubble_->Hide(); | 311 overflow_bubble_->Hide(); |
| 312 // For crbug.com/587931, because AppListButton layout logic is in OnPaint. | 312 // For crbug.com/587931, because AppListButton layout logic is in OnPaint. |
| 313 AppListButton* app_list_button = GetAppListButton(); | 313 AppListButton* app_list_button = GetAppListButton(); |
| 314 if (app_list_button) | 314 if (app_list_button) |
| 315 app_list_button->SchedulePaint(); | 315 app_list_button->SchedulePaint(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) { | 318 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) { |
| 319 int index = model_->ItemIndexByID(id); | 319 int index = model_->ItemIndexByID(id); |
| 320 if (index == -1) | 320 if (index < 0 || last_visible_index_ < 0) |
| 321 return gfx::Rect(); | 321 return gfx::Rect(); |
| 322 // Map all items from overflow area to the overflow button. Note that the | 322 // Map all items from overflow area to the overflow button. Note that the |
| 323 // section between last_index_hidden_ and model_->FirstPanelIndex() is the | 323 // section between last_index_hidden_ and model_->FirstPanelIndex() is the |
| 324 // list of invisible panel items. However, these items are currently nowhere | 324 // list of invisible panel items. However, these items are currently nowhere |
| 325 // represented and get dropped instead - see (crbug.com/378907). As such there | 325 // represented and get dropped instead - see (crbug.com/378907). As such there |
| 326 // is no way to address them or place them. We therefore move them over the | 326 // is no way to address them or place them. We therefore move them over the |
| 327 // overflow button. | 327 // overflow button. |
| 328 if (index > last_visible_index_ && index < model_->FirstPanelIndex()) | 328 if (index > last_visible_index_ && index < model_->FirstPanelIndex()) |
| 329 index = last_visible_index_ + 1; | 329 index = last_visible_index_ + 1; |
| 330 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index)); | 330 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index)); |
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1760 | 1760 |
| 1761 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { | 1761 int ShelfView::CalculateShelfDistance(const gfx::Point& coordinate) const { |
| 1762 const gfx::Rect bounds = GetBoundsInScreen(); | 1762 const gfx::Rect bounds = GetBoundsInScreen(); |
| 1763 int distance = wm_shelf_->SelectValueForShelfAlignment( | 1763 int distance = wm_shelf_->SelectValueForShelfAlignment( |
| 1764 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), | 1764 bounds.y() - coordinate.y(), coordinate.x() - bounds.right(), |
| 1765 bounds.x() - coordinate.x()); | 1765 bounds.x() - coordinate.x()); |
| 1766 return distance > 0 ? distance : 0; | 1766 return distance > 0 ? distance : 0; |
| 1767 } | 1767 } |
| 1768 | 1768 |
| 1769 } // namespace ash | 1769 } // namespace ash |
| OLD | NEW |