Plugins/WebKit Message View/AIWebKitMessageViewController.m
changeset 2754 df722b0497ca
parent 2729 2b6390521141
child 2764 4b03c62063a5
     1.1 --- a/Plugins/WebKit Message View/AIWebKitMessageViewController.m	Mon Nov 02 18:35:26 2009 -0500
     1.2 +++ b/Plugins/WebKit Message View/AIWebKitMessageViewController.m	Sat Nov 07 16:24:00 2009 -0500
     1.3 @@ -680,14 +680,19 @@
     1.4  		if (content.trackContent && [content.displayClasses containsObject:@"mention"]) {
     1.5  			[self markCurrentLocation];
     1.6  		}
     1.7 -		
     1.8 -		// Set it as a focus if appropriate.
     1.9 -		if (nextMessageFocus && [content.type isEqualToString:CONTENT_MESSAGE_TYPE]) {
    1.10 -			if (adium.interfaceController.activeChat != content.chat) {
    1.11 -				[content addDisplayClass:@"focus"];
    1.12 +
    1.13 +		if (adium.interfaceController.activeChat != content.chat && [content.type isEqualToString:CONTENT_MESSAGE_TYPE]) {
    1.14 +			if (nextMessageFocus) {
    1.15 +				[self.markedScroller addMarkAt:[self.currentOffsetHeight integerValue] withIdentifier:@"focus" withColor:[NSColor redColor]];
    1.16 +				
    1.17 +				// Add a class for "first message to lose focus"
    1.18 +				[content addDisplayClass:@"firstFocus"];
    1.19 +				
    1.20 +				nextMessageFocus = NO;
    1.21  			}
    1.22 -			
    1.23 -			nextMessageFocus = NO;
    1.24 +
    1.25 +			// Add a class for "this message received while out of focus"
    1.26 +			[content addDisplayClass:@"focus"];
    1.27  		}
    1.28  		
    1.29  		//Add the content object
    1.30 @@ -1456,12 +1461,10 @@
    1.31  
    1.32  - (void)markForFocusChange
    1.33  {
    1.34 -	JVMarkedScroller *scroller = self.markedScroller;
    1.35 +	// We use the current Chat element's height to determine our mark location.
    1.36 +	[self.markedScroller removeMarkWithIdentifier:@"focus"];
    1.37  	
    1.38 -	// We use the current Chat element's height to determine our mark location.
    1.39 -	[scroller removeMarkWithIdentifier:@"focus"];
    1.40 -	[scroller addMarkAt:[self.currentOffsetHeight integerValue] withIdentifier:@"focus" withColor:[NSColor redColor]];	
    1.41 -	
    1.42 +	// The next message being inserted needs to add a mark.
    1.43  	nextMessageFocus = YES;
    1.44  	
    1.45  	DOMNodeList *nodeList = [webView.mainFrameDocument querySelectorAll:@".focus"];
    1.46 @@ -1472,13 +1475,13 @@
    1.47  		classes = [[node.className componentsSeparatedByString:@" "] mutableCopy];
    1.48  		
    1.49  		[classes removeObject:@"focus"];
    1.50 +		[classes removeObject:@"firstFocus"];
    1.51  		
    1.52  		node.className = [classes componentsJoinedByString:@" "];
    1.53  		
    1.54  		[classes release];
    1.55  	}
    1.56  	
    1.57 -	nextMessageFocus = YES;
    1.58  }
    1.59  
    1.60  - (void)addMark