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

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

Issue 2240353002: move switch Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Virtual keyboard non-sticky mode changes. Created 4 years, 4 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 | « chrome/browser/chromeos/login/chrome_restart_request.cc ('k') | ui/aura/client/aura_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 39f5cbc36e54d8cfa728bfb39381e35bbb3e7907..6a8d5cbb83414d28518e05adadfd7fea84900853 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"
@@ -1611,11 +1612,36 @@ void RenderWidgetHostViewAura::EnsureCaretInRect(const gfx::Rect& rect) {
gfx::Rect intersected_rect(
gfx::IntersectRects(rect, window_->GetBoundsInScreen()));
- if (intersected_rect.IsEmpty())
+ if (!intersected_rect.IsEmpty())
+ host_->ScrollFocusedEditableNodeIntoRect(
+ ConvertRectFromScreen(intersected_rect));
+
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ ::switches::kUseNewVKWindowBehavior))
+ return;
+
+ display::Screen* screen = display::Screen::GetScreen();
+ if (screen->GetPrimaryDisplay().id() !=
+ screen->GetDisplayNearestWindow(window_).id())
return;
- host_->ScrollFocusedEditableNodeIntoRect(
- ConvertRectFromScreen(intersected_rect));
+ aura::Window* top_level_window = window_->GetToplevelWindow();
+
+ if (top_level_window->GetProperty(aura::client::kVKNewBoundsKey)) {
+ top_level_window->ClearProperty(aura::client::kVKNewBoundsKey);
+ } else if (rect != screen->GetPrimaryDisplay().bounds()) {
+ gfx::Rect window_bounds = top_level_window->GetBoundsInRootWindow();
+ int vertical_displacement =
+ std::max(0, window_bounds.bottom() - rect.bottom());
+ int shift = std::min(vertical_displacement, window_bounds.y());
+
+ if (shift > 0) {
+ gfx::Point origin(window_bounds.x(), window_bounds.y() - shift);
+ top_level_window->SetProperty(
+ aura::client::kVKNewBoundsKey,
+ new gfx::Rect(origin, window_bounds.size()));
+ }
+ }
}
bool RenderWidgetHostViewAura::IsTextEditCommandEnabled(
« no previous file with comments | « chrome/browser/chromeos/login/chrome_restart_request.cc ('k') | ui/aura/client/aura_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698