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-02-15 01:12:09 +01:00
|
|
|
index 81376ab57c4b..364305777492 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-02-15 01:12:09 +01:00
|
|
|
@@ -51,11 +51,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-02-15 01:12:09 +01:00
|
|
|
index 8e98fb37c1d4..8dc887eac61b 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-02-15 01:12:09 +01:00
|
|
|
@@ -214,6 +214,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()
|
|
|
|
@@ -473,10 +479,16 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
|
|
|
|
NSView* ns_view =
|
|
|
|
accelerated_widget_mac_ns_view_->AcceleratedWidgetGetNSView();
|
|
|
|
if (bounds_in_dip) {
|
|
|
|
- NSSize dip_ns_size = [ns_view bounds].size;
|
|
|
|
- *bounds_in_dip = gfx::Size(dip_ns_size.width, dip_ns_size.height);
|
|
|
|
+ if (ns_view) {
|
|
|
|
+ NSSize dip_ns_size = [ns_view bounds].size;
|
|
|
|
+ *bounds_in_dip = gfx::Size(dip_ns_size.width, dip_ns_size.height);
|
|
|
|
+ } else {
|
|
|
|
+ // |ns_view| will be nullptr for CEF.
|
|
|
|
+ *bounds_in_dip = root_layer_->bounds().size();
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
if (scale_factor || color_space) {
|
|
|
|
+ // TODO(cef): Return values from CEF callbacks here.
|
|
|
|
display::Display display =
|
|
|
|
display::Screen::GetScreen()->GetDisplayNearestView(ns_view);
|
|
|
|
if (scale_factor)
|
|
|
|
diff --git ui/accelerated_widget_mac/accelerated_widget_mac.mm ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
|
|
|
index 7ff59beee63c..48efe5ac93fa 100644
|
|
|
|
--- ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
|
|
|
+++ ui/accelerated_widget_mac/accelerated_widget_mac.mm
|
|
|
|
@@ -66,6 +66,10 @@ - (void)setContentsChanged;
|
|
|
|
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]];
|