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/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
| 6 | 6 |
| 7 #include "ash/drag_drop/drag_drop_tracker.h" | 7 #include "ash/drag_drop/drag_drop_tracker.h" |
| 8 #include "ash/drag_drop/drag_image_view.h" | 8 #include "ash/drag_drop/drag_image_view.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 static const int kTouchDragImageVerticalOffset = -25; | 44 static const int kTouchDragImageVerticalOffset = -25; |
| 45 | 45 |
| 46 // Adjusts the drag image bounds such that the new bounds are scaled by |scale| | 46 // Adjusts the drag image bounds such that the new bounds are scaled by |scale| |
| 47 // and translated by the |drag_image_offset| and and additional | 47 // and translated by the |drag_image_offset| and and additional |
| 48 // |vertical_offset|. | 48 // |vertical_offset|. |
| 49 gfx::Rect AdjustDragImageBoundsForScaleAndOffset( | 49 gfx::Rect AdjustDragImageBoundsForScaleAndOffset( |
| 50 const gfx::Rect& drag_image_bounds, | 50 const gfx::Rect& drag_image_bounds, |
| 51 int vertical_offset, | 51 int vertical_offset, |
| 52 float scale, | 52 float scale, |
| 53 gfx::Vector2d* drag_image_offset) { | 53 gfx::Vector2d* drag_image_offset) { |
| 54 gfx::PointF final_origin = drag_image_bounds.origin(); | 54 gfx::PointF final_origin(drag_image_bounds.origin()); |
|
sky
2015/10/23 21:13:13
You don't need the floating point until the RectF
danakj
2015/10/23 21:46:10
Done.
| |
| 55 gfx::SizeF final_size = gfx::SizeF(drag_image_bounds.size()); | 55 gfx::SizeF final_size(drag_image_bounds.size()); |
| 56 final_size.Scale(scale); | 56 final_size.Scale(scale); |
| 57 drag_image_offset->set_x(drag_image_offset->x() * scale); | 57 drag_image_offset->set_x(drag_image_offset->x() * scale); |
| 58 drag_image_offset->set_y(drag_image_offset->y() * scale); | 58 drag_image_offset->set_y(drag_image_offset->y() * scale); |
| 59 float total_x_offset = drag_image_offset->x(); | 59 float total_x_offset = drag_image_offset->x(); |
|
danakj
2015/10/23 21:46:10
made these ints too
| |
| 60 float total_y_offset = drag_image_offset->y() - vertical_offset; | 60 float total_y_offset = drag_image_offset->y() - vertical_offset; |
| 61 final_origin.Offset(-total_x_offset, -total_y_offset); | 61 final_origin.Offset(-total_x_offset, -total_y_offset); |
| 62 return gfx::ToEnclosingRect(gfx::RectF(final_origin, final_size)); | 62 return gfx::ToEnclosingRect(gfx::RectF(final_origin, final_size)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DispatchGestureEndToWindow(aura::Window* window) { | 65 void DispatchGestureEndToWindow(aura::Window* window) { |
| 66 if (window && window->delegate()) { | 66 if (window && window->delegate()) { |
| 67 ui::GestureEvent gesture_end(0, | 67 ui::GestureEvent gesture_end(0, |
| 68 0, | 68 0, |
| 69 0, | 69 0, |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 555 if (drag_window_) | 555 if (drag_window_) |
| 556 drag_window_->RemoveObserver(this); | 556 drag_window_->RemoveObserver(this); |
| 557 drag_window_ = NULL; | 557 drag_window_ = NULL; |
| 558 drag_data_ = NULL; | 558 drag_data_ = NULL; |
| 559 // Cleanup can be called again while deleting DragDropTracker, so delete | 559 // Cleanup can be called again while deleting DragDropTracker, so delete |
| 560 // the pointer with a local variable to avoid double free. | 560 // the pointer with a local variable to avoid double free. |
| 561 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass(); | 561 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass(); |
| 562 } | 562 } |
| 563 | 563 |
| 564 } // namespace ash | 564 } // namespace ash |
| OLD | NEW |