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

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

Issue 1908913002: Revert of mus: Fix event transformation in client code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/aura/window_event_dispatcher.cc ('k') | ui/events/event_unittest.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 "ui/events/event.h" 5 #include "ui/events/event.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 10
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 base::TimeDelta time_stamp, 437 base::TimeDelta time_stamp,
438 int flags) 438 int flags)
439 : Event(type, time_stamp, flags), 439 : Event(type, time_stamp, flags),
440 location_(location), 440 location_(location),
441 root_location_(root_location) { 441 root_location_(root_location) {
442 } 442 }
443 443
444 void LocatedEvent::UpdateForRootTransform( 444 void LocatedEvent::UpdateForRootTransform(
445 const gfx::Transform& reversed_root_transform) { 445 const gfx::Transform& reversed_root_transform) {
446 // Transform has to be done at root level. 446 // Transform has to be done at root level.
447 bool locations_equal = location_ == root_location_;
448 gfx::Point3F p(location_); 447 gfx::Point3F p(location_);
449 reversed_root_transform.TransformPoint(&p); 448 reversed_root_transform.TransformPoint(&p);
450 location_ = p.AsPointF(); 449 location_ = p.AsPointF();
451 if (locations_equal) { 450 root_location_ = location_;
452 root_location_ = location_;
453 } else {
454 p = gfx::Point3F(root_location_);
455 reversed_root_transform.TransformPoint(&p);
456 root_location_ = p.AsPointF();
457 }
458 } 451 }
459 452
460 //////////////////////////////////////////////////////////////////////////////// 453 ////////////////////////////////////////////////////////////////////////////////
461 // MouseEvent 454 // MouseEvent
462 455
463 MouseEvent::MouseEvent(const base::NativeEvent& native_event) 456 MouseEvent::MouseEvent(const base::NativeEvent& native_event)
464 : LocatedEvent(native_event), 457 : LocatedEvent(native_event),
465 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)), 458 changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)),
466 pointer_details_(GetMousePointerDetailsFromNative(native_event)) { 459 pointer_details_(GetMousePointerDetailsFromNative(native_event)) {
467 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED) 460 if (type() == ET_MOUSE_PRESSED || type() == ET_MOUSE_RELEASED)
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 gfx::PointF(x, y), 1214 gfx::PointF(x, y),
1222 time_stamp, 1215 time_stamp,
1223 flags | EF_FROM_TOUCH), 1216 flags | EF_FROM_TOUCH),
1224 details_(details) { 1217 details_(details) {
1225 } 1218 }
1226 1219
1227 GestureEvent::~GestureEvent() { 1220 GestureEvent::~GestureEvent() {
1228 } 1221 }
1229 1222
1230 } // namespace ui 1223 } // namespace ui
OLDNEW
« no previous file with comments | « ui/aura/window_event_dispatcher.cc ('k') | ui/events/event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698