Commit 41065dad authored by lanwei's avatar lanwei Committed by Commit bot

Fix a crash when views::HWNDMessageHandler::HandleTouchMessage.

There is a crash when calling views::HWNDMessageHandler::HandleTouchMessage,
because there are missing touch presses. Remove the CHECK for missing touch press,
and ignore when this happens.

BUG=316085, 488473

Review URL: https://codereview.chromium.org/1147583002

Cr-Commit-Position: refs/heads/master@{#330751}
parent cd480cf2
...@@ -2354,6 +2354,11 @@ void HWNDMessageHandler::PrepareTouchEventList(TOUCHINPUT input[], ...@@ -2354,6 +2354,11 @@ void HWNDMessageHandler::PrepareTouchEventList(TOUCHINPUT input[],
ScreenToClient(hwnd(), &point); 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_DOWN cannot be combined with TOUCHEVENTF_MOVE or
// TOUCHEVENTF_UP, but TOUCHEVENTF_MOVE and TOUCHEVENTF_UP can be combined // TOUCHEVENTF_UP, but TOUCHEVENTF_MOVE and TOUCHEVENTF_UP can be combined
// in one input. // in one input.
...@@ -2389,12 +2394,6 @@ void HWNDMessageHandler::GenerateTouchEvent(DWORD input_dwID, ...@@ -2389,12 +2394,6 @@ void HWNDMessageHandler::GenerateTouchEvent(DWORD input_dwID,
} }
TouchPoint& touch_point = touch_id_list_[touch_id]; 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 // We set a check to assert that we do not have missing touch presses in
// every message. // every message.
...@@ -2402,6 +2401,13 @@ void HWNDMessageHandler::GenerateTouchEvent(DWORD input_dwID, ...@@ -2402,6 +2401,13 @@ void HWNDMessageHandler::GenerateTouchEvent(DWORD input_dwID,
touch_point.in_touch_list == InTouchList::NotPresent; touch_point.in_touch_list == InTouchList::NotPresent;
CHECK(!has_missing_touch_press) << "There are missing touch presses"; 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); ui::TouchEvent event(touch_event_type, point_location, touch_id, now);
event.set_flags(flags); event.set_flags(flags);
event.latency()->AddLatencyNumberWithTimestamp( event.latency()->AddLatencyNumberWithTimestamp(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment