Chromium Code Reviews| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 // with the current approach. Moving the window above the OSK is one way. | 175 // with the current approach. Moving the window above the OSK is one way. |
| 176 // That for a later patchset. | 176 // That for a later patchset. |
| 177 if (viewport_bottom > bounds_in_screen.height()) | 177 if (viewport_bottom > bounds_in_screen.height()) |
| 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 // TODO(ekaramad): We should support the case where the focused node is | |
| 186 // inside an OOPIF (https://crbug.com/676037). | |
|
ncarter (slow)
2016/12/21 18:46:09
As we discussed over chat, we may actually never n
EhsanK
2016/12/21 18:49:58
Yes agreed. I believe we might need to fix the scr
| |
| 185 // We want to scroll the node into a rectangle which originates from | 187 // We want to scroll the node into a rectangle which originates from |
| 186 // the touch point and a small offset (10) in either direction. | 188 // the touch point and a small offset (10) in either direction. |
| 187 gfx::Rect node_rect(origin.x(), origin.y(), 10, 10); | 189 gfx::Rect node_rect(origin.x(), origin.y(), 10, 10); |
| 188 host_->ScrollFocusedEditableNodeIntoRect(node_rect); | 190 host_->ScrollFocusedEditableNodeIntoRect(node_rect); |
|
ncarter (slow)
2016/12/21 18:46:09
This change makes sense.
EhsanK
2016/12/21 18:49:58
Acknowledged.
| |
| 189 } | 191 } |
| 190 } | 192 } |
| 191 | 193 |
| 192 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { | 194 void OnKeyboardHidden(const gfx::Rect& keyboard_rect_pixels) override { |
| 193 // Restore the viewport. | 195 // Restore the viewport. |
| 194 host_->GetView()->SetInsets(gfx::Insets()); | 196 host_->GetView()->SetInsets(gfx::Insets()); |
| 195 } | 197 } |
| 196 | 198 |
| 197 private: | 199 private: |
| 198 RenderWidgetHostImpl* host_; | 200 RenderWidgetHostImpl* host_; |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 773 const gfx::Point& location_dips_screen, | 775 const gfx::Point& location_dips_screen, |
| 774 bool editable) { | 776 bool editable) { |
| 775 #if defined(OS_WIN) | 777 #if defined(OS_WIN) |
| 776 RenderViewHost* rvh = RenderViewHost::From(host_); | 778 RenderViewHost* rvh = RenderViewHost::From(host_); |
| 777 if (rvh && rvh->GetDelegate()) | 779 if (rvh && rvh->GetDelegate()) |
| 778 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); | 780 rvh->GetDelegate()->SetIsVirtualKeyboardRequested(editable); |
| 779 | 781 |
| 780 ui::OnScreenKeyboardDisplayManager* osk_display_manager = | 782 ui::OnScreenKeyboardDisplayManager* osk_display_manager = |
| 781 ui::OnScreenKeyboardDisplayManager::GetInstance(); | 783 ui::OnScreenKeyboardDisplayManager::GetInstance(); |
| 782 DCHECK(osk_display_manager); | 784 DCHECK(osk_display_manager); |
| 783 if (editable && host_ && host_->GetView()) { | 785 if (editable && host_ && host_->GetView() && host_->delegate()) { |
| 784 keyboard_observer_.reset(new WinScreenKeyboardObserver( | 786 keyboard_observer_.reset(new WinScreenKeyboardObserver( |
| 785 host_, location_dips_screen, device_scale_factor_, window_)); | 787 host_, location_dips_screen, device_scale_factor_, window_)); |
| 786 virtual_keyboard_requested_ = | 788 virtual_keyboard_requested_ = |
| 787 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); | 789 osk_display_manager->DisplayVirtualKeyboard(keyboard_observer_.get()); |
| 788 } else { | 790 } else { |
| 789 virtual_keyboard_requested_ = false; | 791 virtual_keyboard_requested_ = false; |
| 790 osk_display_manager->DismissVirtualKeyboard(); | 792 osk_display_manager->DismissVirtualKeyboard(); |
| 791 } | 793 } |
| 792 #endif | 794 #endif |
| 793 } | 795 } |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2380 | 2382 |
| 2381 void RenderWidgetHostViewAura::SetPopupChild( | 2383 void RenderWidgetHostViewAura::SetPopupChild( |
| 2382 RenderWidgetHostViewAura* popup_child_host_view) { | 2384 RenderWidgetHostViewAura* popup_child_host_view) { |
| 2383 popup_child_host_view_ = popup_child_host_view; | 2385 popup_child_host_view_ = popup_child_host_view; |
| 2384 event_handler_->SetPopupChild( | 2386 event_handler_->SetPopupChild( |
| 2385 popup_child_host_view, | 2387 popup_child_host_view, |
| 2386 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2388 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
| 2387 } | 2389 } |
| 2388 | 2390 |
| 2389 } // namespace content | 2391 } // namespace content |
| OLD | NEW |