Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: ui/views/cocoa/bridged_native_widget.mm

Issue 1633403002: MacViews: Add native drop shadow to dialogs on OSX < 10.10. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 OSs earlier than Yosemite, we set an opaque background so that window
854 // server can generate a a drop shadow and border for dialogs. See
855 // crbug.com/543671.
856 if (base::mac::IsOSYosemiteOrLater())
857 [window_ setBackgroundColor:[NSColor clearColor]];
858 else
859 [window_ setBackgroundColor:[NSColor whiteColor]];
854 } 860 }
855 861
856 UpdateLayerProperties(); 862 UpdateLayerProperties();
857 } 863 }
858 864
859 //////////////////////////////////////////////////////////////////////////////// 865 ////////////////////////////////////////////////////////////////////////////////
860 // BridgedNativeWidget, internal::InputMethodDelegate: 866 // BridgedNativeWidget, internal::InputMethodDelegate:
861 867
862 ui::EventDispatchDetails BridgedNativeWidget::DispatchKeyEventPostIME( 868 ui::EventDispatchDetails BridgedNativeWidget::DispatchKeyEventPostIME(
863 ui::KeyEvent* key) { 869 ui::KeyEvent* key) {
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 [bridged_view_ setMouseDownCanMoveWindow:draggable]; 1217 [bridged_view_ setMouseDownCanMoveWindow:draggable];
1212 // AppKit will not update its cache of mouseDownCanMoveWindow unless something 1218 // AppKit will not update its cache of mouseDownCanMoveWindow unless something
1213 // changes. Previously we tried adding an NSView and removing it, but for some 1219 // 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. 1220 // reason it required reposting the mouse-down event, and didn't always work.
1215 // Calling the below seems to be an effective solution. 1221 // Calling the below seems to be an effective solution.
1216 [window_ setMovableByWindowBackground:NO]; 1222 [window_ setMovableByWindowBackground:NO];
1217 [window_ setMovableByWindowBackground:YES]; 1223 [window_ setMovableByWindowBackground:YES];
1218 } 1224 }
1219 1225
1220 } // namespace views 1226 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698