mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-08 19:57:14 +00:00
Made shadows more robust with platform windows.
Reviewed by me.
This commit is contained in:
+32
-13
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user