| Index: ui/views/cocoa/bridged_native_widget.mm
|
| diff --git a/ui/views/cocoa/bridged_native_widget.mm b/ui/views/cocoa/bridged_native_widget.mm
|
| index 6f5dec0f96864ede56c8a7cf940de5ebf964aa92..701454b06c9456e4000999db29d4cb5c75d279cf 100644
|
| --- a/ui/views/cocoa/bridged_native_widget.mm
|
| +++ b/ui/views/cocoa/bridged_native_widget.mm
|
| @@ -4,6 +4,7 @@
|
|
|
| #import "ui/views/cocoa/bridged_native_widget.h"
|
|
|
| +#import <Quartz/Quartz.h>
|
| #import <objc/runtime.h>
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| @@ -13,6 +14,7 @@
|
| #include "base/mac/mac_util.h"
|
| #import "base/mac/sdk_forward_declarations.h"
|
| #include "base/thread_task_runner_handle.h"
|
| +#import "third_party/google_toolbox_for_mac/src/AppKit/GTMNSBezierPath+CGPath.h"
|
| #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
|
| #import "ui/base/cocoa/constrained_window/constrained_window_animation.h"
|
| #include "ui/base/hit_test.h"
|
| @@ -683,13 +685,7 @@ void BridgedNativeWidget::OnSizeChanged() {
|
| MaybeWaitForFrame(new_size);
|
| }
|
|
|
| - // 10.9 is unable to generate a window shadow from the composited CALayer, so
|
| - // use Quartz.
|
| - // We don't update the window mask during a live resize, instead it is done
|
| - // after the resize is completed in viewDidEndLiveResize: in
|
| - // BridgedContentView.
|
| - if (base::mac::IsOSMavericksOrEarlier() && ![window_ inLiveResize])
|
| - [bridged_view_ updateWindowMask];
|
| + UpdateMaskPath();
|
| }
|
|
|
| void BridgedNativeWidget::OnVisibilityChanged() {
|
| @@ -1164,6 +1160,9 @@ void BridgedNativeWidget::AddCompositorSuperview() {
|
| // are drawn on top of it.
|
| DCHECK_EQ(0u, [[bridged_view_ subviews] count]);
|
| [bridged_view_ addSubview:compositor_superview_];
|
| +
|
| + // Create a mask layer for background_layer if necessary.
|
| + UpdateMaskPath();
|
| }
|
|
|
| void BridgedNativeWidget::UpdateLayerProperties() {
|
| @@ -1244,4 +1243,32 @@ void BridgedNativeWidget::SetDraggable(bool draggable) {
|
| [window_ setMovableByWindowBackground:YES];
|
| }
|
|
|
| +void BridgedNativeWidget::UpdateMaskPath() {
|
| + [bridged_view_ updateWindowMask];
|
| +
|
| + // We only set the mask layer for windows with non-rectangular masks.
|
| + if (![bridged_view_ windowMask]) {
|
| + // Removing a mask after adding one isn't currently supported.
|
| + DCHECK(![[compositor_superview_ layer] mask]);
|
| + return;
|
| + }
|
| +
|
| + CAShapeLayer* mask_layer = base::mac::ObjCCastStrict<CAShapeLayer>(
|
| + [[compositor_superview_ layer] mask]);
|
| + if (mask_layer) {
|
| + [mask_layer setPath:[[bridged_view_ windowMask] gtm_CGPath]];
|
| + return;
|
| + }
|
| +
|
| + // If mask layer does not exist yet, create one and set it as the background
|
| + // layer's mask. Clipping will be done based on the alpha channel of the mask
|
| + // layer.
|
| + mask_layer = [CAShapeLayer layer];
|
| + [mask_layer setPath:[[bridged_view_ windowMask] gtm_CGPath]];
|
| +
|
| + CALayer* background_layer = [compositor_superview_ layer];
|
| + [background_layer setMask:mask_layer];
|
| + [background_layer setMasksToBounds:YES];
|
| +}
|
| +
|
| } // namespace views
|
|
|