| 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 return; | 178 return; |
| 179 | 179 |
| 180 host_->GetView()->SetInsets(gfx::Insets(0, 0, viewport_bottom, 0)); | 180 host_->GetView()->SetInsets(gfx::Insets(0, 0, viewport_bottom, 0)); |
| 181 | 181 |
| 182 gfx::Point origin(location_in_screen_); | 182 gfx::Point origin(location_in_screen_); |
| 183 screen_position_client->ConvertPointFromScreen(window_, &origin); | 183 screen_position_client->ConvertPointFromScreen(window_, &origin); |
| 184 | 184 |
| 185 // We want to scroll the node into a rectangle which originates from | 185 // We want to scroll the node into a rectangle which originates from |
| 186 // the touch point and a small offset (10) in either direction. | 186 // the touch point and a small offset (10) in either direction. |
| 187 gfx::Rect node_rect(origin.x(), origin.y(), 10, 10); | 187 gfx::Rect node_rect(origin.x(), origin.y(), 10, 10); |
| 188 host_->ScrollFocusedEditableNodeIntoRect(node_rect); | 188 RenderWidgetHostImpl* host = host_; |
| 189 if (host->delegate()) { |
| 190 host = host->delegate()->GetFocusedRenderWidgetHost(host); |
| 191 } |
| 192 // TODO(ekaramad): This will not scroll the <iframe> up. Also not |
| 193 // implemented for OOPIFs (https://crbug.com/676037). |
| 194 host->ScrollFocusedEditableNodeIntoRect(node_rect); |
| 189 } | 195 } |
| 190 } | 196 } |
| 191 | 197 |
| 192 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { | 198 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { |
| 193 // Restore the viewport. | 199 // Restore the viewport. |
| 194 host_->GetView()->SetInsets(gfx::Insets()); | 200 host_->GetView()->SetInsets(gfx::Insets()); |
| 195 } | 201 } |
| 196 | 202 |
| 197 private: | 203 private: |
| 198 RenderWidgetHostImpl* host_; | 204 RenderWidgetHostImpl* host_; |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 const gfx::Point& location_dips_screen, | 779 const gfx::Point& location_dips_screen, |
| 774 bool editable) { | 780 bool editable) { |
| 775 #if defined(OS_WIN) | 781 #if defined(OS_WIN) |
| 776 RenderViewHost* rvh = RenderViewHost::From(host_); | 782 RenderViewHost* rvh = RenderViewHost::From(host_); |
| 777 if (rvh && rvh->GetDelegate()) | 783 if (rvh && rvh->GetDelegate()) |
| 778 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); | 784 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); |
| 779 | 785 |
| 780 ui::OnScreenKeyboardDisplayManager* osk_display_manager = | 786 ui::OnScreenKeyboardDisplayManager* osk_display_manager = |
| 781 ui::OnScreenKeyboardDisplayManager::GetInstance(); | 787 ui::OnScreenKeyboardDisplayManager::GetInstance(); |
| 782 DCHECK(osk_display_manager); | 788 DCHECK(osk_display_manager); |
| 783 if (editable && host_ && host_->GetView()) { | 789 if (editable && host_ && host_->GetView() && host_->delegate()) { |
| 784 keyboard_observer_.reset(new WinScreenKeyboardObserver( | 790 keyboard_observer_.reset(new WinScreenKeyboardObserver( |
| 785 host_, location_dips_screen, device_scale_factor_, window_)); | 791 host_, location_dips_screen, device_scale_factor_, window_)); |
| 786 virtual_keyboard_requested_ = | 792 virtual_keyboard_requested_ = |
| 787 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); | 793 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); |
| 788 } else { | 794 } else { |
| 789 virtual_keyboard_requested_ = false; | 795 virtual_keyboard_requested_ = false; |
| 790 osk_display_manager->DismissVirtualKeyboard(); | 796 osk_display_manager->DismissVirtualKeyboard(); |
| 791 } | 797 } |
| 792 #endif | 798 #endif |
| 793 } | 799 } |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 | 2386 |
| 2381 void RenderWidgetHostViewAura::SetPopupChild( | 2387 void RenderWidgetHostViewAura::SetPopupChild( |
| 2382 RenderWidgetHostViewAura* popup_child_host_view) { | 2388 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2383 popup_child_host_view_ = popup_child_host_view; | 2389 popup_child_host_view_ = popup_child_host_view; |
| 2384 event_handler_->SetPopupChild( | 2390 event_handler_->SetPopupChild( |
| 2385 popup_child_host_view, | 2391 popup_child_host_view, |
| 2386 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2392 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2387 } | 2393 } |
| 2388 | 2394 |
| 2389 } // namespace content | 2395 } // namespace content |
| OLD | NEW |