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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2259033003: New accessibility virtual keyboard behavior in non-sticky mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make patch relative to previous CL 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 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 #include "ui/aura/client/screen_position_client.h" 64 #include "ui/aura/client/screen_position_client.h"
65 #include "ui/aura/client/window_tree_client.h" 65 #include "ui/aura/client/window_tree_client.h"
66 #include "ui/aura/env.h" 66 #include "ui/aura/env.h"
67 #include "ui/aura/window.h" 67 #include "ui/aura/window.h"
68 #include "ui/aura/window_event_dispatcher.h" 68 #include "ui/aura/window_event_dispatcher.h"
69 #include "ui/aura/window_observer.h" 69 #include "ui/aura/window_observer.h"
70 #include "ui/aura/window_tree_host.h" 70 #include "ui/aura/window_tree_host.h"
71 #include "ui/base/clipboard/scoped_clipboard_writer.h" 71 #include "ui/base/clipboard/scoped_clipboard_writer.h"
72 #include "ui/base/hit_test.h" 72 #include "ui/base/hit_test.h"
73 #include "ui/base/ime/input_method.h" 73 #include "ui/base/ime/input_method.h"
74 #include "ui/base/ui_base_switches.h"
74 #include "ui/base/ui_base_types.h" 75 #include "ui/base/ui_base_types.h"
75 #include "ui/compositor/compositor_vsync_manager.h" 76 #include "ui/compositor/compositor_vsync_manager.h"
76 #include "ui/compositor/dip_util.h" 77 #include "ui/compositor/dip_util.h"
77 #include "ui/display/display.h" 78 #include "ui/display/display.h"
78 #include "ui/display/screen.h" 79 #include "ui/display/screen.h"
79 #include "ui/events/blink/blink_event_util.h" 80 #include "ui/events/blink/blink_event_util.h"
80 #include "ui/events/blink/web_input_event.h" 81 #include "ui/events/blink/web_input_event.h"
81 #include "ui/events/event.h" 82 #include "ui/events/event.h"
82 #include "ui/events/event_utils.h" 83 #include "ui/events/event_utils.h"
83 #include "ui/events/gesture_detection/gesture_configuration.h" 84 #include "ui/events/gesture_detection/gesture_configuration.h"
(...skipping 1529 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 } 1614 }
1614 1615
1615 void RenderWidgetHostViewAura::ExtendSelectionAndDelete( 1616 void RenderWidgetHostViewAura::ExtendSelectionAndDelete(
1616 size_t before, size_t after) { 1617 size_t before, size_t after) {
1617 RenderFrameHostImpl* rfh = GetFocusedFrame(); 1618 RenderFrameHostImpl* rfh = GetFocusedFrame();
1618 if (rfh) 1619 if (rfh)
1619 rfh->ExtendSelectionAndDelete(before, after); 1620 rfh->ExtendSelectionAndDelete(before, after);
1620 } 1621 }
1621 1622
1622 void RenderWidgetHostViewAura::EnsureCaretInRect(const gfx::Rect& rect) { 1623 void RenderWidgetHostViewAura::EnsureCaretInRect(const gfx::Rect& rect) {
1624 // Perform overscroll.
1623 gfx::Rect intersected_rect( 1625 gfx::Rect intersected_rect(
1624 gfx::IntersectRects(rect, window_->GetBoundsInScreen())); 1626 gfx::IntersectRects(rect, window_->GetBoundsInScreen()));
1627 if (!intersected_rect.IsEmpty())
sky 2016/08/19 20:21:39 Generally we only drop {} if the body if the condi
1628 host_->ScrollFocusedEditableNodeIntoRect(
1629 ConvertRectFromScreen(intersected_rect));
1625 1630
1626 if (intersected_rect.IsEmpty()) 1631 #if defined(OS_CHROMEOS)
1632 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
1633 ::switches::kUseNewVKWindowBehavior))
1627 return; 1634 return;
1628 1635
1629 host_->ScrollFocusedEditableNodeIntoRect( 1636 // Only windows in primary display should be moved by virtual keyboard.
1630 ConvertRectFromScreen(intersected_rect)); 1637 display::Screen* screen = display::Screen::GetScreen();
1638 if (screen->GetPrimaryDisplay().id() !=
1639 screen->GetDisplayNearestWindow(window_).id())
1640 return;
1641
1642 // Get restore bounds of window.
1643 aura::Window* top_level_window = window_->GetToplevelWindow();
1644 gfx::Rect* vk_restore_bounds = top_level_window->GetProperty(
1645 aura::client::kVirtualKeyboardRestoreBoundsKey);
1646
1647 if (vk_restore_bounds) {
sky 2016/08/19 20:21:39 I don't understand the logic here. Why does an exi
hariank 2016/08/19 20:32:11 EnsureCaretInRect is only called when the keyboard
sky 2016/08/19 22:29:12 Interesting. Having a method mean totally differen
1648 // Restore window.
1649 top_level_window->SetBounds(*vk_restore_bounds);
1650 top_level_window->ClearProperty(
1651 aura::client::kVirtualKeyboardRestoreBoundsKey);
1652 } else if (rect != screen->GetPrimaryDisplay().bounds()) {
1653 // Calculate vertical window shift.
1654 gfx::Rect window_bounds = top_level_window->GetBoundsInRootWindow();
1655 int vertical_displacement =
1656 std::max(0, window_bounds.bottom() - rect.bottom());
1657 int shift = std::min(vertical_displacement, window_bounds.y());
1658
1659 // Set restore bounds and move window.
1660 if (shift > 0) {
1661 gfx::Point origin(window_bounds.x(), window_bounds.y() - shift);
1662 top_level_window->SetProperty(
1663 aura::client::kVirtualKeyboardRestoreBoundsKey,
1664 new gfx::Rect(window_bounds));
1665 top_level_window->SetBounds(gfx::Rect(origin, window_bounds.size()));
1666 }
1667 }
1668 #endif
1631 } 1669 }
1632 1670
1633 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled( 1671 bool RenderWidgetHostViewAura::IsTextEditCommandEnabled(
1634 ui::TextEditCommand command) const { 1672 ui::TextEditCommand command) const {
1635 return false; 1673 return false;
1636 } 1674 }
1637 1675
1638 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent( 1676 void RenderWidgetHostViewAura::SetTextEditCommandForNextKeyEvent(
1639 ui::TextEditCommand command) {} 1677 ui::TextEditCommand command) {}
1640 1678
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3055 ->GetTextSelection(focused_view) 3093 ->GetTextSelection(focused_view)
3056 ->GetSelectedText(&selected_text)) { 3094 ->GetSelectedText(&selected_text)) {
3057 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. 3095 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
3058 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); 3096 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION);
3059 clipboard_writer.WriteText(selected_text); 3097 clipboard_writer.WriteText(selected_text);
3060 } 3098 }
3061 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 3099 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
3062 } 3100 }
3063 3101
3064 } // namespace content 3102 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698