From a8d873689999d6f055a040673bee021b11d67a67 Mon Sep 17 00:00:00 2001 From: aradabaugh Date: Fri, 20 Jan 2012 00:33:40 -0700 Subject: [PATCH 1/2] Fixes CPShadowView shadowViewEnclosingView to use self instead of shadowView. --- AppKit/CPShadowView.j | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j index e9e05c4a0..bdc48b2b1 100644 --- a/AppKit/CPShadowView.j +++ b/AppKit/CPShadowView.j @@ -98,22 +98,26 @@ var LIGHT_LEFT_INSET = 3.0, + (id)shadowViewEnclosingView:(CPView)aView withWeight:(CPShadowWeight)aWeight { - var shadowView = [[CPShadowView alloc] initWithFrame:[aView frame]]; - [shadowView setWeight:aWeight]; + var self = [[CPShadowView alloc] initWithFrame:[aView frame]]; + + if (self) + { + [self setWeight:aWeight]; + + var size = [self frame].size, + width = size.width - [self leftInset] - [self rightInset], + height = size.height - [self topInset] - [self bottomInset], + enclosingView = [aView superview]; + + [self setHitTests:[aView hitTests]]; + [self setAutoresizingMask:[aView autoresizingMask]]; + [aView removeFromSuperview]; + [self addSubview:aView]; + [aView setFrame:CGRectMake([self leftInset], [self topInset], width, height)] + [enclosingView addSubview:self]; + } - var size = [shadowView frame].size, - width = size.width - [shadowView leftInset] - [shadowView rightInset], - height = size.height - [shadowView topInset] - [shadowView bottomInset], - enclosingView = [aView superview]; - - [shadowView setHitTests:[aView hitTests]]; - [shadowView setAutoresizingMask:[aView autoresizingMask]]; - [aView removeFromSuperview]; - [shadowView addSubview:aView]; - [aView setFrame:CGRectMake([shadowView leftInset], [shadowView topInset], width, height)] - [enclosingView addSubview:shadowView]; - - return shadowView; + return self; } - (id)initWithFrame:(CGRect)aFrame From 6bc3d49ba27cdcd96f9916b4086020cf6a842442 Mon Sep 17 00:00:00 2001 From: aradabaugh Date: Fri, 20 Jan 2012 13:33:24 -0700 Subject: [PATCH 2/2] Correcting use of self in CPShadowView shadowViewEnclosingView: --- AppKit/CPShadowView.j | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j index bdc48b2b1..d62b623be 100644 --- a/AppKit/CPShadowView.j +++ b/AppKit/CPShadowView.j @@ -98,26 +98,26 @@ var LIGHT_LEFT_INSET = 3.0, + (id)shadowViewEnclosingView:(CPView)aView withWeight:(CPShadowWeight)aWeight { - var self = [[CPShadowView alloc] initWithFrame:[aView frame]]; + var shadowView = [[self alloc] initWithFrame:[aView frame]]; - if (self) + if (shadowView) { - [self setWeight:aWeight]; + [shadowView setWeight:aWeight]; - var size = [self frame].size, - width = size.width - [self leftInset] - [self rightInset], - height = size.height - [self topInset] - [self bottomInset], + var size = [shadowView frame].size, + width = size.width - [shadowView leftInset] - [shadowView rightInset], + height = size.height - [shadowView topInset] - [shadowView bottomInset], enclosingView = [aView superview]; - [self setHitTests:[aView hitTests]]; - [self setAutoresizingMask:[aView autoresizingMask]]; + [shadowView setHitTests:[aView hitTests]]; + [shadowView setAutoresizingMask:[aView autoresizingMask]]; [aView removeFromSuperview]; - [self addSubview:aView]; - [aView setFrame:CGRectMake([self leftInset], [self topInset], width, height)] - [enclosingView addSubview:self]; + [shadowView addSubview:aView]; + [aView setFrame:CGRectMake([shadowView leftInset], [shadowView topInset], width, height)] + [enclosingView addSubview:shadowView]; } - return self; + return shadowView; } - (id)initWithFrame:(CGRect)aFrame