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

Side by Side 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: rebase Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 #include "ui/aura/client/window_parenting_client.h" 71 #include "ui/aura/client/window_parenting_client.h"
72 #include "ui/aura/env.h" 72 #include "ui/aura/env.h"
73 #include "ui/aura/mus/window_port_mus.h" 73 #include "ui/aura/mus/window_port_mus.h"
74 #include "ui/aura/window.h" 74 #include "ui/aura/window.h"
75 #include "ui/aura/window_event_dispatcher.h" 75 #include "ui/aura/window_event_dispatcher.h"
76 #include "ui/aura/window_observer.h" 76 #include "ui/aura/window_observer.h"
77 #include "ui/aura/window_tree_host.h" 77 #include "ui/aura/window_tree_host.h"
78 #include "ui/base/clipboard/scoped_clipboard_writer.h" 78 #include "ui/base/clipboard/scoped_clipboard_writer.h"
79 #include "ui/base/hit_test.h" 79 #include "ui/base/hit_test.h"
80 #include "ui/base/ime/input_method.h" 80 #include "ui/base/ime/input_method.h"
81 #include "ui/base/ui_base_switches.h"
81 #include "ui/base/ui_base_types.h" 82 #include "ui/base/ui_base_types.h"
82 #include "ui/compositor/compositor_vsync_manager.h" 83 #include "ui/compositor/compositor_vsync_manager.h"
83 #include "ui/compositor/dip_util.h" 84 #include "ui/compositor/dip_util.h"
84 #include "ui/display/screen.h" 85 #include "ui/display/screen.h"
85 #include "ui/events/blink/blink_event_util.h" 86 #include "ui/events/blink/blink_event_util.h"
86 #include "ui/events/blink/web_input_event.h" 87 #include "ui/events/blink/web_input_event.h"
87 #include "ui/events/event.h" 88 #include "ui/events/event.h"
88 #include "ui/events/event_utils.h" 89 #include "ui/events/event_utils.h"
89 #include "ui/events/gesture_detection/gesture_configuration.h" 90 #include "ui/events/gesture_detection/gesture_configuration.h"
90 #include "ui/events/gestures/gesture_recognizer.h" 91 #include "ui/events/gestures/gesture_recognizer.h"
91 #include "ui/gfx/canvas.h" 92 #include "ui/gfx/canvas.h"
92 #include "ui/gfx/geometry/dip_util.h" 93 #include "ui/gfx/geometry/dip_util.h"
93 #include "ui/gfx/geometry/rect_conversions.h" 94 #include "ui/gfx/geometry/rect_conversions.h"
94 #include "ui/gfx/geometry/size_conversions.h" 95 #include "ui/gfx/geometry/size_conversions.h"
95 #include "ui/gfx/skia_util.h" 96 #include "ui/gfx/skia_util.h"
96 #include "ui/touch_selection/touch_selection_controller.h" 97 #include "ui/touch_selection/touch_selection_controller.h"
98 #include "ui/wm/core/coordinate_conversion.h"
97 #include "ui/wm/public/activation_client.h" 99 #include "ui/wm/public/activation_client.h"
98 #include "ui/wm/public/scoped_tooltip_disabler.h" 100 #include "ui/wm/public/scoped_tooltip_disabler.h"
99 #include "ui/wm/public/tooltip_client.h" 101 #include "ui/wm/public/tooltip_client.h"
100 102
101 #if defined(OS_WIN) 103 #if defined(OS_WIN)
102 #include "base/time/time.h" 104 #include "base/time/time.h"
103 #include "content/browser/accessibility/browser_accessibility_manager_win.h" 105 #include "content/browser/accessibility/browser_accessibility_manager_win.h"
104 #include "content/browser/accessibility/browser_accessibility_win.h" 106 #include "content/browser/accessibility/browser_accessibility_win.h"
105 #include "content/browser/renderer_host/legacy_render_widget_host_win.h" 107 #include "content/browser/renderer_host/legacy_render_widget_host_win.h"
106 #include "ui/base/win/hidden_window.h" 108 #include "ui/base/win/hidden_window.h"
107 #include "ui/base/win/osk_display_manager.h" 109 #include "ui/base/win/osk_display_manager.h"
108 #include "ui/base/win/osk_display_observer.h" 110 #include "ui/base/win/osk_display_observer.h"
109 #include "ui/display/win/screen_win.h" 111 #include "ui/display/win/screen_win.h"
110 #include "ui/gfx/gdi_util.h" 112 #include "ui/gfx/gdi_util.h"
111 #endif 113 #endif
112 114
113 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11) 115 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11)
114 #include "content/browser/accessibility/browser_accessibility_auralinux.h" 116 #include "content/browser/accessibility/browser_accessibility_auralinux.h"
115 #endif 117 #endif
116 118
117 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 119 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
118 #include "ui/base/ime/linux/text_edit_command_auralinux.h" 120 #include "ui/base/ime/linux/text_edit_command_auralinux.h"
119 #include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h" 121 #include "ui/base/ime/linux/text_edit_key_bindings_delegate_auralinux.h"
120 #endif 122 #endif
121 123
124 #if defined(OS_CHROMEOS)
125 #include "ui/wm/core/ime_util_chromeos.h"
126 #endif
127
122 using gfx::RectToSkIRect; 128 using gfx::RectToSkIRect;
123 using gfx::SkIRectToRect; 129 using gfx::SkIRectToRect;
124 130
125 using blink::WebInputEvent; 131 using blink::WebInputEvent;
126 using blink::WebGestureEvent; 132 using blink::WebGestureEvent;
127 using blink::WebTouchEvent; 133 using blink::WebTouchEvent;
128 134
129 namespace content { 135 namespace content {
130 136
131 namespace { 137 namespace {
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 screen_position_client->ConvertPointToScreen(window_, &origin); 1280 screen_position_client->ConvertPointToScreen(window_, &origin);
1275 screen_position_client->ConvertPointToScreen(window_, &end); 1281 screen_position_client->ConvertPointToScreen(window_, &end);
1276 return gfx::Rect(origin.x(), 1282 return gfx::Rect(origin.x(),
1277 origin.y(), 1283 origin.y(),
1278 end.x() - origin.x(), 1284 end.x() - origin.x(),
1279 end.y() - origin.y()); 1285 end.y() - origin.y());
1280 } 1286 }
1281 1287
1282 gfx::Rect RenderWidgetHostViewAura::ConvertRectFromScreen( 1288 gfx::Rect RenderWidgetHostViewAura::ConvertRectFromScreen(
1283 const gfx::Rect& rect) const { 1289 const gfx::Rect& rect) const {
1284 gfx::Point origin = rect.origin(); 1290 gfx::Rect result = rect;
1285 gfx::Point end = gfx::Point(rect.right(), rect.bottom()); 1291 if (window_->GetRootWindow() &&
1286 1292 aura::client::GetScreenPositionClient(window_->GetRootWindow()))
1287 aura::Window* root_window = window_->GetRootWindow(); 1293 wm::ConvertRectFromScreen(window_, &result);
1288 if (root_window) { 1294 return result;
1289 aura::client::ScreenPositionClient* screen_position_client =
1290 aura::client::GetScreenPositionClient(root_window);
1291 screen_position_client->ConvertPointFromScreen(window_, &origin);
1292 screen_position_client->ConvertPointFromScreen(window_, &end);
1293 return gfx::Rect(origin.x(),
1294 origin.y(),
1295 end.x() - origin.x(),
1296 end.y() - origin.y());
1297 }
1298
1299 return rect;
1300 } 1295 }
1301 1296
1302 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { 1297 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const {
1303 if (!text_input_manager_ || !text_input_manager_->GetActiveWidget()) 1298 if (!text_input_manager_ || !text_input_manager_->GetActiveWidget())
1304 return gfx::Rect(); 1299 return gfx::Rect();
1305 1300
1306 const TextInputManager::SelectionRegion* region = 1301 const TextInputManager::SelectionRegion* region =
1307 text_input_manager_->GetSelectionRegion(); 1302 text_input_manager_->GetSelectionRegion();
1308 return ConvertRectToScreen( 1303 return ConvertRectToScreen(
1309 gfx::RectBetweenSelectionBounds(region->anchor, region->focus)); 1304 gfx::RectBetweenSelectionBounds(region->anchor, region->focus));
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 return true; 1422 return true;
1428 } 1423 }
1429 1424
1430 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( 1425 void RenderWidgetHostViewAura::ExtendSelectionAndDelete(
1431 size_t before, size_t after) { 1426 size_t before, size_t after) {
1432 RenderFrameHostImpl* rfh = GetFocusedFrame(); 1427 RenderFrameHostImpl* rfh = GetFocusedFrame();
1433 if (rfh) 1428 if (rfh)
1434 rfh->ExtendSelectionAndDelete(before, after); 1429 rfh->ExtendSelectionAndDelete(before, after);
1435 } 1430 }
1436 1431
1437 void RenderWidgetHostViewAura::EnsureCaretNotInRect(const gfx::Rect& rect) { 1432 void RenderWidgetHostViewAura::EnsureCaretNotInRect(
1438 gfx::Rect rect_in_local_space = ConvertRectFromScreen(rect); 1433 const gfx::Rect& rect_in_screen) {
1439 gfx::Rect hiding_area_in_this_window = 1434 aura::Window* top_level_window = window_->GetToplevelWindow();
1440 gfx::IntersectRects(rect_in_local_space, window_->bounds()); 1435 #if defined(OS_CHROMEOS)
1436 wm::EnsureWindowNotInRect(top_level_window, rect_in_screen);
1437 #endif
1441 1438
1442 if (hiding_area_in_this_window.IsEmpty()) 1439 // Perform overscroll if the caret is still hidden by the keyboard.
1440 const gfx::Rect hidden_window_bounds_in_screen = gfx::IntersectRects(
1441 rect_in_screen, top_level_window->GetBoundsInScreen());
1442 if (hidden_window_bounds_in_screen.IsEmpty())
1443 return; 1443 return;
1444 1444
1445 host_->ScrollFocusedEditableNodeIntoRect( 1445 gfx::Rect visible_area_in_local_space = gfx::SubtractRects(
1446 gfx::SubtractRects(window_->bounds(), hiding_area_in_this_window)); 1446 window_->GetBoundsInScreen(), hidden_window_bounds_in_screen);
1447 visible_area_in_local_space =
1448 ConvertRectFromScreen(visible_area_in_local_space);
1449 host_->ScrollFocusedEditableNodeIntoRect(visible_area_in_local_space);
1447 } 1450 }
1448 1451
1449 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled( 1452 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled(
1450 ui::TextEditCommand command) const { 1453 ui::TextEditCommand command) const {
1451 return false; 1454 return false;
1452 } 1455 }
1453 1456
1454 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent( 1457 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent(
1455 ui::TextEditCommand command) {} 1458 ui::TextEditCommand command) {}
1456 1459
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2216 #if defined(OS_WIN) 2219 #if defined(OS_WIN)
2217 // Update the legacy window's parent temporarily to the hidden window. It 2220 // Update the legacy window's parent temporarily to the hidden window. It
2218 // will eventually get reparented to the right root. 2221 // will eventually get reparented to the right root.
2219 if (legacy_render_widget_host_HWND_) 2222 if (legacy_render_widget_host_HWND_)
2220 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow()); 2223 legacy_render_widget_host_HWND_->UpdateParent(ui::GetHiddenWindow());
2221 #endif 2224 #endif
2222 } 2225 }
2223 2226
2224 void RenderWidgetHostViewAura::DetachFromInputMethod() { 2227 void RenderWidgetHostViewAura::DetachFromInputMethod() {
2225 ui::InputMethod* input_method = GetInputMethod(); 2228 ui::InputMethod* input_method = GetInputMethod();
2226 if (input_method) 2229 if (input_method) {
2227 input_method->DetachTextInputClient(this); 2230 input_method->DetachTextInputClient(this);
2231 #if defined(OS_CHROMEOS)
2232 wm::RestoreWindowBoundsOnClientFocusLost(window_->GetToplevelWindow());
2233 #endif // defined(OS_CHROMEOS)
2234 }
2228 } 2235 }
2229 2236
2230 void RenderWidgetHostViewAura::ForwardKeyboardEvent( 2237 void RenderWidgetHostViewAura::ForwardKeyboardEvent(
2231 const NativeWebKeyboardEvent& event, 2238 const NativeWebKeyboardEvent& event,
2232 bool* update_event) { 2239 bool* update_event) {
2233 RenderWidgetHostImpl* target_host = host_; 2240 RenderWidgetHostImpl* target_host = host_;
2234 2241
2235 // If there are multiple widgets on the page (such as when there are 2242 // If there are multiple widgets on the page (such as when there are
2236 // out-of-process iframes), pick the one that should process this event. 2243 // out-of-process iframes), pick the one that should process this event.
2237 if (host_->delegate()) 2244 if (host_->delegate())
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2374 } 2381 }
2375 2382
2376 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { 2383 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() {
2377 if (!delegated_frame_host_) 2384 if (!delegated_frame_host_)
2378 return; 2385 return;
2379 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || 2386 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ ||
2380 needs_flush_input_); 2387 needs_flush_input_);
2381 } 2388 }
2382 2389
2383 } // namespace content 2390 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698