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

Unified Diff: ash/shelf/shelf_layout_manager.cc

Issue 195793004: Implement overscroll support for the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge ToT Created 6 years, 8 months 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
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_layout_manager.cc
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc
index 31351ac2150d673e00c0b2a695a7e60b4d9a2111..7a1998dca80183d7ccc5646732d3033a6abcce3e 100644
--- a/ash/shelf/shelf_layout_manager.cc
+++ b/ash/shelf/shelf_layout_manager.cc
@@ -46,6 +46,7 @@
#include "ui/events/event.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/screen.h"
+#include "ui/keyboard/keyboard_util.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/public/activation_client.h"
@@ -775,7 +776,7 @@ void ShelfLayoutManager::AdjustBoundsBasedOnAlignment(int inset,
void ShelfLayoutManager::CalculateTargetBounds(
const State& state,
TargetBounds* target_bounds) {
- const gfx::Rect available_bounds(GetAvailableBounds());
+ const gfx::Rect available_bounds(root_window_->bounds());
gfx::Rect status_size(
shelf_->status_area_widget()->GetWindowBoundsInScreen().size());
int shelf_width = 0, shelf_height = 0;
@@ -795,15 +796,22 @@ void ShelfLayoutManager::CalculateTargetBounds(
else
shelf_width = kAutoHideSize;
} else if (state.visibility_state == SHELF_HIDDEN ||
- !keyboard_bounds_.IsEmpty()) {
+ (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()))
+ {
if (IsHorizontalAlignment())
shelf_height = 0;
else
shelf_width = 0;
}
+ int bottom_shelf_vertical_offset = available_bounds.bottom();
+ if (keyboard_bounds_.IsEmpty())
+ bottom_shelf_vertical_offset -= shelf_height;
+ else
+ bottom_shelf_vertical_offset -= keyboard_bounds_.height();
+
target_bounds->shelf_bounds_in_root = SelectValueForShelfAlignment(
- gfx::Rect(available_bounds.x(), available_bounds.bottom() - shelf_height,
+ gfx::Rect(available_bounds.x(), bottom_shelf_vertical_offset,
available_bounds.width(), shelf_height),
gfx::Rect(available_bounds.x(), available_bounds.y(),
shelf_width, available_bounds.height()),
@@ -839,8 +847,8 @@ void ShelfLayoutManager::CalculateTargetBounds(
// should probably be pushed to a separate component. This would simplify or
// remove entirely the dependency on keyboard and dock.
- // Also push in the work area inset for the keyboard if it is visible.
- if (!keyboard_bounds_.IsEmpty()) {
+ if (!keyboard_bounds_.IsEmpty() && !keyboard::IsKeyboardOverscrollEnabled()) {
+ // Also push in the work area inset for the keyboard if it is visible.
gfx::Insets keyboard_insets(0, 0, keyboard_bounds_.height(), 0);
target_bounds->work_area_insets += keyboard_insets;
}
@@ -1134,12 +1142,6 @@ bool ShelfLayoutManager::IsShelfForcedToBeVisible() const {
WORKSPACE_WINDOW_STATE_FULL_SCREEN;
}
-gfx::Rect ShelfLayoutManager::GetAvailableBounds() const {
- gfx::Rect bounds(root_window_->bounds());
- bounds.set_height(bounds.height() - keyboard_bounds_.height());
- return bounds;
-}
-
void ShelfLayoutManager::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {
bool keyboard_is_about_to_hide = false;
if (new_bounds.IsEmpty() && !keyboard_bounds_.IsEmpty())
« no previous file with comments | « ash/shelf/shelf_layout_manager.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698