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

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

Issue 2553603002: New accessibility virtual keyboard behavior in non-sticky mode. (Closed)
Patch Set: Fix the build error on Linux and Windows Created 3 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 94d72f2215c343d064dce218f742f1e1d442a094..d7251f35c1541f405c9a96624ddc0eda6a21fe3b 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,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"
@@ -94,6 +95,8 @@
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/skia_util.h"
#include "ui/touch_selection/touch_selection_controller.h"
+#include "ui/wm/core/coordinate_conversion.h"
+#include "ui/wm/core/ime_util.h"
#include "ui/wm/public/activation_client.h"
#include "ui/wm/public/scoped_tooltip_disabler.h"
#include "ui/wm/public/tooltip_client.h"
@@ -574,6 +577,10 @@ void RenderWidgetHostViewAura::Hide() {
#endif
}
+aura::Window* RenderWidgetHostViewAura::GetToplevelWindow() {
+ return window_->GetToplevelWindow();
+}
+
void RenderWidgetHostViewAura::SetSize(const gfx::Size& size) {
// For a SetSize operation, we don't care what coordinate system the origin
// of the window is in, it's only important to make sure that the origin
@@ -1278,26 +1285,6 @@ gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen(
end.y() - origin.y());
}
-gfx::Rect RenderWidgetHostViewAura::ConvertRectFromScreen(
- const gfx::Rect& rect) const {
- gfx::Point origin = rect.origin();
- gfx::Point end = gfx::Point(rect.right(), rect.bottom());
-
- aura::Window* root_window = window_->GetRootWindow();
- if (root_window) {
- aura::client::ScreenPositionClient* screen_position_client =
- aura::client::GetScreenPositionClient(root_window);
- screen_position_client->ConvertPointFromScreen(window_, &origin);
- screen_position_client->ConvertPointFromScreen(window_, &end);
- return gfx::Rect(origin.x(),
- origin.y(),
- end.x() - origin.x(),
- end.y() - origin.y());
- }
-
- return rect;
-}
-
gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const {
if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
return gfx::Rect();
@@ -1433,16 +1420,18 @@ void RenderWidgetHostViewAura::ExtendSelectionAndDelete(
rfh->ExtendSelectionAndDelete(before, after);
}
-void RenderWidgetHostViewAura::EnsureCaretNotInRect(const gfx::Rect& rect) {
- gfx::Rect rect_in_local_space = ConvertRectFromScreen(rect);
- gfx::Rect hiding_area_in_this_window =
- gfx::IntersectRects(rect_in_local_space, window_->bounds());
+void RenderWidgetHostViewAura::EnsureCaretNotInRect(
+ const gfx::Rect& rect_in_screen) {
+ aura::Window* top_level_window = GetToplevelWindow();
+ wm::EnsureWindowNotInRect(top_level_window, rect_in_screen);
- if (hiding_area_in_this_window.IsEmpty())
- return;
-
- host_->ScrollFocusedEditableNodeIntoRect(
- gfx::SubtractRects(window_->bounds(), hiding_area_in_this_window));
+ // Perform overscroll if the caret is still hidden by the keyboard.
+ const gfx::Rect hidden_window_bounds_in_screen = gfx::IntersectRects(
+ rect_in_screen, top_level_window->GetBoundsInScreen());
oshima 2017/04/26 18:03:42 don't you have to check if this is empty, and retu
oshima 2017/05/01 21:57:18 ping?
yhanada 2017/05/02 02:19:40 Sorry, I missed the comments. I added early return
+ gfx::Rect visible_area_in_local_space = gfx::SubtractRects(
+ window_->GetBoundsInScreen(), hidden_window_bounds_in_screen);
+ wm::ConvertRectFromScreen(window_, &visible_area_in_local_space);
oshima 2017/04/26 18:03:42 visible area can still be empty in non ash environ
yhanada 2017/05/02 02:19:40 Yes.
+ host_->ScrollFocusedEditableNodeIntoRect(visible_area_in_local_space);
}
bool RenderWidgetHostViewAura::IsTextEditCommandEnabled(
@@ -2225,8 +2214,10 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() {
void RenderWidgetHostViewAura::DetachFromInputMethod() {
ui::InputMethod* input_method = GetInputMethod();
- if (input_method)
+ if (input_method) {
input_method->DetachTextInputClient(this);
+ wm::RestoreWindowBoundsOnClientFocusLost(GetToplevelWindow());
+ }
}
void RenderWidgetHostViewAura::ForwardKeyboardEvent(

Powered by Google App Engine
This is Rietveld 408576698