Commit 6f988477 authored by minch's avatar minch Committed by Commit Bot

back_gesture: Use screen location to update the affordance's position.

See video before change:
https://drive.google.com/file/d/0B5I0jFeLxqIiUlg2aXRrdGFIV0d0ZzhZYng4Y3VJQVJ1OXow/view?usp=sharing

The affordance is assumed to be 64dips above the touch point,but the
distance seems much further than expected.

See video after change:
https://drive.google.com/file/d/0B5I0jFeLxqIicGNacUIzUThxUHZ3SHV0RVBlWFpzdUNtb2h3/view?usp=sharing

Bug: 1002733
Change-Id: I4d5638a3c964fe45a52402f75c9ad21ba62a9bea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1859690
Commit-Queue: Min Chen <minch@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705993}
parent ee5b3ccf
......@@ -863,20 +863,23 @@ bool ToplevelWindowEventHandler::HandleGoingBackFromLeftEdge(
if (!CanStartGoingBack())
return false;
gfx::Point screen_location = event->location();
::wm::ConvertPointToScreen(static_cast<aura::Window*>(event->target()),
&screen_location);
switch (event->type()) {
case ui::ET_GESTURE_SCROLL_BEGIN: {
going_back_started_ = StartedAwayFromLeftArea(event);
if (!going_back_started_)
break;
back_gesture_affordance_ =
std::make_unique<BackGestureAffordance>(event->location());
std::make_unique<BackGestureAffordance>(screen_location);
return true;
}
case ui::ET_GESTURE_SCROLL_UPDATE:
if (!going_back_started_)
break;
DCHECK(back_gesture_affordance_);
back_gesture_affordance_->SetDragProgress(event->location().x());
back_gesture_affordance_->SetDragProgress(screen_location.x());
return true;
case ui::ET_GESTURE_SCROLL_END:
case ui::ET_SCROLL_FLING_START: {
......@@ -884,11 +887,11 @@ bool ToplevelWindowEventHandler::HandleGoingBackFromLeftEdge(
break;
DCHECK(back_gesture_affordance_);
if ((event->type() == ui::ET_GESTURE_SCROLL_END &&
event->location().x() >= kSwipingDistanceForGoingBack) ||
screen_location.x() >= kSwipingDistanceForGoingBack) ||
(event->type() == ui::ET_SCROLL_FLING_START &&
event->details().velocity_x() >= kFlingVelocityForGoingBack)) {
aura::Window* root_window =
window_util::GetRootWindowAt(event->location());
window_util::GetRootWindowAt(screen_location);
ui::KeyEvent press_key_event(ui::ET_KEY_PRESSED, ui::VKEY_BROWSER_BACK,
ui::EF_NONE);
ignore_result(
......
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