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

Unified Diff: ui/app_list/views/contents_animator.cc

Issue 781833005: Make SearchResultPageView animation clip to its onscreen bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_overlay_one
Patch Set: address_comments Created 6 years 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/app_list/views/contents_animator.cc
diff --git a/ui/app_list/views/contents_animator.cc b/ui/app_list/views/contents_animator.cc
index fd8048b199b928157e3ba4bd31018b98ccba8869..5f866e58407c0592d2744ecbeaeaae92991302fd 100644
--- a/ui/app_list/views/contents_animator.cc
+++ b/ui/app_list/views/contents_animator.cc
@@ -100,6 +100,20 @@ void ContentsAnimator::UpdateSearchBoxForDefaultAnimation(double progress,
contents_view()->ConvertRectToWidget(search_box_rect));
}
+void ContentsAnimator::ClipPageToOnscreenBounds(
+ int page_index,
+ const gfx::Rect& current_bounds,
+ const gfx::Rect& onscreen_bounds) {
+ int search_results_index =
+ contents_view()->GetPageIndexForState(AppListModel::STATE_SEARCH_RESULTS);
+ if (page_index != search_results_index)
+ return;
+
+ contents_view()
+ ->GetPageView(page_index)
+ ->set_clip_insets(current_bounds.InsetsFrom(onscreen_bounds));
+}
+
// DefaultAnimator
DefaultAnimator::DefaultAnimator(ContentsView* contents_view)
@@ -123,7 +137,10 @@ void DefaultAnimator::Update(double progress, int from_page, int to_page) {
gfx::Tween::RectValueBetween(progress, to_page_origin, to_page_onscreen));
contents_view()->GetPageView(from_page)->SetBoundsRect(from_page_rect);
+ ClipPageToOnscreenBounds(from_page, from_page_rect, from_page_onscreen);
+
contents_view()->GetPageView(to_page)->SetBoundsRect(to_page_rect);
+ ClipPageToOnscreenBounds(to_page, to_page_rect, to_page_onscreen);
UpdateCustomPageForDefaultAnimation(progress, from_page, to_page);
UpdateSearchBoxForDefaultAnimation(progress, from_page, to_page);
« ui/app_list/views/contents_animator.h ('K') | « ui/app_list/views/contents_animator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698