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

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

Issue 718153002: Indicate whether a touch event will cause scrolling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/BUILD.gn ('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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // Create a new TouchEvent which is identical to the provided model. 484 // Create a new TouchEvent which is identical to the provided model.
485 // If source / target windows are provided, the model location will be 485 // If source / target windows are provided, the model location will be
486 // converted from |source| coordinate system to |target| coordinate system. 486 // converted from |source| coordinate system to |target| coordinate system.
487 template <class T> 487 template <class T>
488 TouchEvent(const TouchEvent& model, T* source, T* target) 488 TouchEvent(const TouchEvent& model, T* source, T* target)
489 : LocatedEvent(model, source, target), 489 : LocatedEvent(model, source, target),
490 touch_id_(model.touch_id_), 490 touch_id_(model.touch_id_),
491 radius_x_(model.radius_x_), 491 radius_x_(model.radius_x_),
492 radius_y_(model.radius_y_), 492 radius_y_(model.radius_y_),
493 rotation_angle_(model.rotation_angle_), 493 rotation_angle_(model.rotation_angle_),
494 force_(model.force_) { 494 force_(model.force_),
495 } 495 causes_scrolling_(model.causes_scrolling_) {}
496 496
497 TouchEvent(EventType type, 497 TouchEvent(EventType type,
498 const gfx::PointF& location, 498 const gfx::PointF& location,
499 int touch_id, 499 int touch_id,
500 base::TimeDelta time_stamp); 500 base::TimeDelta time_stamp);
501 501
502 TouchEvent(EventType type, 502 TouchEvent(EventType type,
503 const gfx::PointF& location, 503 const gfx::PointF& location,
504 int flags, 504 int flags,
505 int touch_id, 505 int touch_id,
506 base::TimeDelta timestamp, 506 base::TimeDelta timestamp,
507 float radius_x, 507 float radius_x,
508 float radius_y, 508 float radius_y,
509 float angle, 509 float angle,
510 float force); 510 float force);
511 511
512 ~TouchEvent() override; 512 ~TouchEvent() override;
513 513
514 int touch_id() const { return touch_id_; } 514 int touch_id() const { return touch_id_; }
515 float radius_x() const { return radius_x_; } 515 float radius_x() const { return radius_x_; }
516 float radius_y() const { return radius_y_; } 516 float radius_y() const { return radius_y_; }
517 float rotation_angle() const { return rotation_angle_; } 517 float rotation_angle() const { return rotation_angle_; }
518 float force() const { return force_; } 518 float force() const { return force_; }
519 519
520 void set_causes_scrolling(bool causes) { causes_scrolling_ = causes; }
521 bool causes_scrolling() const { return causes_scrolling_; }
522
520 // Used for unit tests. 523 // Used for unit tests.
521 void set_radius_x(const float r) { radius_x_ = r; } 524 void set_radius_x(const float r) { radius_x_ = r; }
522 void set_radius_y(const float r) { radius_y_ = r; } 525 void set_radius_y(const float r) { radius_y_ = r; }
523 526
524 // Overridden from LocatedEvent. 527 // Overridden from LocatedEvent.
525 void UpdateForRootTransform( 528 void UpdateForRootTransform(
526 const gfx::Transform& inverted_root_transform) override; 529 const gfx::Transform& inverted_root_transform) override;
527 530
528 protected: 531 protected:
529 void set_radius(float radius_x, float radius_y) { 532 void set_radius(float radius_x, float radius_y) {
(...skipping 16 matching lines...) Expand all
546 float radius_x_; 549 float radius_x_;
547 550
548 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown. 551 // Radius of the Y (minor) axis of the touch ellipse. 0.0 if unknown.
549 float radius_y_; 552 float radius_y_;
550 553
551 // Angle of the major axis away from the X axis. Default 0.0. 554 // Angle of the major axis away from the X axis. Default 0.0.
552 float rotation_angle_; 555 float rotation_angle_;
553 556
554 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. 557 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0.
555 float force_; 558 float force_;
559
560 // Whether the (unhandled) touch event will produce a scroll event (i.e., it's
561 // a touchmove and exceeds the platform slop region). Defaults to false.
562 // TODO(jdduke): Expose additional gesture event types that will result if the
563 // touch goes unconsumed.
564 bool causes_scrolling_;
556 }; 565 };
557 566
558 // An interface that individual platforms can use to store additional data on 567 // An interface that individual platforms can use to store additional data on
559 // KeyEvent. 568 // KeyEvent.
560 // 569 //
561 // Currently only used in mojo. 570 // Currently only used in mojo.
562 class EVENTS_EXPORT ExtendedKeyEventData { 571 class EVENTS_EXPORT ExtendedKeyEventData {
563 public: 572 public:
564 virtual ~ExtendedKeyEventData() {} 573 virtual ~ExtendedKeyEventData() {}
565 574
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 816
808 const GestureEventDetails& details() const { return details_; } 817 const GestureEventDetails& details() const { return details_; }
809 818
810 private: 819 private:
811 GestureEventDetails details_; 820 GestureEventDetails details_;
812 }; 821 };
813 822
814 } // namespace ui 823 } // namespace ui
815 824
816 #endif // UI_EVENTS_EVENT_H_ 825 #endif // UI_EVENTS_EVENT_H_
OLDNEW
« no previous file with comments | « ui/events/BUILD.gn ('k') | ui/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698