Chromium Code Reviews| 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 | 8 |
| 9 #include "ash/ash_constants.h" | 9 #include "ash/ash_constants.h" |
| 10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 for (int i = 0; i < view_model_->view_size(); ++i) { | 447 for (int i = 0; i < view_model_->view_size(); ++i) { |
| 448 if (i >= first_visible_index_ && i <= last_visible_index_) | 448 if (i >= first_visible_index_ && i <= last_visible_index_) |
| 449 view_model_->view_at(i)->SchedulePaint(); | 449 view_model_->view_at(i)->SchedulePaint(); |
| 450 } | 450 } |
| 451 if (overflow_button_ && overflow_button_->visible()) | 451 if (overflow_button_ && overflow_button_->visible()) |
| 452 overflow_button_->SchedulePaint(); | 452 overflow_button_->SchedulePaint(); |
| 453 } | 453 } |
| 454 | 454 |
| 455 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) { | 455 gfx::Rect ShelfView::GetIdealBoundsOfItemIcon(ShelfID id) { |
| 456 int index = model_->ItemIndexByID(id); | 456 int index = model_->ItemIndexByID(id); |
| 457 if (index == -1 || (index > last_visible_index_ && | 457 if (index == -1) |
| 458 index < model_->FirstPanelIndex())) | |
| 459 return gfx::Rect(); | 458 return gfx::Rect(); |
| 459 // Map all items from overflow area to the overflow button. | |
| 460 if (index > last_visible_index_ && index < model_->FirstPanelIndex()) | |
|
flackr
2014/05/29 17:05:01
Does this currently work for overflowed panels? Or
Mr4D (OOO till 08-26)
2014/05/29 20:09:51
Yes - and no. Updated comment.
But in the essence
| |
| 461 index = last_visible_index_ + 1; | |
| 460 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index)); | 462 const gfx::Rect& ideal_bounds(view_model_->ideal_bounds(index)); |
| 461 DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type); | 463 DCHECK_NE(TYPE_APP_LIST, model_->items()[index].type); |
| 462 ShelfButton* button = static_cast<ShelfButton*>(view_model_->view_at(index)); | 464 ShelfButton* button = static_cast<ShelfButton*>(view_model_->view_at(index)); |
| 463 gfx::Rect icon_bounds = button->GetIconBounds(); | 465 gfx::Rect icon_bounds = button->GetIconBounds(); |
| 464 return gfx::Rect(GetMirroredXWithWidthInView( | 466 return gfx::Rect(GetMirroredXWithWidthInView( |
| 465 ideal_bounds.x() + icon_bounds.x(), icon_bounds.width()), | 467 ideal_bounds.x() + icon_bounds.x(), icon_bounds.width()), |
| 466 ideal_bounds.y() + icon_bounds.y(), | 468 ideal_bounds.y() + icon_bounds.y(), |
| 467 icon_bounds.width(), | 469 icon_bounds.width(), |
| 468 icon_bounds.height()); | 470 icon_bounds.height()); |
| 469 } | 471 } |
| (...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1916 distance = bounds.x() - coordinate.x(); | 1918 distance = bounds.x() - coordinate.x(); |
| 1917 break; | 1919 break; |
| 1918 case SHELF_ALIGNMENT_TOP: | 1920 case SHELF_ALIGNMENT_TOP: |
| 1919 distance = coordinate.y() - bounds.bottom(); | 1921 distance = coordinate.y() - bounds.bottom(); |
| 1920 break; | 1922 break; |
| 1921 } | 1923 } |
| 1922 return distance > 0 ? distance : 0; | 1924 return distance > 0 ? distance : 0; |
| 1923 } | 1925 } |
| 1924 | 1926 |
| 1925 } // namespace ash | 1927 } // namespace ash |
| OLD | NEW |