| Index: ui/base/events/event.h
|
| diff --git a/ui/base/events/event.h b/ui/base/events/event.h
|
| index 574cb7f3037a3198515b09a68299361b4d3096e3..95ac56431ef2fb5b46b5f6af609ead7f9886db06 100644
|
| --- a/ui/base/events/event.h
|
| +++ b/ui/base/events/event.h
|
| @@ -53,7 +53,7 @@ class UI_EXPORT Event {
|
| public:
|
| explicit TestApi(Event* event) : event_(event) {}
|
|
|
| - void set_time_stamp(const base::TimeDelta& time_stamp) {
|
| + void set_time_stamp(base::TimeDelta time_stamp) {
|
| event_->time_stamp_ = time_stamp;
|
| }
|
|
|
| @@ -141,9 +141,9 @@ class UI_EXPORT Event {
|
|
|
| case ET_SCROLL_FLING_CANCEL:
|
| case ET_SCROLL_FLING_START:
|
| - // These can be ScrollEvents too. But for ScrollEvents have valid native
|
| - // events. No gesture events have native events.
|
| - return !HasNativeEvent();
|
| + // These can be ScrollEvents too. EF_FROM_TOUCH determines if they're
|
| + // Gesture or Scroll events.
|
| + return (flags_ & EF_FROM_TOUCH) == EF_FROM_TOUCH;
|
|
|
| default:
|
| break;
|
| @@ -152,9 +152,12 @@ class UI_EXPORT Event {
|
| }
|
|
|
| bool IsScrollEvent() const {
|
| + // Flings can be GestureEvents too. EF_FROM_TOUCH determins if they're
|
| + // Gesture or Scroll events.
|
| return type_ == ET_SCROLL ||
|
| ((type_ == ET_SCROLL_FLING_START ||
|
| - type_ == ET_SCROLL_FLING_CANCEL) && HasNativeEvent());
|
| + type_ == ET_SCROLL_FLING_CANCEL) &&
|
| + !(flags() & EF_FROM_TOUCH));
|
| }
|
|
|
| bool IsScrollGestureEvent() const {
|
| @@ -199,6 +202,10 @@ class UI_EXPORT Event {
|
| dispatch_to_hidden_targets_ = dispatch_to_hidden_targets;
|
| }
|
|
|
| + void set_time_stamp(const base::TimeDelta& time_stamp) {
|
| + time_stamp_ = time_stamp;
|
| + }
|
| +
|
| void set_name(const std::string& name) { name_ = name; }
|
|
|
| private:
|
| @@ -269,6 +276,8 @@ class UI_EXPORT LocatedEvent : public Event {
|
| protected:
|
| explicit LocatedEvent(const base::NativeEvent& native_event);
|
|
|
| + explicit LocatedEvent(const LocatedEvent& model);
|
| +
|
| // Create a new LocatedEvent which is identical to the provided model.
|
| // If source / target windows are provided, the model location will be
|
| // converted from |source| coordinate system to |target| coordinate system.
|
| @@ -329,6 +338,11 @@ class UI_EXPORT MouseEvent : public LocatedEvent {
|
| set_flags(flags);
|
| }
|
|
|
| + explicit MouseEvent(const MouseEvent& model)
|
| + : LocatedEvent(model),
|
| + changed_button_flags_(model.changed_button_flags_) {
|
| + }
|
| +
|
| // Used for synthetic events in testing and by the gesture recognizer.
|
| MouseEvent(EventType type,
|
| const gfx::Point& location,
|
| @@ -512,8 +526,6 @@ class UI_EXPORT TouchEvent : public LocatedEvent {
|
|
|
| // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0.
|
| float force_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(TouchEvent);
|
| };
|
|
|
| class UI_EXPORT KeyEvent : public Event {
|
| @@ -564,8 +576,6 @@ class UI_EXPORT KeyEvent : public Event {
|
|
|
| uint16 character_;
|
| uint16 unmodified_character_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(KeyEvent);
|
| };
|
|
|
| // A key event which is translated by an input method (IME).
|
| @@ -615,10 +625,8 @@ class UI_EXPORT ScrollEvent : public MouseEvent {
|
| template <class T>
|
| ScrollEvent(const ScrollEvent& model,
|
| T* source,
|
| - T* target,
|
| - EventType type,
|
| - int flags)
|
| - : MouseEvent(model, source, target, type, flags),
|
| + T* target)
|
| + : MouseEvent(model, source, target),
|
| x_offset_(model.x_offset_),
|
| y_offset_(model.y_offset_),
|
| finger_count_(model.finger_count_){
|
| @@ -627,9 +635,11 @@ class UI_EXPORT ScrollEvent : public MouseEvent {
|
| // Used for tests.
|
| ScrollEvent(EventType type,
|
| const gfx::Point& location,
|
| + base::TimeDelta time_stamp,
|
| int flags,
|
| float x_offset,
|
| - float y_offset);
|
| + float y_offset,
|
| + int finger_count);
|
|
|
| // Scale the scroll event's offset value.
|
| // This is useful in the multi-monitor setup where it needs to be scaled
|
| @@ -644,8 +654,6 @@ class UI_EXPORT ScrollEvent : public MouseEvent {
|
| float x_offset_;
|
| float y_offset_;
|
| int finger_count_;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(ScrollEvent);
|
| };
|
|
|
| class UI_EXPORT GestureEvent : public LocatedEvent {
|
|
|