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

Unified Diff: ui/base/events/event.h

Issue 12088015: Add ability for EventGenerator to generate Scroll events asynchronously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Free any leftover events in destructor Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/test/event_generator.cc ('k') | ui/base/events/event.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/events/event.h
diff --git a/ui/base/events/event.h b/ui/base/events/event.h
index 574cb7f3037a3198515b09a68299361b4d3096e3..b691118c064954ffd7b74149ad0541340fdaec1a 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:
@@ -512,8 +519,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 +569,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 +618,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 +628,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 +647,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 {
« no previous file with comments | « ui/aura/test/event_generator.cc ('k') | ui/base/events/event.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698