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

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

Issue 11881042: highlight intermediate tabs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make check for Gesture vs Scroll event for flings explicit 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
Index: ui/base/events/event.h
diff --git a/ui/base/events/event.h b/ui/base/events/event.h
index 574cb7f3037a3198515b09a68299361b4d3096e3..c929475dac48286f4b71a5d3805f475e07896f9e 100644
--- a/ui/base/events/event.h
+++ b/ui/base/events/event.h
@@ -143,7 +143,7 @@ class UI_EXPORT Event {
case ET_SCROLL_FLING_START:
// These can be ScrollEvents too. But for ScrollEvents have valid native
// events. No gesture events have native events.
sadrul 2013/01/22 20:07:24 Update the comment.
DaveMoore 2013/01/27 21:21:54 Done.
- return !HasNativeEvent();
+ return flags_ & EF_FROM_TOUCH;
default:
break;
@@ -154,7 +154,8 @@ class UI_EXPORT Event {
bool IsScrollEvent() const {
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 +200,10 @@ class UI_EXPORT Event {
dispatch_to_hidden_targets_ = dispatch_to_hidden_targets;
}
+ void set_time_stamp(const base::TimeDelta& time_stamp) {
sky 2013/01/22 18:05:01 We generally don't pass TimeDeltas by const-ref.
DaveMoore 2013/01/27 21:21:54 Done.
+ time_stamp_ = time_stamp;
+ }
+
void set_name(const std::string& name) { name_ = name; }
private:
@@ -269,6 +274,8 @@ class UI_EXPORT LocatedEvent : public Event {
protected:
explicit LocatedEvent(const base::NativeEvent& native_event);
+ LocatedEvent(const LocatedEvent& model);
sky 2013/01/22 18:05:01 explicit
DaveMoore 2013/01/27 21:21:54 Done.
+
// 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 +336,11 @@ class UI_EXPORT MouseEvent : public LocatedEvent {
set_flags(flags);
}
+ MouseEvent(const MouseEvent& model)
sky 2013/01/22 18:05:01 explicit
DaveMoore 2013/01/27 21:21:54 Done, but AutoFillDialogViews was depending on the
+ : 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 +524,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 +574,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 +623,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 +633,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 +652,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 {

Powered by Google App Engine
This is Rietveld 408576698