cef/patch/patches/browser_compositor_mac.patch
2017-10-26 15:58:05 -04:00

54 lines
2.3 KiB
Diff

diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h
index 8bc4ebd0d771..42949486cf98 100644
--- content/browser/renderer_host/browser_compositor_view_mac.h
+++ content/browser/renderer_host/browser_compositor_view_mac.h
@@ -52,6 +52,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).
@@ -59,6 +60,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 content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm
index 04ca86589a13..796a874d0e13 100644
--- content/browser/renderer_host/browser_compositor_view_mac.mm
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -209,6 +209,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
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();
@@ -439,8 +445,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor(
}
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 {