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 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 } | 898 } |
899 | 899 |
900 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { | 900 void RenderWidgetHostViewAura::OnLegacyWindowDestroyed() { |
901 legacy_render_widget_host_HWND_ = NULL; | 901 legacy_render_widget_host_HWND_ = NULL; |
902 legacy_window_destroyed_ = true; | 902 legacy_window_destroyed_ = true; |
903 } | 903 } |
904 #endif | 904 #endif |
905 | 905 |
906 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 906 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
907 uint32_t compositor_frame_sink_id, | 907 uint32_t compositor_frame_sink_id, |
| 908 const cc::LocalSurfaceId& local_surface_id, |
908 cc::CompositorFrame frame) { | 909 cc::CompositorFrame frame) { |
909 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 910 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
910 | 911 |
911 // Override the background color to the current compositor background. | 912 // Override the background color to the current compositor background. |
912 // This allows us to, when navigating to a new page, transfer this color to | 913 // This allows us to, when navigating to a new page, transfer this color to |
913 // that page. This allows us to pass this background color to new views on | 914 // that page. This allows us to pass this background color to new views on |
914 // navigation. | 915 // navigation. |
915 SetBackgroundColor(frame.metadata.root_background_color); | 916 SetBackgroundColor(frame.metadata.root_background_color); |
916 | 917 |
917 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 918 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
918 if (frame.render_pass_list.empty()) | |
919 return; | |
920 | 919 |
921 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; | 920 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; |
922 if (IsUseZoomForDSFEnabled()) { | 921 if (IsUseZoomForDSFEnabled()) { |
923 float viewportToDIPScale = 1.0f / current_device_scale_factor_; | 922 float viewportToDIPScale = 1.0f / current_device_scale_factor_; |
924 gfx::PointF start_edge_top = selection.start.edge_top(); | 923 gfx::PointF start_edge_top = selection.start.edge_top(); |
925 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); | 924 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); |
926 gfx::PointF end_edge_top = selection.end.edge_top(); | 925 gfx::PointF end_edge_top = selection.end.edge_top(); |
927 gfx::PointF end_edge_bottom = selection.end.edge_bottom(); | 926 gfx::PointF end_edge_bottom = selection.end.edge_bottom(); |
928 | 927 |
929 start_edge_top.Scale(viewportToDIPScale); | 928 start_edge_top.Scale(viewportToDIPScale); |
930 start_edge_bottom.Scale(viewportToDIPScale); | 929 start_edge_bottom.Scale(viewportToDIPScale); |
931 end_edge_top.Scale(viewportToDIPScale); | 930 end_edge_top.Scale(viewportToDIPScale); |
932 end_edge_bottom.Scale(viewportToDIPScale); | 931 end_edge_bottom.Scale(viewportToDIPScale); |
933 | 932 |
934 selection.start.SetEdge(start_edge_top, start_edge_bottom); | 933 selection.start.SetEdge(start_edge_top, start_edge_bottom); |
935 selection.end.SetEdge(end_edge_top, end_edge_bottom); | 934 selection.end.SetEdge(end_edge_top, end_edge_bottom); |
936 } | 935 } |
937 | 936 |
938 cc::BeginFrameAck ack(frame.metadata.begin_frame_ack); | 937 cc::BeginFrameAck ack(frame.metadata.begin_frame_ack); |
939 | 938 |
940 if (delegated_frame_host_) { | 939 if (delegated_frame_host_) { |
941 delegated_frame_host_->SwapDelegatedFrame(compositor_frame_sink_id, | 940 delegated_frame_host_->SwapDelegatedFrame( |
942 std::move(frame)); | 941 compositor_frame_sink_id, local_surface_id, std::move(frame)); |
943 } | 942 } |
944 selection_controller_->OnSelectionBoundsChanged(selection.start, | 943 selection_controller_->OnSelectionBoundsChanged(selection.start, |
945 selection.end); | 944 selection.end); |
946 | 945 |
947 if (begin_frame_source_) | 946 if (begin_frame_source_) |
948 begin_frame_source_->DidFinishFrame(this, ack); | 947 begin_frame_source_->DidFinishFrame(this, ack); |
949 } | 948 } |
950 | 949 |
951 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap( | 950 void RenderWidgetHostViewAura::OnBeginFrameDidNotSwap( |
952 const cc::BeginFrameAck& ack) { | 951 const cc::BeginFrameAck& ack) { |
(...skipping 1424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2377 | 2376 |
2378 void RenderWidgetHostViewAura::SetPopupChild( | 2377 void RenderWidgetHostViewAura::SetPopupChild( |
2379 RenderWidgetHostViewAura* popup_child_host_view) { | 2378 RenderWidgetHostViewAura* popup_child_host_view) { |
2380 popup_child_host_view_ = popup_child_host_view; | 2379 popup_child_host_view_ = popup_child_host_view; |
2381 event_handler_->SetPopupChild( | 2380 event_handler_->SetPopupChild( |
2382 popup_child_host_view, | 2381 popup_child_host_view, |
2383 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2382 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
2384 } | 2383 } |
2385 | 2384 |
2386 } // namespace content | 2385 } // namespace content |
OLD | NEW |