[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r14367: Prevent window resize code from activating in the event of f (torbutton/trunk/src/chrome/content)
Author: mikeperry
Date: 2008-04-13 17:27:08 -0400 (Sun, 13 Apr 2008)
New Revision: 14367
Modified:
torbutton/trunk/src/chrome/content/torbutton.js
Log:
Prevent window resize code from activating in the event of
find bars and scoll bars appearing. May leak a tiny bit of
info on widget size, but should be far less obnoxious.
Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js 2008-04-13 21:17:38 UTC (rev 14366)
+++ torbutton/trunk/src/chrome/content/torbutton.js 2008-04-13 21:27:08 UTC (rev 14367)
@@ -1313,7 +1313,10 @@
if(m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled")
&& m_tb_prefs.getBoolPref("extensions.torbutton.resize_on_toggle")) {
var bWin = window.getBrowser().contentWindow;
- if(window.windowState
+ // only resize if outer window size has changed (ignore stuff like
+ // scrollbars and find bars)
+ if((m_tb_window_height != window.outerHeight ||
+ m_tb_window_width != window.outerWidth) && window.windowState
== Components.interfaces.nsIDOMChromeWindow.STATE_NORMAL) {
torbutton_log(2, "Resizing window on event");
bWin.innerHeight = Math.round(bWin.innerHeight/50.0)*50;
@@ -1321,8 +1324,8 @@
}
}
- m_tb_window_height = window.height;
- m_tb_window_width = window.width;
+ m_tb_window_height = window.outerHeight;
+ m_tb_window_width = window.outerWidth;
}
function torbutton_check_round(browser)
@@ -1337,8 +1340,8 @@
Math.floor(Math.round(browser.contentWindow.innerHeight/50.0)*50))
> 0.1) {
torbutton_log(2, "Restoring orig window size");
- window.height = m_tb_window_height;
- window.width = m_tb_window_width;
+ window.outerHeight = m_tb_window_height;
+ window.outerWidth = m_tb_window_width;
}
// Always round.
@@ -1365,10 +1368,10 @@
!m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled"),
m_tb_prefs.getBoolPref("extensions.torbutton.no_tor_plugins"));
- m_tb_window_height = window.height;
- m_tb_window_width = window.width;
+ m_tb_window_height = window.outerHeight;
+ m_tb_window_width = window.outerWidth;
- window.addEventListener("resize", torbutton_do_resize, false);
+ window.addEventListener("resize", torbutton_do_resize, true);
}
function torbutton_close_window(event) {
@@ -1406,6 +1409,7 @@
}
}
+// XXX: Firefox3 might not support this??
window.addEventListener('load',torbutton_new_window,false);
window.addEventListener('unload', torbutton_close_window, false);
getBrowser().addEventListener("TabOpen", torbutton_new_tab, false);