| 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 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 // check if the item got ripped off the shelf - if it did we are done. | 941 // check if the item got ripped off the shelf - if it did we are done. |
| 942 if (!drag_and_drop_shelf_id_ && | 942 if (!drag_and_drop_shelf_id_ && |
| 943 RemovableByRipOff(current_index) != NOT_REMOVABLE) { | 943 RemovableByRipOff(current_index) != NOT_REMOVABLE) { |
| 944 if (HandleRipOffDrag(event)) | 944 if (HandleRipOffDrag(event)) |
| 945 return; | 945 return; |
| 946 // The rip off handler could have changed the location of the item. | 946 // The rip off handler could have changed the location of the item. |
| 947 current_index = view_model_->GetIndexOfView(drag_view_); | 947 current_index = view_model_->GetIndexOfView(drag_view_); |
| 948 } | 948 } |
| 949 | 949 |
| 950 // TODO: I don't think this works correctly with RTL. | 950 // TODO: I don't think this works correctly with RTL. |
| 951 gfx::Point drag_point(event.location()); | 951 gfx::Point drag_point(gfx::ToFlooredPoint(event.location())); |
| 952 ConvertPointToTarget(drag_view_, this, &drag_point); | 952 ConvertPointToTarget(drag_view_, this, &drag_point); |
| 953 | 953 |
| 954 // Constrain the location to the range of valid indices for the type. | 954 // Constrain the location to the range of valid indices for the type. |
| 955 std::pair<int, int> indices(GetDragRange(current_index)); | 955 std::pair<int, int> indices(GetDragRange(current_index)); |
| 956 int first_drag_index = indices.first; | 956 int first_drag_index = indices.first; |
| 957 int last_drag_index = indices.second; | 957 int last_drag_index = indices.second; |
| 958 // If the last index isn't valid, we're overflowing. Constrain to the app list | 958 // If the last index isn't valid, we're overflowing. Constrain to the app list |
| 959 // (which is the last visible item). | 959 // (which is the last visible item). |
| 960 if (first_drag_index < model_->FirstPanelIndex() && | 960 if (first_drag_index < model_->FirstPanelIndex() && |
| 961 last_drag_index > last_visible_index_) | 961 last_drag_index > last_visible_index_) |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 distance = bounds.x() - coordinate.x(); | 1916 distance = bounds.x() - coordinate.x(); |
| 1917 break; | 1917 break; |
| 1918 case SHELF_ALIGNMENT_TOP: | 1918 case SHELF_ALIGNMENT_TOP: |
| 1919 distance = coordinate.y() - bounds.bottom(); | 1919 distance = coordinate.y() - bounds.bottom(); |
| 1920 break; | 1920 break; |
| 1921 } | 1921 } |
| 1922 return distance > 0 ? distance : 0; | 1922 return distance > 0 ? distance : 0; |
| 1923 } | 1923 } |
| 1924 | 1924 |
| 1925 } // namespace ash | 1925 } // namespace ash |
| OLD | NEW |