OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
6 | 6 |
7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 layer()->SetFillsBoundsOpaquely(!translucent); | 843 layer()->SetFillsBoundsOpaquely(!translucent); |
844 | 844 |
845 // Use the regular window background for window modal sheets. The layer() will | 845 // Use the regular window background for window modal sheets. The layer() will |
846 // still paint over most of it, but the native -[NSApp beginSheet:] animation | 846 // still paint over most of it, but the native -[NSApp beginSheet:] animation |
847 // blocks the UI thread, so there's no way to invalidate the shadow to match | 847 // blocks the UI thread, so there's no way to invalidate the shadow to match |
848 // the composited layer. This assumes the native window shape is a good match | 848 // the composited layer. This assumes the native window shape is a good match |
849 // for the composited NonClientFrameView, which should be the case since the | 849 // for the composited NonClientFrameView, which should be the case since the |
850 // native shape is what's most appropriate for displaying sheets on Mac. | 850 // native shape is what's most appropriate for displaying sheets on Mac. |
851 if (translucent && !native_widget_mac_->IsWindowModalSheet()) { | 851 if (translucent && !native_widget_mac_->IsWindowModalSheet()) { |
852 [window_ setOpaque:NO]; | 852 [window_ setOpaque:NO]; |
853 [window_ setBackgroundColor:[NSColor clearColor]]; | 853 // For Mac OS versions earlier than Yosemite, the Window server isn't able |
| 854 // to generate a window shadow from the composited CALayer. To get around |
| 855 // this, set an opaque background on the window and clip the window boundary |
| 856 // in drawRect method of BridgedContentView. See crbug.com/543671. |
| 857 if (base::mac::IsOSYosemiteOrLater()) |
| 858 [window_ setBackgroundColor:[NSColor clearColor]]; |
| 859 else |
| 860 [window_ setBackgroundColor:[NSColor whiteColor]]; |
854 } | 861 } |
855 | 862 |
856 UpdateLayerProperties(); | 863 UpdateLayerProperties(); |
857 } | 864 } |
858 | 865 |
859 //////////////////////////////////////////////////////////////////////////////// | 866 //////////////////////////////////////////////////////////////////////////////// |
860 // BridgedNativeWidget, internal::InputMethodDelegate: | 867 // BridgedNativeWidget, internal::InputMethodDelegate: |
861 | 868 |
862 ui::EventDispatchDetails BridgedNativeWidget::DispatchKeyEventPostIME( | 869 ui::EventDispatchDetails BridgedNativeWidget::DispatchKeyEventPostIME( |
863 ui::KeyEvent* key) { | 870 ui::KeyEvent* key) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1218 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
1212 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1219 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
1213 // changes. Previously we tried adding an NSView and removing it, but for some | 1220 // changes. Previously we tried adding an NSView and removing it, but for some |
1214 // reason it required reposting the mouse-down event, and didn't always work. | 1221 // reason it required reposting the mouse-down event, and didn't always work. |
1215 // Calling the below seems to be an effective solution. | 1222 // Calling the below seems to be an effective solution. |
1216 [window_ setMovableByWindowBackground:NO]; | 1223 [window_ setMovableByWindowBackground:NO]; |
1217 [window_ setMovableByWindowBackground:YES]; | 1224 [window_ setMovableByWindowBackground:YES]; |
1218 } | 1225 } |
1219 | 1226 |
1220 } // namespace views | 1227 } // namespace views |
OLD | NEW |