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 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 ::ClipCursor(&window_rect); | 1033 ::ClipCursor(&window_rect); |
1034 } | 1034 } |
1035 | 1035 |
1036 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 1036 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
1037 legacy_render_widget_host_HWND_ = NULL; | 1037 legacy_render_widget_host_HWND_ = NULL; |
1038 legacy_window_destroyed_ = true; | 1038 legacy_window_destroyed_ = true; |
1039 } | 1039 } |
1040 #endif | 1040 #endif |
1041 | 1041 |
1042 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 1042 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
1043 uint32_t output_surface_id, | 1043 uint32_t compositor_frame_sink_id, |
1044 cc::CompositorFrame frame) { | 1044 cc::CompositorFrame frame) { |
1045 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 1045 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
1046 | 1046 |
1047 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 1047 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
1048 if (!frame.delegated_frame_data) | 1048 if (!frame.delegated_frame_data) |
1049 return; | 1049 return; |
1050 | 1050 |
1051 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; | 1051 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; |
1052 if (IsUseZoomForDSFEnabled()) { | 1052 if (IsUseZoomForDSFEnabled()) { |
1053 float viewportToDIPScale = 1.0f / current_device_scale_factor_; | 1053 float viewportToDIPScale = 1.0f / current_device_scale_factor_; |
1054 gfx::PointF start_edge_top = selection.start.edge_top(); | 1054 gfx::PointF start_edge_top = selection.start.edge_top(); |
1055 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); | 1055 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); |
1056 gfx::PointF end_edge_top = selection.end.edge_top(); | 1056 gfx::PointF end_edge_top = selection.end.edge_top(); |
1057 gfx::PointF end_edge_bottom = selection.end.edge_bottom(); | 1057 gfx::PointF end_edge_bottom = selection.end.edge_bottom(); |
1058 | 1058 |
1059 start_edge_top.Scale(viewportToDIPScale); | 1059 start_edge_top.Scale(viewportToDIPScale); |
1060 start_edge_bottom.Scale(viewportToDIPScale); | 1060 start_edge_bottom.Scale(viewportToDIPScale); |
1061 end_edge_top.Scale(viewportToDIPScale); | 1061 end_edge_top.Scale(viewportToDIPScale); |
1062 end_edge_bottom.Scale(viewportToDIPScale); | 1062 end_edge_bottom.Scale(viewportToDIPScale); |
1063 | 1063 |
1064 selection.start.SetEdge(start_edge_top, start_edge_bottom); | 1064 selection.start.SetEdge(start_edge_top, start_edge_bottom); |
1065 selection.end.SetEdge(end_edge_top, end_edge_bottom); | 1065 selection.end.SetEdge(end_edge_top, end_edge_bottom); |
1066 } | 1066 } |
1067 | 1067 |
1068 delegated_frame_host_->SwapDelegatedFrame(output_surface_id, | 1068 delegated_frame_host_->SwapDelegatedFrame(compositor_frame_sink_id, |
1069 std::move(frame)); | 1069 std::move(frame)); |
1070 SelectionUpdated(selection.is_editable, selection.is_empty_text_form_control, | 1070 SelectionUpdated(selection.is_editable, selection.is_empty_text_form_control, |
1071 selection.start, selection.end); | 1071 selection.start, selection.end); |
1072 } | 1072 } |
1073 | 1073 |
1074 void RenderWidgetHostViewAura::ClearCompositorFrame() { | 1074 void RenderWidgetHostViewAura::ClearCompositorFrame() { |
1075 delegated_frame_host_->ClearDelegatedFrame(); | 1075 delegated_frame_host_->ClearDelegatedFrame(); |
1076 } | 1076 } |
1077 | 1077 |
1078 void RenderWidgetHostViewAura::DidStopFlinging() { | 1078 void RenderWidgetHostViewAura::DidStopFlinging() { |
(...skipping 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2902 return std::unique_ptr<ResizeLock>(new CompositorResizeLock( | 2902 return std::unique_ptr<ResizeLock>(new CompositorResizeLock( |
2903 window_->GetHost(), desired_size, defer_compositor_lock, | 2903 window_->GetHost(), desired_size, defer_compositor_lock, |
2904 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); | 2904 base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); |
2905 } | 2905 } |
2906 | 2906 |
2907 void RenderWidgetHostViewAura::DelegatedFrameHostResizeLockWasReleased() { | 2907 void RenderWidgetHostViewAura::DelegatedFrameHostResizeLockWasReleased() { |
2908 host_->WasResized(); | 2908 host_->WasResized(); |
2909 } | 2909 } |
2910 | 2910 |
2911 void RenderWidgetHostViewAura::DelegatedFrameHostSendReclaimCompositorResources( | 2911 void RenderWidgetHostViewAura::DelegatedFrameHostSendReclaimCompositorResources( |
2912 int output_surface_id, | 2912 int compositor_frame_sink_id, |
2913 bool is_swap_ack, | 2913 bool is_swap_ack, |
2914 const cc::ReturnedResourceArray& resources) { | 2914 const cc::ReturnedResourceArray& resources) { |
2915 host_->Send(new ViewMsg_ReclaimCompositorResources( | 2915 host_->Send(new ViewMsg_ReclaimCompositorResources( |
2916 host_->GetRoutingID(), output_surface_id, is_swap_ack, resources)); | 2916 host_->GetRoutingID(), compositor_frame_sink_id, is_swap_ack, resources)); |
2917 } | 2917 } |
2918 | 2918 |
2919 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { | 2919 void RenderWidgetHostViewAura::DelegatedFrameHostOnLostCompositorResources() { |
2920 host_->ScheduleComposite(); | 2920 host_->ScheduleComposite(); |
2921 } | 2921 } |
2922 | 2922 |
2923 void RenderWidgetHostViewAura::SetBeginFrameSource( | 2923 void RenderWidgetHostViewAura::SetBeginFrameSource( |
2924 cc::BeginFrameSource* source) { | 2924 cc::BeginFrameSource* source) { |
2925 bool needs_begin_frames = host_->needs_begin_frames(); | 2925 bool needs_begin_frames = host_->needs_begin_frames(); |
2926 if (begin_frame_source_ && needs_begin_frames) | 2926 if (begin_frame_source_ && needs_begin_frames) |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3040 ->GetTextSelection(focused_view) | 3040 ->GetTextSelection(focused_view) |
3041 ->GetSelectedText(&selected_text)) { | 3041 ->GetSelectedText(&selected_text)) { |
3042 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 3042 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
3043 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 3043 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
3044 clipboard_writer.WriteText(selected_text); | 3044 clipboard_writer.WriteText(selected_text); |
3045 } | 3045 } |
3046 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 3046 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
3047 } | 3047 } |
3048 | 3048 |
3049 } // namespace content | 3049 } // namespace content |
OLD | NEW |