Skip to content

Commit

Permalink
Fixed issue with custom draw rect detection.
Browse files Browse the repository at this point in the history
Reviewed by me.
  • Loading branch information
Francisco Ryan Tolmasky I committed Sep 23, 2008
1 parent e4588cf commit 2aa5b0a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
24 changes: 9 additions & 15 deletions AppKit/CPSplitView.j
Expand Up @@ -54,16 +54,15 @@ var CPSplitViewHorizontalImage = nil,
/*
@ignore
*/
//+ (void)initialize
//{
// if (self != [CPSplitView class])
// return;
//
// var bundle = [CPBundle bundleForClass:self];
//
// CPSplitViewHorizontalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewHorizontal.png"] size:CPSizeMake(5.0, 10.0)];
// CPSplitViewVerticalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewVertical.png"] size:CPSizeMake(10.0, 5.0)];
//}
+ (void)initialize
{
if (self != [CPSplitView class])
return;

var bundle = [CPBundle bundleForClass:self];
CPSplitViewHorizontalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewHorizontal.png"] size:CPSizeMake(5.0, 10.0)];
CPSplitViewVerticalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewVertical.png"] size:CPSizeMake(10.0, 5.0)];
}

- (id)initWithFrame:(CGRect)aFrame
{
Expand Down Expand Up @@ -505,8 +504,3 @@ var CPSplitViewDelegateKey = "CPSplitViewDelegateKey",
}

@end

// FIXME: once +initialize is fixed for superclasses, remove this and uncomment +initialize
var bundle = [CPBundle bundleForClass:CPSplitView];
CPSplitViewHorizontalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewHorizontal.png"] size:CPSizeMake(5.0, 10.0)];
CPSplitViewVerticalImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPSplitView/CPSplitViewVertical.png"] size:CPSizeMake(10.0, 5.0)];
16 changes: 10 additions & 6 deletions AppKit/CPView.j
Expand Up @@ -173,11 +173,6 @@ var DOMElementPrototype = nil,
*/
+ (void)initialize
{
#if PLATFORM(DOM)
if ([self instanceMethodForSelector:@selector(drawRect:)] != [CPView instanceMethodForSelector:@selector(drawRect:)])
CustomDrawRectViews[[self hash]] = YES;
#endif

if (self != [CPView class])
return;

Expand Down Expand Up @@ -1380,7 +1375,16 @@ setBoundsOrigin:
- (void)setNeedsDisplayInRect:(CPRect)aRect
{
#if PLATFORM(DOM)
if (!CustomDrawRectViews[[[self class] hash]])
var hash = [[self class] hash],
hasCustomDrawRect = CustomDrawRectViews[hash];

if (!hasCustomDrawRect && typeof hasCustomDrawRect === "undefined")
{
hasCustomDrawRect = [self methodForSelector:@selector(drawRect:)] != [CPView instanceMethodForSelector:@selector(drawRect:)];
CustomDrawRectViews[hash] = hasCustomDrawRect;
}

if (!hasCustomDrawRect)
return;
#endif

Expand Down

0 comments on commit 2aa5b0a

Please sign in to comment.