| OLD | NEW |
| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // with the current approach. Moving the window above the OSK is one way. | 178 // with the current approach. Moving the window above the OSK is one way. |
| 179 // That for a later patchset. | 179 // That for a later patchset. |
| 180 if (viewport_bottom > bounds_in_screen.height()) | 180 if (viewport_bottom > bounds_in_screen.height()) |
| 181 return; | 181 return; |
| 182 | 182 |
| 183 host_->GetView()->SetInsets(gfx::Insets(0, 0, viewport_bottom, 0)); | 183 host_->GetView()->SetInsets(gfx::Insets(0, 0, viewport_bottom, 0)); |
| 184 | 184 |
| 185 gfx::Point origin(location_in_screen_); | 185 gfx::Point origin(location_in_screen_); |
| 186 screen_position_client->ConvertPointFromScreen(window_, &origin); | 186 screen_position_client->ConvertPointFromScreen(window_, &origin); |
| 187 | 187 |
| 188 // TODO(ekaramad): We should support the case where the focused node is |
| 189 // inside an OOPIF (https://crbug.com/676037). |
| 188 // We want to scroll the node into a rectangle which originates from | 190 // We want to scroll the node into a rectangle which originates from |
| 189 // the touch point and a small offset (10) in either direction. | 191 // the touch point and a small offset (10) in either direction. |
| 190 gfx::Rect node_rect(origin.x(), origin.y(), 10, 10); | 192 gfx::Rect node_rect(origin.x(), origin.y(), 10, 10); |
| 191 host_->ScrollFocusedEditableNodeIntoRect(node_rect); | 193 host_->ScrollFocusedEditableNodeIntoRect(node_rect); |
| 192 } | 194 } |
| 193 } | 195 } |
| 194 | 196 |
| 195 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { | 197 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { |
| 196 // Restore the viewport. | 198 // Restore the viewport. |
| 197 host_->GetView()->SetInsets(gfx::Insets()); | 199 host_->GetView()->SetInsets(gfx::Insets()); |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 786 const gfx::Point& location_dips_screen, | 788 const gfx::Point& location_dips_screen, |
| 787 bool editable) { | 789 bool editable) { |
| 788 #if defined(OS_WIN) | 790 #if defined(OS_WIN) |
| 789 RenderViewHost* rvh = RenderViewHost::From(host_); | 791 RenderViewHost* rvh = RenderViewHost::From(host_); |
| 790 if (rvh && rvh->GetDelegate()) | 792 if (rvh && rvh->GetDelegate()) |
| 791 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); | 793 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); |
| 792 | 794 |
| 793 ui::OnScreenKeyboardDisplayManager* osk_display_manager = | 795 ui::OnScreenKeyboardDisplayManager* osk_display_manager = |
| 794 ui::OnScreenKeyboardDisplayManager::GetInstance(); | 796 ui::OnScreenKeyboardDisplayManager::GetInstance(); |
| 795 DCHECK(osk_display_manager); | 797 DCHECK(osk_display_manager); |
| 796 if (editable && host_ && host_->GetView()) { | 798 if (editable && host_ && host_->GetView() && host_->delegate()) { |
| 797 keyboard_observer_.reset(new WinScreenKeyboardObserver( | 799 keyboard_observer_.reset(new WinScreenKeyboardObserver( |
| 798 host_, location_dips_screen, device_scale_factor_, window_)); | 800 host_, location_dips_screen, device_scale_factor_, window_)); |
| 799 virtual_keyboard_requested_ = | 801 virtual_keyboard_requested_ = |
| 800 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); | 802 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); |
| 801 } else { | 803 } else { |
| 802 virtual_keyboard_requested_ = false; | 804 virtual_keyboard_requested_ = false; |
| 803 osk_display_manager->DismissVirtualKeyboard(); | 805 osk_display_manager->DismissVirtualKeyboard(); |
| 804 } | 806 } |
| 805 #endif | 807 #endif |
| 806 } | 808 } |
| (...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2392 | 2394 |
| 2393 void RenderWidgetHostViewAura::SetPopupChild( | 2395 void RenderWidgetHostViewAura::SetPopupChild( |
| 2394 RenderWidgetHostViewAura* popup_child_host_view) { | 2396 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2395 popup_child_host_view_ = popup_child_host_view; | 2397 popup_child_host_view_ = popup_child_host_view; |
| 2396 event_handler_->SetPopupChild( | 2398 event_handler_->SetPopupChild( |
| 2397 popup_child_host_view, | 2399 popup_child_host_view, |
| 2398 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2400 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2399 } | 2401 } |
| 2400 | 2402 |
| 2401 } // namespace content | 2403 } // namespace content |
| OLD | NEW |