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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 195793004: Implement overscroll support for the virtual keyboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove extra blank line. 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
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index ce3e7c0cf2e1f0ef3d5daa5160a94ddc00085540..f98bee583e2b16c49040c5ff50a8bad3f9f142c1 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -78,6 +78,8 @@
#include "ui/gfx/screen.h"
#include "ui/gfx/size_conversions.h"
#include "ui/gfx/skia_util.h"
+#include "ui/keyboard/keyboard_controller.h"
+#include "ui/keyboard/keyboard_util.h"
#include "ui/wm/public/activation_client.h"
#include "ui/wm/public/scoped_tooltip_disabler.h"
#include "ui/wm/public/tooltip_client.h"
@@ -1451,6 +1453,18 @@ void RenderWidgetHostViewAura::OnSwapCompositorFrame(
}
}
+float RenderWidgetHostViewAura::GetOverdrawBottomHeight() const {
+ float overdraw = 0.f;
+#if defined(OS_CHROMEOS)
+ gfx::Rect window_bounds = window_->GetBoundsInScreen();
+ gfx::Rect intersect = gfx::IntersectRects(window_bounds,
+ virtual_keyboard_bounds_);
+ if (intersect.height() > 0 && intersect.height() < window_bounds.height())
+ overdraw = intersect.height();
+#endif
+ return overdraw;
+}
+
#if defined(OS_WIN)
void RenderWidgetHostViewAura::SetParentNativeViewAccessible(
gfx::NativeViewAccessible accessible_parent) {
@@ -3098,6 +3112,11 @@ void RenderWidgetHostViewAura::AddedToRootWindow() {
input_method->SetFocusedTextInputClient(this);
}
+ keyboard::KeyboardController* keyboard_controller =
+ keyboard::KeyboardController::GetInstance();
+ if (keyboard_controller)
+ keyboard_controller->AddObserver(this);
+
#if defined(OS_WIN)
// The parent may have changed here. Ensure that the legacy window is
// reparented accordingly.
@@ -3122,6 +3141,11 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() {
DetachFromInputMethod();
+ keyboard::KeyboardController* keyboard_controller =
+ keyboard::KeyboardController::GetInstance();
+ if (keyboard_controller)
+ keyboard_controller->RemoveObserver(this);
+
window_->GetHost()->RemoveObserver(this);
RunOnCommitCallbacks();
resize_lock_.reset();
@@ -3212,6 +3236,22 @@ void RenderWidgetHostViewAura::OnLayerRecreated(ui::Layer* old_layer,
}
////////////////////////////////////////////////////////////////////////////////
+// RenderWidgetHostViewAura, aura::client::VirtualKeyboardObserver
sadrul 2014/04/10 18:27:27 keyboard::KeyboardControllerObserver
kevers 2014/04/14 18:47:45 Done.
+// implementation:
+
+void RenderWidgetHostViewAura::OnKeyboardBoundsChanging(
+ const gfx::Rect& new_bounds) {
+#if defined(OS_CHROMEOS)
+ if (!keyboard::IsKeyboardOverscrollEnabled())
+ return;
+ if (virtual_keyboard_bounds_ != new_bounds) {
+ virtual_keyboard_bounds_ = new_bounds;
+ host_->WasResized();
+ }
+#endif
+}
+
+////////////////////////////////////////////////////////////////////////////////
// RenderWidgetHostView, public:
// static

Powered by Google App Engine
This is Rietveld 408576698