libchromiumcontent/patches/009-browser_compositor_mac....

54 строки
2.4 KiB
Diff

diff --git a/content/browser/renderer_host/browser_compositor_view_mac.h b/content/browser/renderer_host/browser_compositor_view_mac.h
index 4355a8cdacb4..57961ef39f8d 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.h
+++ b/content/browser/renderer_host/browser_compositor_view_mac.h
@@ -50,6 +50,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient {
// These will not return nullptr until Destroy is called.
DelegatedFrameHost* GetDelegatedFrameHost();
+ ui::Layer* GetRootLayer() { return root_layer_.get(); }
// Ensure that the currect compositor frame be cleared (even if it is
// potentially visible).
@@ -57,6 +58,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient {
// This may return nullptr, if this has detached itself from its
// ui::Compositor.
+ ui::Compositor* GetCompositor();
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac();
void DidCreateNewRendererCompositorFrameSink(
diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/content/browser/renderer_host/browser_compositor_view_mac.mm
index fba983b37..8cf962916 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -202,6 +202,12 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {}
g_spare_recyclable_compositors.Get().clear();
}
+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();
@@ -421,8 +427,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 {