Commit c8e61124 authored by Sammie Quon's avatar Sammie Quon Committed by Commit Bot

overview: Remove minimum scroll limit for new layout.

remove a performance related change which throttles some update
events, UX did not like the look. Also stop drags if display changes, to
avoid some weird looking states.

Test: manual
Bug: 1011449
Change-Id: I4bcb75e0b57975a511f75a65871bcff3b1e24719
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1856923Reviewed-by: default avatarXiaoqian Dai <xdai@chromium.org>
Commit-Queue: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705382}
parent 3f5c5e66
...@@ -77,9 +77,6 @@ constexpr int kTabletLayoutRow = 2; ...@@ -77,9 +77,6 @@ constexpr int kTabletLayoutRow = 2;
constexpr int kMinimumItemsForNewLayout = 6; constexpr int kMinimumItemsForNewLayout = 6;
// The minimum distance that is needed to process a scroll event.
constexpr float kMinimumScrollDistanceDp = 5.f;
// Wait a while before unpausing the occlusion tracker after a scroll has // Wait a while before unpausing the occlusion tracker after a scroll has
// completed as the user may start another scroll. // completed as the user may start another scroll.
constexpr base::TimeDelta kOcclusionUnpauseDurationForScroll = constexpr base::TimeDelta kOcclusionUnpauseDurationForScroll =
...@@ -1448,7 +1445,6 @@ void OverviewGrid::StartScroll() { ...@@ -1448,7 +1445,6 @@ void OverviewGrid::StartScroll() {
// |scroll_offset_| is added to adjust for that. // |scroll_offset_| is added to adjust for that.
rightmost_window_right -= scroll_offset_; rightmost_window_right -= scroll_offset_;
scroll_offset_min_ = total_bounds.right() - rightmost_window_right; scroll_offset_min_ = total_bounds.right() - rightmost_window_right;
scroll_current_delta_ = 0.f;
presentation_time_recorder_ = CreatePresentationTimeHistogramRecorder( presentation_time_recorder_ = CreatePresentationTimeHistogramRecorder(
const_cast<ui::Compositor*>(root_window()->layer()->GetCompositor()), const_cast<ui::Compositor*>(root_window()->layer()->GetCompositor()),
...@@ -1456,9 +1452,8 @@ void OverviewGrid::StartScroll() { ...@@ -1456,9 +1452,8 @@ void OverviewGrid::StartScroll() {
} }
bool OverviewGrid::UpdateScrollOffset(float delta) { bool OverviewGrid::UpdateScrollOffset(float delta) {
scroll_current_delta_ += delta;
float new_scroll_offset = scroll_offset_; float new_scroll_offset = scroll_offset_;
new_scroll_offset += scroll_current_delta_; new_scroll_offset += delta;
new_scroll_offset = new_scroll_offset =
base::ClampToRange(new_scroll_offset, scroll_offset_min_, 0.f); base::ClampToRange(new_scroll_offset, scroll_offset_min_, 0.f);
...@@ -1469,13 +1464,6 @@ bool OverviewGrid::UpdateScrollOffset(float delta) { ...@@ -1469,13 +1464,6 @@ bool OverviewGrid::UpdateScrollOffset(float delta) {
if (new_scroll_offset == scroll_offset_) if (new_scroll_offset == scroll_offset_)
return in_range; return in_range;
// Do not process scrolls that haven't moved much, unless we are at the
// edges.
if (std::abs(scroll_offset_ - new_scroll_offset) < kMinimumScrollDistanceDp &&
in_range) {
return true;
}
// Update the bounds of the items which are currently visible on screen. // Update the bounds of the items which are currently visible on screen.
DCHECK_EQ(items_scrolling_bounds_.size(), window_list_.size()); DCHECK_EQ(items_scrolling_bounds_.size(), window_list_.size());
for (size_t i = 0; i < items_scrolling_bounds_.size(); ++i) { for (size_t i = 0; i < items_scrolling_bounds_.size(); ++i) {
...@@ -1488,7 +1476,6 @@ bool OverviewGrid::UpdateScrollOffset(float delta) { ...@@ -1488,7 +1476,6 @@ bool OverviewGrid::UpdateScrollOffset(float delta) {
} }
} }
scroll_current_delta_ = 0.f;
scroll_offset_ = new_scroll_offset; scroll_offset_ = new_scroll_offset;
DCHECK(presentation_time_recorder_); DCHECK(presentation_time_recorder_);
......
...@@ -452,10 +452,6 @@ class ASH_EXPORT OverviewGrid : public SplitViewObserver, ...@@ -452,10 +452,6 @@ class ASH_EXPORT OverviewGrid : public SplitViewObserver,
// are visible in tablet overview mode. // are visible in tablet overview mode.
float scroll_offset_min_ = 0; float scroll_offset_min_ = 0;
// Sum of the deltas passed by |UpdateScrollOffset|, this is so we can ignore
// deltas that are too small for performance reasons.
float scroll_current_delta_ = 0.f;
// Cached values of the item bounds so that they do not have to be calculated // Cached values of the item bounds so that they do not have to be calculated
// on each scroll update. // on each scroll update.
std::vector<gfx::RectF> items_scrolling_bounds_; std::vector<gfx::RectF> items_scrolling_bounds_;
......
...@@ -746,6 +746,8 @@ void OverviewSession::OnDisplayRemoved(const display::Display& display) { ...@@ -746,6 +746,8 @@ void OverviewSession::OnDisplayRemoved(const display::Display& display) {
void OverviewSession::OnDisplayMetricsChanged(const display::Display& display, void OverviewSession::OnDisplayMetricsChanged(const display::Display& display,
uint32_t metrics) { uint32_t metrics) {
if (window_drag_controller_)
ResetDraggedWindowGesture();
GetGridWithRootWindow(Shell::GetRootWindowForDisplayId(display.id())) GetGridWithRootWindow(Shell::GetRootWindowForDisplayId(display.id()))
->OnDisplayMetricsChanged(); ->OnDisplayMetricsChanged();
......
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