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

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 1147583002: Fix a crash when views::HWNDMessageHandler::HandleTouchMessage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add check back Created 5 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index cb34bbe7999d9a4412b27e04a1656cc2265a5d2d..7dea7ae60f504d3e189e3d74072deb5cafbe326e 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -2350,6 +2350,11 @@ void HWNDMessageHandler::PrepareTouchEventList(TOUCHINPUT input[],
ScreenToClient(hwnd(), &point);
+ // We set a check to assert that we do not receive any touch events from
+ // user's palm.
+ bool touch_event_from_palm = (input[i].dwFlags & TOUCHEVENTF_PALM) != 0;
+ CHECK(!touch_event_from_palm) << "There are touch events from user's palm";
+
// TOUCHEVENTF_DOWN cannot be combined with TOUCHEVENTF_MOVE or
// TOUCHEVENTF_UP, but TOUCHEVENTF_MOVE and TOUCHEVENTF_UP can be combined
// in one input.
@@ -2385,12 +2390,6 @@ void HWNDMessageHandler::GenerateTouchEvent(DWORD input_dwID,
}
TouchPoint& touch_point = touch_id_list_[touch_id];
- int flags = ui::GetModifiersFromKeyState();
-
- // The dwTime of every input in the WM_TOUCH message doesn't necessarily
- // relate to the system time at all, so use base::TimeTicks::Now() for
- // touchevent time.
- base::TimeDelta now = ui::EventTimeForNow();
// We set a check to assert that we do not have missing touch presses in
// every message.
@@ -2398,6 +2397,13 @@ void HWNDMessageHandler::GenerateTouchEvent(DWORD input_dwID,
touch_point.in_touch_list == InTouchList::NotPresent;
CHECK(!has_missing_touch_press) << "There are missing touch presses";
+ int flags = ui::GetModifiersFromKeyState();
+
+ // The dwTime of every input in the WM_TOUCH message doesn't necessarily
+ // relate to the system time at all, so use base::TimeTicks::Now() for
+ // touchevent time.
+ base::TimeDelta now = ui::EventTimeForNow();
+
ui::TouchEvent event(touch_event_type, point_location, touch_id, now);
event.set_flags(flags);
event.latency()->AddLatencyNumberWithTimestamp(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698