Commit 2ef3038d authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

[VK] Check for empty occluded bounds in AppListFolderView.

In AppListFolderView, we currently use the virtual keyboard occluded
bounds without checking if it's empty first. This means that when we
use the floating keyboard, which has empty occluded bounds,
AppListFolderView thinks that the occluded y position is 0, so it
overscrolls the view off the screen.

We change the code to only overscroll if the occluded bounds are not
empty.

Bug: 860087
Change-Id: Ibab4170a73932c587bb87ef368a1682885189429
Reviewed-on: https://chromium-review.googlesource.com/1124733Reviewed-by: default avatarcalamity <calamity@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#572465}
parent fa0d62ef
...@@ -589,16 +589,18 @@ void AppListFolderView::UpdatePreferredBounds() { ...@@ -589,16 +589,18 @@ void AppListFolderView::UpdatePreferredBounds() {
preferred_bounds_.AdjustToFit(container_view_->GetContentsBounds()); preferred_bounds_.AdjustToFit(container_view_->GetContentsBounds());
auto* const keyboard_controller = keyboard::KeyboardController::Get(); auto* const keyboard_controller = keyboard::KeyboardController::Get();
if (keyboard_controller->enabled() && if (keyboard_controller->enabled()) {
contents_view_->app_list_view()->onscreen_keyboard_shown()) {
// This view should be on top of on-screen keyboard to prevent the folder // This view should be on top of on-screen keyboard to prevent the folder
// title from being blocked. // title from being blocked.
gfx::Point keyboard_top_right = const gfx::Rect occluded_bounds =
keyboard_controller->GetWorkspaceOccludedBounds().top_right(); keyboard_controller->GetWorkspaceOccludedBounds();
ConvertPointFromScreen(parent(), &keyboard_top_right); if (!occluded_bounds.IsEmpty()) {
int y_offset = keyboard_top_right.y() - kOnscreenKeyboardTopPadding - gfx::Point keyboard_top_right = occluded_bounds.top_right();
preferred_bounds_.bottom(); ConvertPointFromScreen(parent(), &keyboard_top_right);
preferred_bounds_.Offset(0, std::min(0, y_offset)); int y_offset = keyboard_top_right.y() - kOnscreenKeyboardTopPadding -
preferred_bounds_.bottom();
preferred_bounds_.Offset(0, std::min(0, y_offset));
}
} }
// Calculate the folder icon's bounds relative to this view. // Calculate the folder icon's bounds relative to this view.
......
...@@ -229,7 +229,6 @@ class APP_LIST_EXPORT AppListView : public views::WidgetDelegateView, ...@@ -229,7 +229,6 @@ class APP_LIST_EXPORT AppListView : public views::WidgetDelegateView,
void set_onscreen_keyboard_shown(bool onscreen_keyboard_shown) { void set_onscreen_keyboard_shown(bool onscreen_keyboard_shown) {
onscreen_keyboard_shown_ = onscreen_keyboard_shown; onscreen_keyboard_shown_ = onscreen_keyboard_shown;
} }
bool onscreen_keyboard_shown() const { return onscreen_keyboard_shown_; }
// Returns true if the home launcher is enabled in tablet mode. // Returns true if the home launcher is enabled in tablet mode.
bool IsHomeLauncherEnabledInTabletMode() const; bool IsHomeLauncherEnabledInTabletMode() const;
......
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