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

Side by Side Diff: ash/display/event_transformation_handler.cc

Issue 139983009: ui::LocatedEvent location() returns gfx::PointF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Undo accidental change. Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/display/event_transformation_handler.h" 5 #include "ash/display/event_transformation_handler.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/coordinate_conversion.h" 10 #include "ash/wm/coordinate_conversion.h"
(...skipping 22 matching lines...) Expand all
33 33
34 EventTransformationHandler::~EventTransformationHandler() { 34 EventTransformationHandler::~EventTransformationHandler() {
35 } 35 }
36 36
37 void EventTransformationHandler::OnScrollEvent(ui::ScrollEvent* event) { 37 void EventTransformationHandler::OnScrollEvent(ui::ScrollEvent* event) {
38 if (transformation_mode_ == TRANSFORM_NONE) 38 if (transformation_mode_ == TRANSFORM_NONE)
39 return; 39 return;
40 40
41 // It is unnecessary to scale the event for the device scale factor since 41 // It is unnecessary to scale the event for the device scale factor since
42 // the event locations etc. are already in DIP. 42 // the event locations etc. are already in DIP.
43 gfx::Point point_in_screen(event->location()); 43 gfx::Point point_in_screen(gfx::ToFlooredPoint(event->location()));
44 aura::Window* target = static_cast<aura::Window*>(event->target()); 44 aura::Window* target = static_cast<aura::Window*>(event->target());
45 wm::ConvertPointToScreen(target, &point_in_screen); 45 wm::ConvertPointToScreen(target, &point_in_screen);
46 const gfx::Display& display = 46 const gfx::Display& display =
47 Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen); 47 Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen);
48 48
49 // Apply some additional scaling if the display is non-integrated. 49 // Apply some additional scaling if the display is non-integrated.
50 if (!display.IsInternal()) 50 if (!display.IsInternal())
51 event->Scale(kBoostForNonIntegrated); 51 event->Scale(kBoostForNonIntegrated);
52 } 52 }
53 53
(...skipping 30 matching lines...) Expand all
84 return; 84 return;
85 } 85 }
86 86
87 float area_ratio_sqrt = std::sqrt(area_ratio_map.begin()->second); 87 float area_ratio_sqrt = std::sqrt(area_ratio_map.begin()->second);
88 event->set_radius_x(event->radius_x() * area_ratio_sqrt); 88 event->set_radius_x(event->radius_x() * area_ratio_sqrt);
89 event->set_radius_y(event->radius_y() * area_ratio_sqrt); 89 event->set_radius_y(event->radius_y() * area_ratio_sqrt);
90 } 90 }
91 #endif // defined(OS_CHROMEOS) 91 #endif // defined(OS_CHROMEOS)
92 92
93 } // namespace ash 93 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698