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

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

Issue 1026573002: Prevent TouchEvent Crash on X (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') | ui/events/x/events_x_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 #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 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 radius_x_(radius_x), 575 radius_x_(radius_x),
576 radius_y_(radius_y), 576 radius_y_(radius_y),
577 rotation_angle_(angle), 577 rotation_angle_(angle),
578 force_(force), 578 force_(force),
579 may_cause_scrolling_(false), 579 may_cause_scrolling_(false),
580 should_remove_native_touch_id_mapping_(false) { 580 should_remove_native_touch_id_mapping_(false) {
581 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0); 581 latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
582 FixRotationAngle(); 582 FixRotationAngle();
583 } 583 }
584 584
585 TouchEvent::TouchEvent(const TouchEvent& copy)
586 : LocatedEvent(copy),
587 touch_id_(copy.touch_id_),
588 unique_event_id_(copy.unique_event_id_),
589 radius_x_(copy.radius_x_),
590 radius_y_(copy.radius_y_),
591 rotation_angle_(copy.rotation_angle_),
592 force_(copy.force_),
593 may_cause_scrolling_(copy.may_cause_scrolling_),
594 should_remove_native_touch_id_mapping_(false) {
595 // Copied events should not remove touch id mapping, as this either causes the
596 // mapping to be lost before the initial event has finished dispatching, or
597 // the copy to attempt to remove the mapping from a null |native_event_|.
598 }
599
585 TouchEvent::~TouchEvent() { 600 TouchEvent::~TouchEvent() {
586 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11 601 // In ctor TouchEvent(native_event) we call GetTouchId() which in X11
587 // platform setups the tracking_id to slot mapping. So in dtor here, 602 // platform setups the tracking_id to slot mapping. So in dtor here,
588 // if this touch event is a release event, we clear the mapping accordingly. 603 // if this touch event is a release event, we clear the mapping accordingly.
589 if (should_remove_native_touch_id_mapping_) { 604 if (should_remove_native_touch_id_mapping_) {
590 DCHECK(type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED); 605 DCHECK(type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED);
591 if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED) 606 if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED)
592 ClearTouchIdIfReleased(native_event()); 607 ClearTouchIdIfReleased(native_event());
593 } 608 }
594 } 609 }
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 gfx::PointF(x, y), 996 gfx::PointF(x, y),
982 time_stamp, 997 time_stamp,
983 flags | EF_FROM_TOUCH), 998 flags | EF_FROM_TOUCH),
984 details_(details) { 999 details_(details) {
985 } 1000 }
986 1001
987 GestureEvent::~GestureEvent() { 1002 GestureEvent::~GestureEvent() {
988 } 1003 }
989 1004
990 } // namespace ui 1005 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/event.h ('k') | ui/events/x/events_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698