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

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: reupload Created 4 years 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 #include "ui/aura/client/transient_window_client.h" 66 #include "ui/aura/client/transient_window_client.h"
67 #include "ui/aura/client/window_parenting_client.h" 67 #include "ui/aura/client/window_parenting_client.h"
68 #include "ui/aura/env.h" 68 #include "ui/aura/env.h"
69 #include "ui/aura/window.h" 69 #include "ui/aura/window.h"
70 #include "ui/aura/window_event_dispatcher.h" 70 #include "ui/aura/window_event_dispatcher.h"
71 #include "ui/aura/window_observer.h" 71 #include "ui/aura/window_observer.h"
72 #include "ui/aura/window_tree_host.h" 72 #include "ui/aura/window_tree_host.h"
73 #include "ui/base/clipboard/scoped_clipboard_writer.h" 73 #include "ui/base/clipboard/scoped_clipboard_writer.h"
74 #include "ui/base/hit_test.h" 74 #include "ui/base/hit_test.h"
75 #include "ui/base/ime/input_method.h" 75 #include "ui/base/ime/input_method.h"
76 #include "ui/base/ui_base_switches.h"
76 #include "ui/base/ui_base_types.h" 77 #include "ui/base/ui_base_types.h"
77 #include "ui/compositor/compositor_vsync_manager.h" 78 #include "ui/compositor/compositor_vsync_manager.h"
78 #include "ui/compositor/dip_util.h" 79 #include "ui/compositor/dip_util.h"
79 #include "ui/display/display.h" 80 #include "ui/display/display.h"
80 #include "ui/display/screen.h" 81 #include "ui/display/screen.h"
81 #include "ui/events/blink/blink_event_util.h" 82 #include "ui/events/blink/blink_event_util.h"
82 #include "ui/events/blink/web_input_event.h" 83 #include "ui/events/blink/web_input_event.h"
83 #include "ui/events/event.h" 84 #include "ui/events/event.h"
84 #include "ui/events/event_utils.h" 85 #include "ui/events/event_utils.h"
85 #include "ui/events/gesture_detection/gesture_configuration.h" 86 #include "ui/events/gesture_detection/gesture_configuration.h"
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 } 1419 }
1419 1420
1420 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( 1421 void RenderWidgetHostViewAura::ExtendSelectionAndDelete(
1421 size_t before, size_t after) { 1422 size_t before, size_t after) {
1422 RenderFrameHostImpl* rfh = GetFocusedFrame(); 1423 RenderFrameHostImpl* rfh = GetFocusedFrame();
1423 if (rfh) 1424 if (rfh)
1424 rfh->ExtendSelectionAndDelete(before, after); 1425 rfh->ExtendSelectionAndDelete(before, after);
1425 } 1426 }
1426 1427
1427 void RenderWidgetHostViewAura::EnsureCaretOutOfRect(const gfx::Rect& rect) { 1428 void RenderWidgetHostViewAura::EnsureCaretOutOfRect(const gfx::Rect& rect) {
1428 gfx::Rect hiding_area_in_this_window( 1429 // Perform overscroll.
1430 const gfx::Rect hiding_area_in_this_window(
1429 gfx::IntersectRects(rect, window_->GetBoundsInScreen())); 1431 gfx::IntersectRects(rect, window_->GetBoundsInScreen()));
1432 if (hiding_area_in_this_window.IsEmpty()) {
1433 OnClientFocusLost();
1434 return;
1435 }
1430 1436
1431 if (hiding_area_in_this_window.IsEmpty()) 1437 const gfx::Rect visible_area_in_this_window(gfx::SubtractRects(
1438 window_->GetBoundsInScreen(), hiding_area_in_this_window));
1439
1440 #if defined(OS_CHROMEOS)
1441 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1442 ::switches::kUseNewVirtualKeyboardBehavior))
1432 return; 1443 return;
1433 1444
1445 aura::Window* top_level_window = window_->GetToplevelWindow();
1446 // Calculate vertical window shift.
1447 const gfx::Rect window_bounds = top_level_window->GetBoundsInRootWindow();
1448 const int vertical_displacement =
1449 std::max(0, top_level_window->GetBoundsInScreen().bottom() -
1450 visible_area_in_this_window.bottom());
1451 const int shift = std::min(vertical_displacement, window_bounds.y());
1452
1453 // Set restore bounds and move window.
1454 if (shift > 0) {
1455 const gfx::Point origin(window_bounds.x(), window_bounds.y() - shift);
1456 top_level_window->SetProperty(
1457 aura::client::kVirtualKeyboardRestoreBoundsKey,
1458 new gfx::Rect(window_bounds));
1459 top_level_window->SetBounds(gfx::Rect(origin, window_bounds.size()));
1460 }
1461 #endif // defined(OS_CHROMEOS)
1462
1434 host_->ScrollFocusedEditableNodeIntoRect( 1463 host_->ScrollFocusedEditableNodeIntoRect(
1435 ConvertRectFromScreen(gfx::SubtractRects(window_->GetBoundsInScreen(), 1464 ConvertRectFromScreen(visible_area_in_this_window));
1436 hiding_area_in_this_window))); 1465 }
1466
1467 void RenderWidgetHostViewAura::OnClientFocusLost() {
1468 #if defined(OS_CHROMEOS)
1469 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1470 ::switches::kUseNewVirtualKeyboardBehavior))
1471 return;
1472
1473 // Get restore bounds of window.
1474 aura::Window* top_level_window = window_->GetToplevelWindow();
1475 gfx::Rect* vk_restore_bounds = top_level_window->GetProperty(
1476 aura::client::kVirtualKeyboardRestoreBoundsKey);
1477
1478 if (vk_restore_bounds) {
1479 // Restore window.
1480 top_level_window->SetBounds(*vk_restore_bounds);
1481 top_level_window->ClearProperty(
1482 aura::client::kVirtualKeyboardRestoreBoundsKey);
1483 }
1484 #endif // defined(OS_CHROMEOS)
1437 } 1485 }
1438 1486
1439 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled( 1487 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled(
1440 ui::TextEditCommand command) const { 1488 ui::TextEditCommand command) const {
1441 return false; 1489 return false;
1442 } 1490 }
1443 1491
1444 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent( 1492 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent(
1445 ui::TextEditCommand command) {} 1493 ui::TextEditCommand command) {}
1446 1494
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
2389 2437
2390 void RenderWidgetHostViewAura::SetPopupChild( 2438 void RenderWidgetHostViewAura::SetPopupChild(
2391 RenderWidgetHostViewAura* popup_child_host_view) { 2439 RenderWidgetHostViewAura* popup_child_host_view) {
2392 popup_child_host_view_ = popup_child_host_view; 2440 popup_child_host_view_ = popup_child_host_view;
2393 event_handler_->SetPopupChild( 2441 event_handler_->SetPopupChild(
2394 popup_child_host_view, 2442 popup_child_host_view,
2395 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); 2443 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr);
2396 } 2444 }
2397 2445
2398 } // namespace content 2446 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698