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

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

Issue 1986153005: The on screen keyboard on Windows 8+ should not obscure the input field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address sky unittest review comments Created 4 years, 7 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_view_host_impl.cc
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index c457e2c339f50a4ca165710470be9a12f0d3b7df..abee01e209e1fe10c72b2e2afe764cb7d3fcf836 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -90,8 +90,8 @@
#include "url/url_constants.h"
#if defined(OS_WIN)
-#include "base/win/win_util.h"
#include "ui/display/win/dpi.h"
+#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/platform_font_win.h"
#endif
@@ -108,27 +108,6 @@ namespace content {
namespace {
#if defined(OS_WIN)
-
-const int kVirtualKeyboardDisplayWaitTimeoutMs = 100;
-const int kMaxVirtualKeyboardDisplayRetries = 5;
-
-void DismissVirtualKeyboardTask() {
- static int virtual_keyboard_display_retries = 0;
- // If the virtual keyboard is not yet visible, then we execute the task again
- // waiting for it to show up.
- if (!base::win::DismissVirtualKeyboard()) {
- if (virtual_keyboard_display_retries < kMaxVirtualKeyboardDisplayRetries) {
- BrowserThread::PostDelayedTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)),
- TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs));
- ++virtual_keyboard_display_retries;
- } else {
- virtual_keyboard_display_retries = 0;
- }
- }
-}
-
void GetWindowsSpecificPrefs(RendererPreferences* prefs) {
NONCLIENTMETRICS_XP metrics = {0};
base::win::GetNonClientMetrics(&metrics);
@@ -163,7 +142,6 @@ void GetWindowsSpecificPrefs(RendererPreferences* prefs) {
display::win::GetSystemMetricsInDIP(SM_CXHSCROLL);
}
#endif
-
} // namespace
// static
@@ -227,7 +205,6 @@ RenderViewHostImpl::RenderViewHostImpl(
is_waiting_for_close_ack_(false),
sudden_termination_allowed_(false),
render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
- virtual_keyboard_requested_(false),
is_focused_element_editable_(false),
updating_web_preferences_(false),
render_view_ready_on_process_launch_(false),
@@ -1127,16 +1104,6 @@ void RenderViewHostImpl::OnFocusedNodeChanged(
is_focused_element_editable_ = is_editable_node;
if (GetWidget()->GetView())
GetWidget()->GetView()->FocusedNodeChanged(is_editable_node);
-#if defined(OS_WIN)
- if (!is_editable_node && virtual_keyboard_requested_) {
- virtual_keyboard_requested_ = false;
- delegate_->SetIsVirtualKeyboardRequested(false);
- BrowserThread::PostDelayedTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)),
- TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs));
- }
-#endif
// None of the rest makes sense without a view.
if (!GetWidget()->GetView())
@@ -1299,14 +1266,20 @@ void RenderViewHostImpl::OnRunFileChooser(const FileChooserParams& params) {
void RenderViewHostImpl::OnFocusedNodeTouched(bool editable) {
#if defined(OS_WIN)
- if (editable) {
- virtual_keyboard_requested_ = base::win::DisplayVirtualKeyboard();
- delegate_->SetIsVirtualKeyboardRequested(true);
- } else {
- virtual_keyboard_requested_ = false;
- delegate_->SetIsVirtualKeyboardRequested(false);
- base::win::DismissVirtualKeyboard();
- }
+ // We use the cursor position to determine where the touch occurred.
+ // TODO(ananta)
+ // Pass this information from blink.
+ // In site isolation mode, we may not have a RenderViewHostImpl instance
+ // which means that displaying the OSK is not going to work. We should
+ // probably move this to RenderWidgetHostImpl and call the view from there.
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=613326
+ POINT cursor_pos = {};
+ ::GetCursorPos(&cursor_pos);
+ float scale = GetScaleFactorForView(GetWidget()->GetView());
+ gfx::Point location_dips_screen =
+ gfx::ConvertPointToDIP(scale, gfx::Point(cursor_pos));
+ if (GetWidget()->GetView())
+ GetWidget()->GetView()->FocusedNodeTouched(location_dips_screen, editable);
#endif
}
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698