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

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

Issue 869433007: Revert of Don't refcount tracking id -> slot id mapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 // Marks the event as having been handled. A handled event does not reach the 215
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 }
228 void set_cancelable(bool cancelable) { cancelable_ = cancelable; } 231 void set_cancelable(bool cancelable) { cancelable_ = cancelable; }
229 232
230 void set_time_stamp(const base::TimeDelta& time_stamp) { 233 void set_time_stamp(const base::TimeDelta& time_stamp) {
231 time_stamp_ = time_stamp; 234 time_stamp_ = time_stamp;
232 } 235 }
233 236
234 void set_name(const std::string& name) { name_ = name; } 237 void set_name(const std::string& name) { name_ = name; }
235 238
236 private: 239 private:
237 friend class EventTestApi; 240 friend class EventTestApi;
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 // converted from |source| coordinate system to |target| coordinate system. 488 // converted from |source| coordinate system to |target| coordinate system.
486 template <class T> 489 template <class T>
487 TouchEvent(const TouchEvent& model, T* source, T* target) 490 TouchEvent(const TouchEvent& model, T* source, T* target)
488 : LocatedEvent(model, source, target), 491 : LocatedEvent(model, source, target),
489 touch_id_(model.touch_id_), 492 touch_id_(model.touch_id_),
490 unique_event_id_(model.unique_event_id_), 493 unique_event_id_(model.unique_event_id_),
491 radius_x_(model.radius_x_), 494 radius_x_(model.radius_x_),
492 radius_y_(model.radius_y_), 495 radius_y_(model.radius_y_),
493 rotation_angle_(model.rotation_angle_), 496 rotation_angle_(model.rotation_angle_),
494 force_(model.force_), 497 force_(model.force_),
495 should_remove_native_touch_id_mapping_(false) {} 498 may_cause_scrolling_(model.may_cause_scrolling_) {}
496 499
497 TouchEvent(EventType type, 500 TouchEvent(EventType type,
498 const gfx::PointF& location, 501 const gfx::PointF& location,
499 int touch_id, 502 int touch_id,
500 base::TimeDelta time_stamp); 503 base::TimeDelta time_stamp);
501 504
502 TouchEvent(EventType type, 505 TouchEvent(EventType type,
503 const gfx::PointF& location, 506 const gfx::PointF& location,
504 int flags, 507 int flags,
505 int touch_id, 508 int touch_id,
(...skipping 16 matching lines...) Expand all
522 float rotation_angle() const { return rotation_angle_; } 525 float rotation_angle() const { return rotation_angle_; }
523 float force() const { return force_; } 526 float force() const { return force_; }
524 527
525 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; } 528 void set_may_cause_scrolling(bool causes) { may_cause_scrolling_ = causes; }
526 bool may_cause_scrolling() const { return may_cause_scrolling_; } 529 bool may_cause_scrolling() const { return may_cause_scrolling_; }
527 530
528 // Used for unit tests. 531 // Used for unit tests.
529 void set_radius_x(const float r) { radius_x_ = r; } 532 void set_radius_x(const float r) { radius_x_ = r; }
530 void set_radius_y(const float r) { radius_y_ = r; } 533 void set_radius_y(const float r) { radius_y_ = r; }
531 534
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
538 // Overridden from LocatedEvent. 535 // Overridden from LocatedEvent.
539 void UpdateForRootTransform( 536 void UpdateForRootTransform(
540 const gfx::Transform& inverted_root_transform) override; 537 const gfx::Transform& inverted_root_transform) override;
541 538
542 // Marks the event as not participating in synchronous gesture recognition. 539 // Marks the event as not participating in synchronous gesture recognition.
543 void DisableSynchronousHandling(); 540 void DisableSynchronousHandling();
544 bool synchronous_handling_disabled() const { 541 bool synchronous_handling_disabled() const {
545 return !!(result() & ER_DISABLE_SYNC_HANDLING); 542 return !!(result() & ER_DISABLE_SYNC_HANDLING);
546 } 543 }
547 544
548 private: 545 private:
549 // Adjusts rotation_angle_ to within the acceptable range. 546 // Adjusts rotation_angle_ to within the acceptable range.
550 void FixRotationAngle(); 547 void fixRotationAngle();
551 548
552 // The identity (typically finger) of the touch starting at 0 and incrementing 549 // The identity (typically finger) of the touch starting at 0 and incrementing
553 // for each separable additional touch that the hardware can detect. 550 // for each separable additional touch that the hardware can detect.
554 const int touch_id_; 551 const int touch_id_;
555 552
556 // A unique identifier for the touch event. 553 // A unique identifier for the touch event.
557 const uint64 unique_event_id_; 554 const uint64 unique_event_id_;
558 555
559 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown. 556 // Radius of the X (major) axis of the touch ellipse. 0.0 if unknown.
560 float radius_x_; 557 float radius_x_;
561 558
562 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. 559 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown.
563 float radius_y_; 560 float radius_y_;
564 561
565 // Clockwise angle (in degrees) of the major axis from the X axis. Must be 562 // Clockwise angle (in degrees) of the major axis from the X axis. Must be
566 // less than 180 and non-negative. 563 // less than 180 and non-negative.
567 float rotation_angle_; 564 float rotation_angle_;
568 565
569 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. 566 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0.
570 float force_; 567 float force_;
571 568
572 // Whether the (unhandled) touch event will produce a scroll event (e.g., a 569 // Whether the (unhandled) touch event will produce a scroll event (e.g., a
573 // touchmove that exceeds the platform slop region, or a touchend that 570 // touchmove that exceeds the platform slop region, or a touchend that
574 // causes a fling). Defaults to false. 571 // causes a fling). Defaults to false.
575 bool may_cause_scrolling_; 572 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_;
582 }; 573 };
583 574
584 // An interface that individual platforms can use to store additional data on 575 // An interface that individual platforms can use to store additional data on
585 // KeyEvent. 576 // KeyEvent.
586 // 577 //
587 // Currently only used in mojo. 578 // Currently only used in mojo.
588 class EVENTS_EXPORT ExtendedKeyEventData { 579 class EVENTS_EXPORT ExtendedKeyEventData {
589 public: 580 public:
590 virtual ~ExtendedKeyEventData() {} 581 virtual ~ExtendedKeyEventData() {}
591 582
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 865
875 const GestureEventDetails& details() const { return details_; } 866 const GestureEventDetails& details() const { return details_; }
876 867
877 private: 868 private:
878 GestureEventDetails details_; 869 GestureEventDetails details_;
879 }; 870 };
880 871
881 } // namespace ui 872 } // namespace ui
882 873
883 #endif // UI_EVENTS_EVENT_H_ 874 #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