Commit 728fea84 authored by Weidong Guo's avatar Weidong Guo Committed by Commit Bot

Fix search box bounds issue after screen rotation in overview mode

Changes:
Convert search box bounds to widget coordinates without considering
transform so that it is not affected by overview mode transform
animation.

Bug: 877282
Change-Id: I8de8e497a50b336a9be511ee87662b62599b2c87
Reviewed-on: https://chromium-review.googlesource.com/1187888Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Weidong Guo <weidongg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586009}
parent adaab7da
...@@ -305,7 +305,7 @@ void ContentsView::UpdateSearchBox(double progress, ...@@ -305,7 +305,7 @@ void ContentsView::UpdateSearchBox(double progress,
search_box->UpdateBackground(progress, current_state, target_state); search_box->UpdateBackground(progress, current_state, target_state);
search_box->GetWidget()->SetBounds( search_box->GetWidget()->SetBounds(
search_box->GetViewBoundsForSearchBoxContentsBounds( search_box->GetViewBoundsForSearchBoxContentsBounds(
ConvertRectToWidget(search_box_rect))); ConvertRectToWidgetWithoutTransform(search_box_rect)));
} }
void ContentsView::UpdateExpandArrowOpacity(double progress, void ContentsView::UpdateExpandArrowOpacity(double progress,
...@@ -574,4 +574,13 @@ bool ContentsView::ShouldLayoutPage(AppListPage* page, ...@@ -574,4 +574,13 @@ bool ContentsView::ShouldLayoutPage(AppListPage* page,
return false; return false;
} }
gfx::Rect ContentsView::ConvertRectToWidgetWithoutTransform(
const gfx::Rect& rect) {
gfx::Rect widget_rect = rect;
for (const views::View* v = this; v; v = v->parent()) {
widget_rect.Offset(v->GetMirroredPosition().OffsetFromOrigin());
}
return widget_rect;
}
} // namespace app_list } // namespace app_list
...@@ -226,6 +226,9 @@ class APP_LIST_EXPORT ContentsView : public views::View, ...@@ -226,6 +226,9 @@ class APP_LIST_EXPORT ContentsView : public views::View,
ash::AppListState current_state, ash::AppListState current_state,
ash::AppListState target_state) const; ash::AppListState target_state) const;
// Converts rect to widget without applying transform.
gfx::Rect ConvertRectToWidgetWithoutTransform(const gfx::Rect& rect);
// Unowned pointer to application list model. // Unowned pointer to application list model.
AppListModel* model_ = nullptr; AppListModel* model_ = nullptr;
......
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