cef/patch/patches/browser_compositor_mac.patch

50 lines
2.1 KiB
Diff

diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h
index 75651c4..e422ae7 100644
--- content/browser/renderer_host/browser_compositor_view_mac.h
+++ content/browser/renderer_host/browser_compositor_view_mac.h
@@ -59,9 +59,11 @@ class BrowserCompositorMac : public cc::BeginFrameObserver,
// These will not return nullptr until Destroy is called.
DelegatedFrameHost* GetDelegatedFrameHost();
+ ui::Layer* GetRootLayer() { return root_layer_.get(); }
// This may return nullptr, if this has detached itself from its
// ui::Compositor.
+ ui::Compositor* GetCompositor();
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac();
void SwapCompositorFrame(uint32_t output_surface_id,
diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm
index 58d2a2f..69e3bbb 100644
--- content/browser/renderer_host/browser_compositor_view_mac.mm
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -183,6 +183,12 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
g_spare_recyclable_compositor.Get().reset();
}
+ui::Compositor* BrowserCompositorMac::GetCompositor() {
+ if (recyclable_compositor_)
+ return recyclable_compositor_->compositor();
+ return nullptr;
+}
+
ui::AcceleratedWidgetMac* BrowserCompositorMac::GetAcceleratedWidgetMac() {
if (recyclable_compositor_)
return recyclable_compositor_->accelerated_widget_mac();
@@ -400,8 +406,13 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
}
gfx::Size BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP() const {
- NSRect bounds = [client_->BrowserCompositorMacGetNSView() bounds];
- return gfx::Size(bounds.size.width, bounds.size.height);
+ // View will be nil with CEF OSR.
+ NSView* view = client_->BrowserCompositorMacGetNSView();
+ if (view) {
+ NSRect bounds = [view bounds];
+ return gfx::Size(bounds.size.width, bounds.size.height);
+ }
+ return root_layer_->bounds().size();
}
bool BrowserCompositorMac::DelegatedFrameCanCreateResizeLock() const {