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

Side by Side Diff: ash/drag_drop/drag_drop_controller.cc

Issue 1421713002: Explicitly convert Point to PointF for event code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@wip
Patch Set: pointfconvert-prod: . Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | ash/drag_drop/drag_drop_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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::Point final_origin = drag_image_bounds.origin();
55 gfx::SizeF final_size = gfx::SizeF(drag_image_bounds.size()); 55 gfx::SizeF final_size = gfx::SizeF(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 int total_x_offset = drag_image_offset->x();
60 float total_y_offset = drag_image_offset->y() - vertical_offset; 60 int 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(
63 gfx::RectF(gfx::PointF(final_origin), final_size));
63 } 64 }
64 65
65 void DispatchGestureEndToWindow(aura::Window* window) { 66 void DispatchGestureEndToWindow(aura::Window* window) {
66 if (window && window->delegate()) { 67 if (window && window->delegate()) {
67 ui::GestureEvent gesture_end(0, 68 ui::GestureEvent gesture_end(0,
68 0, 69 0,
69 0, 70 0,
70 ui::EventTimeForNow(), 71 ui::EventTimeForNow(),
71 ui::GestureEventDetails(ui::ET_GESTURE_END)); 72 ui::GestureEventDetails(ui::ET_GESTURE_END));
72 window->delegate()->OnGestureEvent(&gesture_end); 73 window->delegate()->OnGestureEvent(&gesture_end);
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 if (drag_window_) 556 if (drag_window_)
556 drag_window_->RemoveObserver(this); 557 drag_window_->RemoveObserver(this);
557 drag_window_ = NULL; 558 drag_window_ = NULL;
558 drag_data_ = NULL; 559 drag_data_ = NULL;
559 // Cleanup can be called again while deleting DragDropTracker, so delete 560 // Cleanup can be called again while deleting DragDropTracker, so delete
560 // the pointer with a local variable to avoid double free. 561 // the pointer with a local variable to avoid double free.
561 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass(); 562 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass();
562 } 563 }
563 564
564 } // namespace ash 565 } // namespace ash
OLDNEW
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | ash/drag_drop/drag_drop_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698