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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 | 749 |
750 bool RenderWidgetHostViewAura::IsShowing() { | 750 bool RenderWidgetHostViewAura::IsShowing() { |
751 return window_->IsVisible(); | 751 return window_->IsVisible(); |
752 } | 752 } |
753 | 753 |
754 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { | 754 gfx::Rect RenderWidgetHostViewAura::GetViewBounds() const { |
755 return window_->GetBoundsInScreen(); | 755 return window_->GetBoundsInScreen(); |
756 } | 756 } |
757 | 757 |
758 void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { | 758 void RenderWidgetHostViewAura::SetBackgroundColor(SkColor color) { |
| 759 if (color == background_color()) |
| 760 return; |
759 RenderWidgetHostViewBase::SetBackgroundColor(color); | 761 RenderWidgetHostViewBase::SetBackgroundColor(color); |
760 bool opaque = GetBackgroundOpaque(); | 762 bool opaque = GetBackgroundOpaque(); |
761 host_->SetBackgroundOpaque(opaque); | 763 host_->SetBackgroundOpaque(opaque); |
762 window_->layer()->SetFillsBoundsOpaquely(opaque); | 764 window_->layer()->SetFillsBoundsOpaquely(opaque); |
763 window_->layer()->SetColor(color); | 765 window_->layer()->SetColor(color); |
764 } | 766 } |
765 | 767 |
766 bool RenderWidgetHostViewAura::IsMouseLocked() { | 768 bool RenderWidgetHostViewAura::IsMouseLocked() { |
767 return event_handler_->mouse_locked(); | 769 return event_handler_->mouse_locked(); |
768 } | 770 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 legacy_render_widget_host_HWND_ = NULL; | 901 legacy_render_widget_host_HWND_ = NULL; |
900 legacy_window_destroyed_ = true; | 902 legacy_window_destroyed_ = true; |
901 } | 903 } |
902 #endif | 904 #endif |
903 | 905 |
904 void RenderWidgetHostViewAura::OnSwapCompositorFrame( | 906 void RenderWidgetHostViewAura::OnSwapCompositorFrame( |
905 uint32_t compositor_frame_sink_id, | 907 uint32_t compositor_frame_sink_id, |
906 cc::CompositorFrame frame) { | 908 cc::CompositorFrame frame) { |
907 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); | 909 TRACE_EVENT0("content", "RenderWidgetHostViewAura::OnSwapCompositorFrame"); |
908 | 910 |
| 911 // 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 // that page. This allows us to pass this background color to new views on |
| 914 // navigation. |
| 915 SetBackgroundColor(frame.metadata.root_background_color); |
| 916 |
909 last_scroll_offset_ = frame.metadata.root_scroll_offset; | 917 last_scroll_offset_ = frame.metadata.root_scroll_offset; |
910 if (frame.render_pass_list.empty()) | 918 if (frame.render_pass_list.empty()) |
911 return; | 919 return; |
912 | 920 |
913 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; | 921 cc::Selection<gfx::SelectionBound> selection = frame.metadata.selection; |
914 if (IsUseZoomForDSFEnabled()) { | 922 if (IsUseZoomForDSFEnabled()) { |
915 float viewportToDIPScale = 1.0f / current_device_scale_factor_; | 923 float viewportToDIPScale = 1.0f / current_device_scale_factor_; |
916 gfx::PointF start_edge_top = selection.start.edge_top(); | 924 gfx::PointF start_edge_top = selection.start.edge_top(); |
917 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); | 925 gfx::PointF start_edge_bottom = selection.start.edge_bottom(); |
918 gfx::PointF end_edge_top = selection.end.edge_top(); | 926 gfx::PointF end_edge_top = selection.end.edge_top(); |
(...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 | 2388 |
2381 void RenderWidgetHostViewAura::SetPopupChild( | 2389 void RenderWidgetHostViewAura::SetPopupChild( |
2382 RenderWidgetHostViewAura* popup_child_host_view) { | 2390 RenderWidgetHostViewAura* popup_child_host_view) { |
2383 popup_child_host_view_ = popup_child_host_view; | 2391 popup_child_host_view_ = popup_child_host_view; |
2384 event_handler_->SetPopupChild( | 2392 event_handler_->SetPopupChild( |
2385 popup_child_host_view, | 2393 popup_child_host_view, |
2386 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); | 2394 popup_child_host_view ? popup_child_host_view->event_handler() : nullptr); |
2387 } | 2395 } |
2388 | 2396 |
2389 } // namespace content | 2397 } // namespace content |
OLD | NEW |