Fixed issue with custom draw rect detection.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2008-09-22 19:20:19 -07:00
1 parent e4588cf235
commit 2aa5b0a1ad
2 files changed
+19 -21

No files matched your search

+9 -15
View File
@@ -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
{
@@ -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)];
+10 -6
View File
@@ -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;
@@ -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