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

Side by Side Diff: ui/base/cocoa/underlay_opengl_hosting_window.mm

Issue 11316172: Always disable "content has shadow". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated comment Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/base/cocoa/underlay_opengl_hosting_window.h" 5 #import "ui/base/cocoa/underlay_opengl_hosting_window.h"
6 6
7 #import <objc/runtime.h> 7 #import <objc/runtime.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // most Chromium windows, not because this is related to its functionality.) 101 // most Chromium windows, not because this is related to its functionality.)
102 DCHECK(!NSIsEmptyRect(contentRect)); 102 DCHECK(!NSIsEmptyRect(contentRect));
103 if ((self = [super initWithContentRect:contentRect 103 if ((self = [super initWithContentRect:contentRect
104 styleMask:windowStyle 104 styleMask:windowStyle
105 backing:bufferingType 105 backing:bufferingType
106 defer:deferCreation])) { 106 defer:deferCreation])) {
107 // OpenGL-accelerated content works by punching holes in windows. Therefore 107 // OpenGL-accelerated content works by punching holes in windows. Therefore
108 // all windows hosting OpenGL content must not be opaque. 108 // all windows hosting OpenGL content must not be opaque.
109 [self setOpaque:NO]; 109 [self setOpaque:NO];
110 110
111 // Always disable "content has shadow". This class assumes that all holes
112 // punched in the window are intentional, in order to show accelerated
113 // content underneath, so those holes cannot be allowed to cause holes in
114 // the shadow. Note that the edges trimmed from around the periphery of a
115 // window (through use of transparency) don't count as content area with
116 // regards to "content has shadow".
117 [self _setContentHasShadow:NO];
Nico 2012/11/27 00:28:12 Hum, I would've expected this to force a regulare
Avi (use Gerrit) 2012/11/27 14:51:53 That's the magic of "content has shadow = NO"; the
118
119 // Only set up opaques if the window is a proper window with a title bar
120 // and all.
111 if (windowStyle & NSTitledWindowMask) { 121 if (windowStyle & NSTitledWindowMask) {
112 // Only fiddle with shadows if the window is a proper window with a
113 // title bar and all.
114 [self _setContentHasShadow:NO];
115 122
116 NSView* rootView = [[self contentView] superview]; 123 NSView* rootView = [[self contentView] superview];
117 const NSRect rootBounds = [rootView bounds]; 124 const NSRect rootBounds = [rootView bounds];
118 125
119 // On 10.7/8, the bottom corners of the window are rounded by magic at a 126 // On 10.7/8, the bottom corners of the window are rounded by magic at a
120 // deeper level than the NSThemeFrame, so it is OK to have the opaques 127 // deeper level than the NSThemeFrame, so it is OK to have the opaques
121 // go all the way to the bottom. 128 // go all the way to the bottom.
122 const CGFloat kTopEdgeInset = 16; 129 const CGFloat kTopEdgeInset = 16;
123 const CGFloat kAlphaValueJustOpaqueEnough = 0.005; 130 const CGFloat kAlphaValueJustOpaqueEnough = 0.005;
124 131
(...skipping 12 matching lines...) Expand all
137 NSViewHeightSizable]; 144 NSViewHeightSizable];
138 [rightOpaque setAlphaValue:kAlphaValueJustOpaqueEnough]; 145 [rightOpaque setAlphaValue:kAlphaValueJustOpaqueEnough];
139 [rootView addSubview:rightOpaque]; 146 [rootView addSubview:rightOpaque];
140 } 147 }
141 } 148 }
142 149
143 return self; 150 return self;
144 } 151 }
145 152
146 @end 153 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698