Made shadows more robust with platform windows.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-11-12 01:46:10 -08:00
parent 67672ebb0c
commit 61c0d33b4d
+32 -13
View File
@@ -930,21 +930,24 @@ CPTexturedBackgroundWindowMask
return _hasShadow;
}
/*!
Sets whether the window should have a drop shadow.
@param shouldHaveShadow \c YES to have a drop shadow.
*/
- (void)setHasShadow:(BOOL)shouldHaveShadow
- (void)_updateShadow
{
if (_hasShadow === shouldHaveShadow)
return;
_hasShadow = shouldHaveShadow;
if ([self _sharesChromeWithPlatformWindow])
return [_platformWindow setHasShadow:shouldHaveShadow];
{
if (_shadowView)
{
#if PLATFORM(DOM)
CPDOMDisplayServerRemoveChild(_DOMElement, _shadowView._DOMElement);
#endif
_shadowView = nil;
}
if (_hasShadow)
[_platformWindow setHasShadow:_hasShadow];
return;
}
if (_hasShadow && !_shadowView)
{
var bounds = [_windowView bounds];
@@ -978,7 +981,7 @@ CPTexturedBackgroundWindowMask
CPDOMDisplayServerInsertBefore(_DOMElement, _shadowView._DOMElement, _windowView._DOMElement);
#endif
}
else if (_shadowView)
else if (!_hasShadow && _shadowView)
{
#if PLATFORM(DOM)
CPDOMDisplayServerRemoveChild(_DOMElement, _shadowView._DOMElement);
@@ -987,6 +990,20 @@ CPTexturedBackgroundWindowMask
}
}
/*!
Sets whether the window should have a drop shadow.
@param shouldHaveShadow \c YES to have a drop shadow.
*/
- (void)setHasShadow:(BOOL)shouldHaveShadow
{
if (_hasShadow === shouldHaveShadow)
return;
_hasShadow = shouldHaveShadow;
[self _updateShadow];
}
- (void)setShadowStyle:(unsigned)aStyle
{
_shadowStyle = aStyle;
@@ -2285,6 +2302,8 @@ var keyViewComparator = function(a, b, context)
return;
_sharesChromeWithPlatformWindow = shouldShareFrameWithPlatformWindow;
[self _updateShadow];
}
- (BOOL)_sharesChromeWithPlatformWindow