2016-07-06 21:34:09 +02:00
|
|
|
diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h
|
2018-03-20 21:15:08 +01:00
|
|
|
index dad7599ed999..c8daf2ba58c8 100644
|
2016-07-06 21:34:09 +02:00
|
|
|
--- content/browser/renderer_host/browser_compositor_view_mac.h
|
|
|
|
+++ content/browser/renderer_host/browser_compositor_view_mac.h
|
2018-03-20 21:15:08 +01:00
|
|
|
@@ -52,11 +52,13 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient {
|
2016-07-21 23:21:32 +02:00
|
|
|
|
|
|
|
// These will not return nullptr until Destroy is called.
|
|
|
|
DelegatedFrameHost* GetDelegatedFrameHost();
|
|
|
|
+ ui::Layer* GetRootLayer() { return root_layer_.get(); }
|
2016-07-06 21:34:09 +02:00
|
|
|
|
2017-09-06 23:40:58 +02:00
|
|
|
// Ensure that the currect compositor frame be cleared (even if it is
|
|
|
|
// potentially visible).
|
2018-02-15 01:12:09 +01:00
|
|
|
void ClearCompositorFrame();
|
2017-09-06 23:40:58 +02:00
|
|
|
|
2016-07-06 21:34:09 +02:00
|
|
|
+ ui::Compositor* GetCompositor();
|
2018-02-15 01:12:09 +01:00
|
|
|
gfx::AcceleratedWidget GetAcceleratedWidget();
|
2017-04-20 21:28:17 +02:00
|
|
|
void DidCreateNewRendererCompositorFrameSink(
|
2018-02-15 01:12:09 +01:00
|
|
|
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink);
|
2016-07-06 21:34:09 +02:00
|
|
|
diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm
|
2018-03-20 21:15:08 +01:00
|
|
|
index 07d42e680951..46699b959d2d 100644
|
2016-07-06 21:34:09 +02:00
|
|
|
--- content/browser/renderer_host/browser_compositor_view_mac.mm
|
|
|
|
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
|
2018-03-20 21:15:08 +01:00
|
|
|
@@ -215,6 +215,12 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
|
2016-08-31 13:25:56 +02:00
|
|
|
g_spare_recyclable_compositors.Get().clear();
|
2016-07-06 21:34:09 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ui::Compositor* BrowserCompositorMac::GetCompositor() {
|
|
|
|
+ if (recyclable_compositor_)
|
|
|
|
+ return recyclable_compositor_->compositor();
|
|
|
|
+ return nullptr;
|
|
|
|
+}
|
|
|
|
+
|
2018-02-15 01:12:09 +01:00
|
|
|
gfx::AcceleratedWidget BrowserCompositorMac::GetAcceleratedWidget() {
|
|
|
|
if (recyclable_compositor_) {
|
|
|
|
return recyclable_compositor_->accelerated_widget_mac()
|
2018-03-20 21:15:08 +01:00
|
|
|
@@ -268,7 +274,9 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
|
2018-02-15 01:12:09 +01:00
|
|
|
accelerated_widget_mac_ns_view_->AcceleratedWidgetGetNSView();
|
2018-03-20 21:15:08 +01:00
|
|
|
display::Display new_display =
|
|
|
|
display::Screen::GetScreen()->GetDisplayNearestView(ns_view);
|
|
|
|
- gfx::Size new_size_dip([ns_view bounds].size);
|
|
|
|
+ // TODO(cef): Get display info from callbacks. |ns_view| will be nullptr.
|
|
|
|
+ gfx::Size new_size_dip(ns_view ? gfx::Size([ns_view bounds].size) :
|
|
|
|
+ root_layer_->bounds().size());
|
|
|
|
if (new_size_dip == dfh_size_dip_ && new_display == dfh_display_)
|
|
|
|
return false;
|
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
diff --git ui/accelerated_widget_mac/accelerated_widget_mac.mm ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
2018-03-20 21:15:08 +01:00
|
|
|
index 8306398431d9..5ab4fef9ac0f 100644
|
2018-02-15 01:12:09 +01:00
|
|
|
--- ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
|
|
|
+++ ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
2018-03-20 21:15:08 +01:00
|
|
|
@@ -71,6 +71,10 @@ - (void)setContentsChanged;
|
2018-02-15 01:12:09 +01:00
|
|
|
DCHECK(view && !view_);
|
|
|
|
view_ = view;
|
2016-07-21 23:21:32 +02:00
|
|
|
|
2018-02-15 01:12:09 +01:00
|
|
|
+ // Will be nullptr for CEF.
|
|
|
|
+ if (!view_->AcceleratedWidgetGetNSView())
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
CALayer* background_layer = [view_->AcceleratedWidgetGetNSView() layer];
|
|
|
|
DCHECK(background_layer);
|
|
|
|
[flipped_layer_ setBounds:[background_layer bounds]];
|