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

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

Issue 785753002: Don't refcount tracking id -> slot id mapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix comment. Created 5 years, 10 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/devices/x11/touch_factory_x11.cc ('k') | ui/events/event.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 #ifndef UI_EVENTS_EVENT_H_ 5 #ifndef UI_EVENTS_EVENT_H_
6 #define UI_EVENTS_EVENT_H_ 6 #define UI_EVENTS_EVENT_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/event_types.h" 10 #include "base/event_types.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Returns true if the event has a valid |native_event_|. 205 // Returns true if the event has a valid |native_event_|.
206 bool HasNativeEvent() const; 206 bool HasNativeEvent() const;
207 207
208 // Immediately stops the propagation of the event. This must be called only 208 // Immediately stops the propagation of the event. This must be called only
209 // from an EventHandler during an event-dispatch. Any event handler that may 209 // from an EventHandler during an event-dispatch. Any event handler that may
210 // be in the list will not receive the event after this is called. 210 // be in the list will not receive the event after this is called.
211 // Note that StopPropagation() can be called only for cancelable events. 211 // Note that StopPropagation() can be called only for cancelable events.
212 void StopPropagation(); 212 void StopPropagation();
213 bool stopped_propagation() const { return !!(result_ & ER_CONSUMED); } 213 bool stopped_propagation() const { return !!(result_ & ER_CONSUMED); }
214 214
215 215 // Marks the event as having been handled. A handled event does not reach the
216 // next event phase. For example, if an event is handled during the pre-target 216 // next event phase. For example, if an event is handled during the pre-target
217 // phase, then the event is dispatched to all pre-target handlers, but not to 217 // phase, then the event is dispatched to all pre-target handlers, but not to
218 // the target or post-target handlers. 218 // the target or post-target handlers.
219 // Note that SetHandled() can be called only for cancelable events. 219 // Note that SetHandled() can be called only for cancelable events.
220 void SetHandled(); 220 void SetHandled();
221 bool handled() const { return result_ != ER_UNHANDLED; } 221 bool handled() const { return result_ != ER_UNHANDLED; }
222 222
223 protected: 223 protected:
224 Event(EventType type, base::TimeDelta time_stamp, int flags); 224 Event(EventType type, base::TimeDelta time_stamp, int flags);
225 Event(const base::NativeEvent& native_event, EventType type, int flags); 225 Event(const base::NativeEvent& native_event, EventType type, int flags);
226 Event(const Event& copy); 226 Event(const Event& copy);
227 void SetType(EventType type); 227 void SetType(EventType type);
228 void set_delete_native_event(bool delete_native_event) {
229 delete_native_event_ = delete_native_event;
230 }
231 void set_cancelable(bool cancelable) { cancelable_ = cancelable; } 228 void set_cancelable(bool cancelable) { cancelable_ = cancelable; }
232 229
233 void set_time_stamp(const base::TimeDelta& time_stamp) { 230 void set_time_stamp(const base::TimeDelta& time_stamp) {
234 time_stamp_ = time_stamp; 231 time_stamp_ = time_stamp;
235 } 232 }
236 233
237 void set_name(const std::string& name) { name_ = name; } 234 void set_name(const std::string& name) { name_ = name; }
238 235
239 private: 236 private:
240 friend class EventTestApi; 237 friend class EventTestApi;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 // converted from |source| coordinate system to |target| coordinate system. 485 // converted from |source| coordinate system to |target| coordinate system.
489 template <class T> 486 template <class T>
490 TouchEvent(const TouchEvent& model, T* source, T* target) 487 TouchEvent(const TouchEvent& model, T* source, T* target)
491 : LocatedEvent(model, source, target), 488 : LocatedEvent(model, source, target),
492 touch_id_(model.touch_id_), 489 touch_id_(model.touch_id_),
493 unique_event_id_(model.unique_event_id_), 490 unique_event_id_(model.unique_event_id_),
494 radius_x_(model.radius_x_), 491 radius_x_(model.radius_x_),
495 radius_y_(model.radius_y_), 492 radius_y_(model.radius_y_),
496 rotation_angle_(model.rotation_angle_), 493 rotation_angle_(model.rotation_angle_),
497 force_(model.force_), 494 force_(model.force_),
498 may_cause_scrolling_(model.may_cause_scrolling_) {} 495 should_remove_native_touch_id_mapping_(false) {}
jdduke (slow) 2015/02/03 00:24:57 Looks like a bad rebase. |may_cause_scrolling_| is
499 496
500 TouchEvent(EventType type, 497 TouchEvent(EventType type,
501 const gfx::PointF& location, 498 const gfx::PointF& location,
502 int touch_id, 499 int touch_id,
503 base::TimeDelta time_stamp); 500 base::TimeDelta time_stamp);
504 501
505 TouchEvent(EventType type, 502 TouchEvent(EventType type,
506 const gfx::PointF& location, 503 const gfx::PointF& location,
507 int flags, 504 int flags,
508 int touch_id, 505 int touch_id,
(...skipping 16 matching lines...) Expand all
525 float rotation_angle() const { return rotation_angle_; } 522 float rotation_angle() const { return rotation_angle_; }
526 float force() const { return force_; } 523 float force() const { return force_; }
527 524
528 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } 525 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; }
529 bool may_cause_scrolling() const { return may_cause_scrolling_; } 526 bool may_cause_scrolling() const { return may_cause_scrolling_; }
530 527
531 // Used for unit tests. 528 // Used for unit tests.
532 void set_radius_x(const float r) { radius_x_ = r; } 529 void set_radius_x(const float r) { radius_x_ = r; }
533 void set_radius_y(const float r) { radius_y_ = r; } 530 void set_radius_y(const float r) { radius_y_ = r; }
534 531
532 void set_should_remove_native_touch_id_mapping(
533 bool should_remove_native_touch_id_mapping) {
534 should_remove_native_touch_id_mapping_ =
535 should_remove_native_touch_id_mapping;
536 }
537
535 // Overridden from LocatedEvent. 538 // Overridden from LocatedEvent.
536 void UpdateForRootTransform( 539 void UpdateForRootTransform(
537 const gfx::Transform& inverted_root_transform) override; 540 const gfx::Transform& inverted_root_transform) override;
538 541
539 // Marks the event as not participating in synchronous gesture recognition. 542 // Marks the event as not participating in synchronous gesture recognition.
540 void DisableSynchronousHandling(); 543 void DisableSynchronousHandling();
541 bool synchronous_handling_disabled() const { 544 bool synchronous_handling_disabled() const {
542 return !!(result() & ER_DISABLE_SYNC_HANDLING); 545 return !!(result() & ER_DISABLE_SYNC_HANDLING);
543 } 546 }
544 547
545 private: 548 private:
546 // Adjusts rotation_angle_ to within the acceptable range. 549 // Adjusts rotation_angle_ to within the acceptable range.
547 void fixRotationAngle(); 550 void FixRotationAngle();
548 551
549 // The identity (typically finger) of the touch starting at 0 and incrementing 552 // The identity (typically finger) of the touch starting at 0 and incrementing
550 // for each separable additional touch that the hardware can detect. 553 // for each separable additional touch that the hardware can detect.
551 const int touch_id_; 554 const int touch_id_;
552 555
553 // A unique identifier for the touch event. 556 // A unique identifier for the touch event.
554 const uint64 unique_event_id_; 557 const uint64 unique_event_id_;
555 558
556 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. 559 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown.
557 float radius_x_; 560 float radius_x_;
558 561
559 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. 562 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown.
560 float radius_y_; 563 float radius_y_;
561 564
562 // Clockwise angle (in degrees) of the major axis from the X axis. Must be 565 // Clockwise angle (in degrees) of the major axis from the X axis. Must be
563 // less than 180 and non-negative. 566 // less than 180 and non-negative.
564 float rotation_angle_; 567 float rotation_angle_;
565 568
566 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. 569 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0.
567 float force_; 570 float force_;
568 571
569 // Whether the (unhandled) touch event will produce a scroll event (e.g., a 572 // Whether the (unhandled) touch event will produce a scroll event (e.g., a
570 // touchmove that exceeds the platform slop region, or a touchend that 573 // touchmove that exceeds the platform slop region, or a touchend that
571 // causes a fling). Defaults to false. 574 // causes a fling). Defaults to false.
572 bool may_cause_scrolling_; 575 bool may_cause_scrolling_;
576
577 // True if this event should remove the mapping between the native
578 // event id and the touch_id_. This should only be the case for
579 // release and cancel events where the associated touch press event
580 // created a mapping between the native id and the touch_id_.
581 bool should_remove_native_touch_id_mapping_;
573 }; 582 };
574 583
575 // An interface that individual platforms can use to store additional data on 584 // An interface that individual platforms can use to store additional data on
576 // KeyEvent. 585 // KeyEvent.
577 // 586 //
578 // Currently only used in mojo. 587 // Currently only used in mojo.
579 class EVENTS_EXPORT ExtendedKeyEventData { 588 class EVENTS_EXPORT ExtendedKeyEventData {
580 public: 589 public:
581 virtual ~ExtendedKeyEventData() {} 590 virtual ~ExtendedKeyEventData() {}
582 591
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 874
866 const GestureEventDetails& details() const { return details_; } 875 const GestureEventDetails& details() const { return details_; }
867 876
868 private: 877 private:
869 GestureEventDetails details_; 878 GestureEventDetails details_;
870 }; 879 };
871 880
872 } // namespace ui 881 } // namespace ui
873 882
874 #endif // UI_EVENTS_EVENT_H_ 883 #endif // UI_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « ui/events/devices/x11/touch_factory_x11.cc ('k') | ui/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698