| 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 36d0a59e1fd4a21d459086b1b07491f8d1be3c8d..afa78f8f2977ee96a4660cc11f337cdb73277460 100644
|
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
|
| @@ -73,6 +73,7 @@
|
| #include "ui/base/clipboard/scoped_clipboard_writer.h"
|
| #include "ui/base/hit_test.h"
|
| #include "ui/base/ime/input_method.h"
|
| +#include "ui/base/ui_base_switches.h"
|
| #include "ui/base/ui_base_types.h"
|
| #include "ui/compositor/compositor_vsync_manager.h"
|
| #include "ui/compositor/dip_util.h"
|
| @@ -1425,15 +1426,62 @@ void RenderWidgetHostViewAura::ExtendSelectionAndDelete(
|
| }
|
|
|
| void RenderWidgetHostViewAura::EnsureCaretOutOfRect(const gfx::Rect& rect) {
|
| - gfx::Rect hiding_area_in_this_window(
|
| + // Perform overscroll.
|
| + const gfx::Rect hiding_area_in_this_window(
|
| gfx::IntersectRects(rect, window_->GetBoundsInScreen()));
|
| + if (hiding_area_in_this_window.IsEmpty()) {
|
| + OnClientFocusLost();
|
| + return;
|
| + }
|
|
|
| - if (hiding_area_in_this_window.IsEmpty())
|
| + const gfx::Rect visible_area_in_this_window(gfx::SubtractRects(
|
| + window_->GetBoundsInScreen(), hiding_area_in_this_window));
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + ::switches::kUseNewVirtualKeyboardBehavior))
|
| return;
|
|
|
| + aura::Window* top_level_window = window_->GetToplevelWindow();
|
| + // Calculate vertical window shift.
|
| + const gfx::Rect window_bounds = top_level_window->GetBoundsInRootWindow();
|
| + const int vertical_displacement =
|
| + std::max(0, top_level_window->GetBoundsInScreen().bottom() -
|
| + visible_area_in_this_window.bottom());
|
| + const int shift = std::min(vertical_displacement, window_bounds.y());
|
| +
|
| + // Set restore bounds and move window.
|
| + if (shift > 0) {
|
| + const gfx::Point origin(window_bounds.x(), window_bounds.y() - shift);
|
| + top_level_window->SetProperty(
|
| + aura::client::kVirtualKeyboardRestoreBoundsKey,
|
| + new gfx::Rect(window_bounds));
|
| + top_level_window->SetBounds(gfx::Rect(origin, window_bounds.size()));
|
| + }
|
| +#endif // defined(OS_CHROMEOS)
|
| +
|
| host_->ScrollFocusedEditableNodeIntoRect(
|
| - ConvertRectFromScreen(gfx::SubtractRects(window_->GetBoundsInScreen(),
|
| - hiding_area_in_this_window)));
|
| + ConvertRectFromScreen(visible_area_in_this_window));
|
| +}
|
| +
|
| +void RenderWidgetHostViewAura::OnClientFocusLost() {
|
| +#if defined(OS_CHROMEOS)
|
| + if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + ::switches::kUseNewVirtualKeyboardBehavior))
|
| + return;
|
| +
|
| + // Get restore bounds of window.
|
| + aura::Window* top_level_window = window_->GetToplevelWindow();
|
| + gfx::Rect* vk_restore_bounds = top_level_window->GetProperty(
|
| + aura::client::kVirtualKeyboardRestoreBoundsKey);
|
| +
|
| + if (vk_restore_bounds) {
|
| + // Restore window.
|
| + top_level_window->SetBounds(*vk_restore_bounds);
|
| + top_level_window->ClearProperty(
|
| + aura::client::kVirtualKeyboardRestoreBoundsKey);
|
| + }
|
| +#endif // defined(OS_CHROMEOS)
|
| }
|
|
|
| bool RenderWidgetHostViewAura::IsTextEditCommandEnabled(
|
|
|