aboutsummaryrefslogtreecommitdiffstats
path: root/src/js/devtool-log.js
diff options
context:
space:
mode:
authorgorhill <rhill@raymondhill.net>2015-01-26 14:07:55 -0500
committergorhill <rhill@raymondhill.net>2015-01-26 14:21:28 -0500
commit44fa4d72d01b8e286478005d12f796501ac082b2 (patch)
tree7c38da46291d26b48af5a4137169b374be1d20dd /src/js/devtool-log.js
parentcd597f9d4aa9ff70d9c0b1283d2249b24cd812a6 (diff)
downloaduBlock-44fa4d72d01b8e286478005d12f796501ac082b2.zip
uBlock-44fa4d72d01b8e286478005d12f796501ac082b2.tar.gz
uBlock-44fa4d72d01b8e286478005d12f796501ac082b2.tar.bz2
This fixes scrolling not being pinned on Firefox
Diffstat (limited to 'src/js/devtool-log.js')
-rw-r--r--src/js/devtool-log.js24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/js/devtool-log.js b/src/js/devtool-log.js
index f2a8e67..e707552 100644
--- a/src/js/devtool-log.js
+++ b/src/js/devtool-log.js
@@ -125,6 +125,10 @@ var renderLogEntry = function(entry) {
/******************************************************************************/
var renderLogBuffer = function(buffer) {
+ if ( buffer.length === 0 ) {
+ return;
+ }
+
// Preserve scroll position
var height = tbody.offsetHeight;
@@ -132,8 +136,26 @@ var renderLogBuffer = function(buffer) {
for ( var i = 0; i < n; i++ ) {
renderLogEntry(buffer[i]);
}
+
+ var yDelta = tbody.offsetHeight - height;
+ if ( yDelta === 0 ) {
+ return;
+ }
+
+ // Chromium:
+ // body.scrollTop = good value
+ // body.parentNode.scrollTop = 0
if ( body.scrollTop !== 0 ) {
- body.scrollTop += tbody.offsetHeight - height;
+ body.scrollTop += yDelta;
+ return;
+ }
+
+ // Firefox:
+ // body.scrollTop = 0
+ // body.parentNode.scrollTop = good value
+ var parentNode = body.parentNode;
+ if ( parentNode && parentNode.scrollTop !== 0 ) {
+ parentNode.scrollTop += yDelta;
}
};