adium 2760:15f5873def89: Try not to call nearBottom() when we do...
commits at adium.im
commits at adium.im
Wed Oct 21 21:26:15 UTC 2009
details: http://hg.adium.im/adium/rev/15f5873def89
revision: 2760:15f5873def89
author: Stephen Holt <sholt at adium.im>
date: Wed Oct 21 17:25:54 2009 -0400
Try not to call nearBottom() when we don't have to.
diffs (70 lines):
diff -r 81552ae2f111 -r 15f5873def89 Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html Wed Oct 21 13:43:51 2009 -0400
+++ b/Plugins/WebKit Message View/Template.html Wed Oct 21 17:25:54 2009 -0400
@@ -25,7 +25,7 @@
this.timeoutID = 0;
this.coalesceRounds = 0;
this.isCoalescing = false;
- this.shouldScroll = false;
+ this.shouldScroll = undefined;
function outputHTML() {
var insert = document.getElementById("insert");
@@ -37,7 +37,7 @@
alignChat(self.shouldScroll);
// reset state to empty/non-coalescing
- self.shouldScroll = false;
+ self.shouldScroll = undefined;
self.isCoalescing = false;
self.coalesceRounds = 0;
}
@@ -130,7 +130,14 @@
//Appending new content to the message view
function appendMessage(html) {
- var shouldScroll = nearBottom();
+ var shouldScroll;
+
+ // Only call nearBottom() if should scroll is undefined.
+ if(undefined === coalescedHTML.shouldScroll) {
+ shouldScroll = nearBottom();
+ } else {
+ shouldScroll = coalescedHTML.shouldScroll;
+ }
appendMessageNoScroll(html, shouldScroll);
}
@@ -141,7 +148,12 @@
}
function appendNextMessage(html){
- var shouldScroll = nearBottom();
+ var shouldScroll;
+ if(undefined === coalescedHTML.shouldScroll) {
+ shouldScroll = nearBottom();
+ } else {
+ shouldScroll = coalescedHTML.shouldScroll;
+ }
appendNextMessageNoScroll(html, shouldScroll);
}
@@ -169,11 +181,17 @@
}
function replaceLastMessage(html){
- shouldScroll = nearBottom();
+ var shouldScroll;
// only replace messages if we're already coalescing
if(coalescedHTML.isCoalescing){
+ if(undefined === coalescedHTML.shouldScroll) {
+ shouldScroll = nearBottom();
+ } else {
+ shouldScroll = coalescedHTML.shouldScroll;
+ }
coalescedHTML.replaceLast(html, shouldScroll);
} else {
+ shouldScroll = nearBottom();
//Retrieve the current insertion point, then remove it
//This requires that there have been an insertion point... is there a better way to retrieve the last element? -evands
var insert = document.getElementById("insert");
More information about the commits
mailing list