adium-1.4 2717:50f1ae85f841: Only set shouldScroll property on t...
commits at adium.im
commits at adium.im
Sat Oct 31 23:03:37 UTC 2009
details: http://hg.adium.im/adium-1.4/rev/50f1ae85f841
revision: 2717:50f1ae85f841
author: Stephen Holt <sholt at adium.im>
date: Sat Oct 31 19:02:43 2009 -0400
Only set shouldScroll property on the first new message. Prevents a long cascade of new messages from busting the scroll position before calling nearBottom().
Also, remove an unecessary call to setAppendElementMethod()
diffs (72 lines):
diff -r 338348157e70 -r 50f1ae85f841 Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html Sat Oct 31 16:13:40 2009 -0400
+++ b/Plugins/WebKit Message View/Template.html Sat Oct 31 19:02:43 2009 -0400
@@ -28,18 +28,9 @@
this.isConsecutive = undefined;
this.shouldScroll = undefined;
- var appendElement = undefined;
-
- // hook in a custom method to append new data
- // to the chat.
- this.setAppendElementMethod = function (func) {
- if(typeof func === 'function')
- appendElement = func;
- }
-
- this.setAppendElementMethod(function (elem) {
+ var appendElement = function (elem) {
document.getElementById("Chat").appendChild(elem);
- });
+ };
function outputHTML() {
var insert = document.getElementById("insert");
@@ -75,6 +66,18 @@
insert.parentNode.removeChild(insert);
}
+ function setShouldScroll(flag) {
+ if(flag && undefined === self.shouldScroll)
+ self.shouldScroll = flag;
+ }
+
+ // hook in a custom method to append new data
+ // to the chat.
+ this.setAppendElementMethod = function (func) {
+ if(typeof func === 'function')
+ appendElement = func;
+ }
+
// (re)start the coalescing timer.
// we wait 25ms for a new message to come in.
// If we get one, restart the timer and wait another 10ms.
@@ -115,7 +118,7 @@
node = null;
- if(shouldScroll) self.shouldScroll = shouldScroll;
+ setShouldScroll(shouldScroll);
self.coalesce();
}
@@ -130,8 +133,7 @@
self.fragment.appendChild(node);
}
node = null;
- if(shouldScroll)
- self.shouldScroll = shouldScroll;
+ setShouldScroll(shouldScroll);
self.coalesce();
}
@@ -141,8 +143,7 @@
var lastMessage = self.fragment.lastChild;
lastMessage.parentNode.replaceChild(node, lastMessage);
node = null;
- if(shouldScroll)
- self.shouldScroll = shouldScroll;
+ setShouldScroll(shouldScroll);
}
}
var coalescedHTML;
More information about the commits
mailing list