| 824 | | for( unsigned int i = 0; messageCount > scrollbackLimit && i < ( messageCount - scrollbackLimit ); i++ ) { |
|---|
| 825 | | [_body removeChild:[_body firstChild]]; |
|---|
| 826 | | messageCount--; |
|---|
| | 819 | unsigned limit = ( messageCount - scrollbackLimit ); |
|---|
| | 820 | long shiftAmount = [self _locationOfElementAtIndex:limit]; |
|---|
| | 821 | |
|---|
| | 822 | DOMNode *node = [_body firstChild]; |
|---|
| | 823 | for( unsigned i = 0; node && i < limit; ) { |
|---|
| | 824 | DOMNode *next = [node nextSibling]; |
|---|
| | 825 | |
|---|
| | 826 | if( [node nodeType] == DOM_ELEMENT_NODE ) { |
|---|
| | 827 | [_body removeChild:node]; |
|---|
| | 828 | ++i; |
|---|
| | 829 | } |
|---|
| | 830 | |
|---|
| | 831 | node = next; |
|---|
| 828 | | } |
|---|
| 829 | | |
|---|
| 830 | | if( scrollToBottomNeeded && shiftAmount > 0 && shiftAmount != NSNotFound ) { |
|---|
| 831 | | DOMHTMLElement *body = [_domDocument body]; |
|---|
| 832 | | unsigned long scrollTop = [[body valueForKey:@"scrollTop"] longValue]; |
|---|
| 833 | | [body setValue:[NSNumber numberWithUnsignedLong:( scrollTop - shiftAmount )] forKey:@"scrollTop"]; |
|---|
| 834 | | [scroller shiftMarksAndShadedAreasBy:( shiftAmount * -1 )]; |
|---|
| 835 | | } |
|---|
| 836 | | |
|---|
| 837 | | [[self verticalMarkedScroller] setNeedsDisplay:YES]; |
|---|
| | 833 | |
|---|
| | 834 | long firstItemShift = [self _locationOfElementAtIndex:0]; |
|---|
| | 835 | if( firstItemShift != NSNotFound ) shiftAmount -= firstItemShift; |
|---|
| | 836 | |
|---|
| | 837 | if( scrollToBottomNeeded && shiftAmount > 0 && shiftAmount != NSNotFound ) |
|---|
| | 838 | [scroller shiftMarksAndShadedAreasBy:( shiftAmount * -1 )]; |
|---|
| | 839 | } |
|---|