diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-24 12:15:48 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-08-28 13:30:04 +0000 |
commit | b014812705fc80bff0a5c120dfcef88f349816dc (patch) | |
tree | 25a2e2d9fa285f1add86aa333389a839f81a39ae /chromium/ui/views/controls/native/native_view_host_mac.mm | |
parent | 9f4560b1027ae06fdb497023cdcaf91b8511fa74 (diff) | |
download | qtwebengine-chromium-b014812705fc80bff0a5c120dfcef88f349816dc.tar.gz |
BASELINE: Update Chromium to 68.0.3440.125
Change-Id: I23f19369e01f688e496f5bf179abb521ad73874f
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/views/controls/native/native_view_host_mac.mm')
-rw-r--r-- | chromium/ui/views/controls/native/native_view_host_mac.mm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chromium/ui/views/controls/native/native_view_host_mac.mm b/chromium/ui/views/controls/native/native_view_host_mac.mm index e6f31f85f3d..0ca2c4a6a41 100644 --- a/chromium/ui/views/controls/native/native_view_host_mac.mm +++ b/chromium/ui/views/controls/native/native_view_host_mac.mm @@ -12,6 +12,13 @@ #include "ui/views/widget/native_widget_mac.h" #include "ui/views/widget/widget.h" +// NSViews that can be drawn as a ui::Layer directly will implement this +// interface. Calling cr_setParentLayer will embed the ui::Layer of the NSView +// under |parentUiLayer|. +@interface NSView (UICompositor) +- (void)cr_setParentUiLayer:(ui::Layer*)parentUiLayer; +@end + namespace views { namespace { @@ -32,6 +39,8 @@ void EnsureNativeViewHasNoChildWidgets(NSView* native_view) { } // namespace NativeViewHostMac::NativeViewHostMac(NativeViewHost* host) : host_(host) { + // Ensure that |host_| have its own ui::Layer and that it draw nothing. + host_->SetPaintToLayer(ui::LAYER_NOT_DRAWN); } NativeViewHostMac::~NativeViewHostMac() { @@ -45,6 +54,9 @@ void NativeViewHostMac::AttachNativeView() { DCHECK(!native_view_); native_view_.reset([host_->native_view() retain]); + if ([native_view_ respondsToSelector:@selector(cr_setParentUiLayer:)]) + [native_view_ cr_setParentUiLayer:host_->layer()]; + EnsureNativeViewHasNoChildWidgets(native_view_); BridgedNativeWidget* bridge = NativeWidgetMac::GetBridgeForNativeWindow( host_->GetWidget()->GetNativeWindow()); @@ -71,6 +83,9 @@ void NativeViewHostMac::NativeViewDetaching(bool destroyed) { [host_->native_view() setHidden:YES]; [host_->native_view() removeFromSuperview]; + if ([native_view_ respondsToSelector:@selector(cr_setParentUiLayer:)]) + [native_view_ cr_setParentUiLayer:nullptr]; + EnsureNativeViewHasNoChildWidgets(host_->native_view()); BridgedNativeWidget* bridge = NativeWidgetMac::GetBridgeForNativeWindow( host_->GetWidget()->GetNativeWindow()); |