| 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. |
| 193 host->ScrollFocusedEditableNodeIntoRect(node_rect); |
| 189 } | 194 } |
| 190 } | 195 } |
| 191 | 196 |
| 192 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { | 197 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { |
| 193 // Restore the viewport. | 198 // Restore the viewport. |
| 194 host_->GetView()->SetInsets(gfx::Insets()); | 199 host_->GetView()->SetInsets(gfx::Insets()); |
| 195 } | 200 } |
| 196 | 201 |
| 197 private: | 202 private: |
| 198 RenderWidgetHostImpl* host_; | 203 RenderWidgetHostImpl* host_; |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 const gfx::Point& location_dips_screen, | 778 const gfx::Point& location_dips_screen, |
| 774 bool editable) { | 779 bool editable) { |
| 775 #if defined(OS_WIN) | 780 #if defined(OS_WIN) |
| 776 RenderViewHost* rvh = RenderViewHost::From(host_); | 781 RenderViewHost* rvh = RenderViewHost::From(host_); |
| 777 if (rvh && rvh->GetDelegate()) | 782 if (rvh && rvh->GetDelegate()) |
| 778 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); | 783 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); |
| 779 | 784 |
| 780 ui::OnScreenKeyboardDisplayManager* osk_display_manager = | 785 ui::OnScreenKeyboardDisplayManager* osk_display_manager = |
| 781 ui::OnScreenKeyboardDisplayManager::GetInstance(); | 786 ui::OnScreenKeyboardDisplayManager::GetInstance(); |
| 782 DCHECK(osk_display_manager); | 787 DCHECK(osk_display_manager); |
| 783 if (editable && host_ && host_->GetView()) { | 788 if (editable && host_ && host_->GetView() && host_->delegate()) { |
| 784 keyboard_observer_.reset(new WinScreenKeyboardObserver( | 789 keyboard_observer_.reset(new WinScreenKeyboardObserver( |
| 785 host_, location_dips_screen, device_scale_factor_, window_)); | 790 host_, location_dips_screen, device_scale_factor_, window_)); |
| 786 virtual_keyboard_requested_ = | 791 virtual_keyboard_requested_ = |
| 787 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); | 792 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); |
| 788 } else { | 793 } else { |
| 789 virtual_keyboard_requested_ = false; | 794 virtual_keyboard_requested_ = false; |
| 790 osk_display_manager->DismissVirtualKeyboard(); | 795 osk_display_manager->DismissVirtualKeyboard(); |
| 791 } | 796 } |
| 792 #endif | 797 #endif |
| 793 } | 798 } |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 | 2385 |
| 2381 void RenderWidgetHostViewAura::SetPopupChild( | 2386 void RenderWidgetHostViewAura::SetPopupChild( |
| 2382 RenderWidgetHostViewAura* popup_child_host_view) { | 2387 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2383 popup_child_host_view_ = popup_child_host_view; | 2388 popup_child_host_view_ = popup_child_host_view; |
| 2384 event_handler_->SetPopupChild( | 2389 event_handler_->SetPopupChild( |
| 2385 popup_child_host_view, | 2390 popup_child_host_view, |
| 2386 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2391 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2387 } | 2392 } |
| 2388 | 2393 |
| 2389 } // namespace content | 2394 } // namespace content |
| OLD | NEW |