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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 | 878 |
879 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { | 879 void RenderWidgetHostViewAura::UpdateMouseLockRegion() { |
880 RECT window_rect = | 880 RECT window_rect = |
881 display::Screen::GetScreen() | 881 display::Screen::GetScreen() |
882 ->DIPToScreenRectInWindow(window_, window_->GetBoundsInScreen()) | 882 ->DIPToScreenRectInWindow(window_, window_->GetBoundsInScreen()) |
883 .ToRECT(); | 883 .ToRECT(); |
884 ::ClipCursor(&window_rect); | 884 ::ClipCursor(&window_rect); |
885 } | 885 } |
886 | 886 |
887 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 887 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
888 legacy_render_widget_host_HWND_ = NULL; | 888 legacy_render_widget_host_HWND_ = nullptr; |
889 legacy_window_destroyed_ = true; | 889 legacy_window_destroyed_ = true; |
890 } | 890 } |
891 #endif | 891 #endif |
892 | 892 |
893 void RenderWidgetHostViewAura::DidCreateNewRendererCompositorFrameSink() { | 893 void RenderWidgetHostViewAura::DidCreateNewRendererCompositorFrameSink() { |
894 if (delegated_frame_host_) | 894 if (delegated_frame_host_) |
895 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink(); | 895 delegated_frame_host_->DidCreateNewRendererCompositorFrameSink(); |
896 } | 896 } |
897 | 897 |
898 void RenderWidgetHostViewAura::SubmitCompositorFrame( | 898 void RenderWidgetHostViewAura::SubmitCompositorFrame( |
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2326 void RenderWidgetHostViewAura::OnSelectionBoundsChanged( | 2326 void RenderWidgetHostViewAura::OnSelectionBoundsChanged( |
2327 TextInputManager* text_input_manager, | 2327 TextInputManager* text_input_manager, |
2328 RenderWidgetHostViewBase* updated_view) { | 2328 RenderWidgetHostViewBase* updated_view) { |
2329 if (GetInputMethod()) | 2329 if (GetInputMethod()) |
2330 GetInputMethod()->OnCaretBoundsChanged(this); | 2330 GetInputMethod()->OnCaretBoundsChanged(this); |
2331 } | 2331 } |
2332 | 2332 |
2333 void RenderWidgetHostViewAura::OnTextSelectionChanged( | 2333 void RenderWidgetHostViewAura::OnTextSelectionChanged( |
2334 TextInputManager* text_input_manager, | 2334 TextInputManager* text_input_manager, |
2335 RenderWidgetHostViewBase* updated_view) { | 2335 RenderWidgetHostViewBase* updated_view) { |
2336 #if defined(USE_X11) && !defined(OS_CHROMEOS) | |
2337 if (!GetTextInputManager()) | 2336 if (!GetTextInputManager()) |
2338 return; | 2337 return; |
2339 | 2338 |
2340 // We obtain the TextSelection from focused RWH which is obtained from the | 2339 // We obtain the TextSelection from focused RWH which is obtained from the |
2341 // frame tree. BrowserPlugin-based guests' RWH is not part of the frame tree | 2340 // frame tree. BrowserPlugin-based guests' RWH is not part of the frame tree |
2342 // and the focused RWH will be that of the embedder which is incorrect. In | 2341 // and the focused RWH will be that of the embedder which is incorrect. In |
2343 // this case we should use TextSelection for |this| since RWHV for guest | 2342 // this case we should use TextSelection for |this| since RWHV for guest |
2344 // forwards text selection information to its platform view. | 2343 // forwards text selection information to its platform view. |
2345 RenderWidgetHostViewBase* focused_view = | 2344 RenderWidgetHostViewBase* focused_view = |
2346 is_guest_view_hack_ ? this : GetFocusedWidget() | 2345 is_guest_view_hack_ ? this : GetFocusedWidget() |
2347 ? GetFocusedWidget()->GetView() | 2346 ? GetFocusedWidget()->GetView() |
2348 : nullptr; | 2347 : nullptr; |
2349 | 2348 |
2350 if (!focused_view) | 2349 if (!focused_view) |
2351 return; | 2350 return; |
2352 | 2351 |
2352 #if defined(USE_X11) && !defined(OS_CHROMEOS) | |
2353 const TextInputManager::TextSelection* selection = | 2353 const TextInputManager::TextSelection* selection = |
2354 GetTextInputManager()->GetTextSelection(focused_view); | 2354 GetTextInputManager()->GetTextSelection(focused_view); |
2355 if (selection->selected_text().length()) { | 2355 if (selection->selected_text().length()) { |
2356 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 2356 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
2357 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 2357 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
2358 clipboard_writer.WriteText(selection->selected_text()); | 2358 clipboard_writer.WriteText(selection->selected_text()); |
2359 } | 2359 } |
2360 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 2360 |
2361 // #endif defined(USE_X11) && !defined(OS_CHROMEOS) | |
dmazzoni
2017/05/01 16:21:21
Get rid of this commented-out line
| |
2362 #elif defined(OS_WIN) | |
2363 // Some assistive software need to track the location of the caret. | |
2364 if (!GetRenderWidgetHost() || !legacy_render_widget_host_HWND_) | |
2365 return; | |
2366 | |
2367 // Not using |GetCaretBounds| because it includes the whole of the selection, | |
2368 // not just the focus. | |
2369 const TextInputManager::SelectionRegion* region = | |
2370 GetTextInputManager()->GetSelectionRegion(focused_view); | |
2371 if (!region) | |
2372 return; | |
2373 const gfx::Rect caret_rect = ConvertRectToScreen(gfx::Rect( | |
2374 region->focus.edge_top_rounded().x(), | |
2375 region->focus.edge_top_rounded().y(), 1, region->focus.GetHeight())); | |
2376 legacy_render_widget_host_HWND_->MoveCaretTo(caret_rect); | |
2377 #endif // defined(OS_WIN) | |
2361 } | 2378 } |
2362 | 2379 |
2363 void RenderWidgetHostViewAura::SetPopupChild( | 2380 void RenderWidgetHostViewAura::SetPopupChild( |
2364 RenderWidgetHostViewAura* popup_child_host_view) { | 2381 RenderWidgetHostViewAura* popup_child_host_view) { |
2365 popup_child_host_view_ = popup_child_host_view; | 2382 popup_child_host_view_ = popup_child_host_view; |
2366 event_handler_->SetPopupChild( | 2383 event_handler_->SetPopupChild( |
2367 popup_child_host_view, | 2384 popup_child_host_view, |
2368 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2385 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
2369 } | 2386 } |
2370 | 2387 |
2371 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { | 2388 void RenderWidgetHostViewAura::UpdateNeedsBeginFramesInternal() { |
2372 if (!delegated_frame_host_) | 2389 if (!delegated_frame_host_) |
2373 return; | 2390 return; |
2374 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || | 2391 delegated_frame_host_->SetNeedsBeginFrames(needs_begin_frames_ || |
2375 needs_flush_input_); | 2392 needs_flush_input_); |
2376 } | 2393 } |
2377 | 2394 |
2378 } // namespace content | 2395 } // namespace content |
OLD | NEW |