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