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

Side by Side Diff: ui/events/event.cc

Issue 1027193003: Make MouseWheelEvent::UpdateForRootTransform() not scale the mouse wheel offset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « ui/events/event.h ('k') | no next file » | 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 "ui/events/event.h" 5 #include "ui/events/event.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/keysym.h> 9 #include <X11/keysym.h>
10 #include <X11/Xlib.h> 10 #include <X11/Xlib.h>
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 498
499 #if defined(OS_WIN) 499 #if defined(OS_WIN)
500 // This value matches windows WHEEL_DELTA. 500 // This value matches windows WHEEL_DELTA.
501 // static 501 // static
502 const int MouseWheelEvent::kWheelDelta = 120; 502 const int MouseWheelEvent::kWheelDelta = 120;
503 #else 503 #else
504 // This value matches GTK+ wheel scroll amount. 504 // This value matches GTK+ wheel scroll amount.
505 const int MouseWheelEvent::kWheelDelta = 53; 505 const int MouseWheelEvent::kWheelDelta = 53;
506 #endif 506 #endif
507 507
508 void MouseWheelEvent::UpdateForRootTransform(
509 const gfx::Transform& inverted_root_transform) {
510 LocatedEvent::UpdateForRootTransform(inverted_root_transform);
511 gfx::DecomposedTransform decomp;
512 bool success = gfx::DecomposeTransform(&decomp, inverted_root_transform);
513 DCHECK(success);
514 if (decomp.scale[0]) {
515 offset_.set_x(
516 gfx::ToRoundedInt(SkMScalarToFloat(offset_.x() * decomp.scale[0])));
517 }
518 if (decomp.scale[1]) {
519 offset_.set_y(
520 gfx::ToRoundedInt(SkMScalarToFloat(offset_.y() * decomp.scale[1])));
521 }
522 }
523
524 //////////////////////////////////////////////////////////////////////////////// 508 ////////////////////////////////////////////////////////////////////////////////
525 // TouchEvent 509 // TouchEvent
526 510
527 TouchEvent::TouchEvent(const base::NativeEvent& native_event) 511 TouchEvent::TouchEvent(const base::NativeEvent& native_event)
528 : LocatedEvent(native_event), 512 : LocatedEvent(native_event),
529 touch_id_(GetTouchId(native_event)), 513 touch_id_(GetTouchId(native_event)),
530 unique_event_id_(get_next_touch_event_id()), 514 unique_event_id_(get_next_touch_event_id()),
531 radius_x_(GetTouchRadiusX(native_event)), 515 radius_x_(GetTouchRadiusX(native_event)),
532 radius_y_(GetTouchRadiusY(native_event)), 516 radius_y_(GetTouchRadiusY(native_event)),
533 rotation_angle_(GetTouchAngle(native_event)), 517 rotation_angle_(GetTouchAngle(native_event)),
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 gfx::PointF(x, y), 984 gfx::PointF(x, y),
1001 time_stamp, 985 time_stamp,
1002 flags | EF_FROM_TOUCH), 986 flags | EF_FROM_TOUCH),
1003 details_(details) { 987 details_(details) {
1004 } 988 }
1005 989
1006 GestureEvent::~GestureEvent() { 990 GestureEvent::~GestureEvent() {
1007 } 991 }
1008 992
1009 } // namespace ui 993 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698