Index: lib/objectTabs.js |
=================================================================== |
--- a/lib/objectTabs.js |
+++ b/lib/objectTabs.js |
@@ -109,55 +109,55 @@ var objTabs = |
*/ |
hideTargetTime: 0, |
/** |
* Initializes object tabs (generates random classes and registers stylesheet). |
*/ |
_initCSS: function() |
{ |
+ function processCSSData(request) |
+ { |
+ if (onShutdown.done) |
+ return; |
+ |
+ let data = request.responseText; |
+ |
+ let rnd = []; |
+ let offset = "a".charCodeAt(0); |
+ for (let i = 0; i < 60; i++) |
+ rnd.push(offset + Math.random() * 26); |
+ |
+ this.objTabClassVisibleTop = String.fromCharCode.apply(String, rnd.slice(0, 20)); |
+ this.objTabClassVisibleBottom = String.fromCharCode.apply(String, rnd.slice(20, 40)); |
+ this.objTabClassHidden = String.fromCharCode.apply(String, rnd.slice(40, 60)); |
+ |
+ let {Utils} = require("utils"); |
+ let url = Utils.makeURI("data:text/css," + encodeURIComponent(data.replace(/%%CLASSVISIBLETOP%%/g, this.objTabClassVisibleTop) |
+ .replace(/%%CLASSVISIBLEBOTTOM%%/g, this.objTabClassVisibleBottom) |
+ .replace(/%%CLASSHIDDEN%%/g, this.objTabClassHidden))); |
+ Utils.styleService.loadAndRegisterSheet(url, Ci.nsIStyleSheetService.USER_SHEET); |
+ onShutdown.add(function() |
+ { |
+ Utils.styleService.unregisterSheet(url, Ci.nsIStyleSheetService.USER_SHEET); |
+ }); |
+ |
+ this.initializing = false; |
+ this.initialized = true; |
+ |
+ if (this.delayedShowParams) |
+ this._showTab.apply(this, this.delayedShowParams); |
+ } |
+ |
this.delayedShowParams = arguments; |
if (!this.initializing) |
{ |
this.initializing = true; |
- function processCSSData(request) |
- { |
- if (onShutdown.done) |
- return; |
- |
- let data = request.responseText; |
- |
- let rnd = []; |
- let offset = "a".charCodeAt(0); |
- for (let i = 0; i < 60; i++) |
- rnd.push(offset + Math.random() * 26); |
- |
- this.objTabClassVisibleTop = String.fromCharCode.apply(String, rnd.slice(0, 20)); |
- this.objTabClassVisibleBottom = String.fromCharCode.apply(String, rnd.slice(20, 40)); |
- this.objTabClassHidden = String.fromCharCode.apply(String, rnd.slice(40, 60)); |
- |
- let {Utils} = require("utils"); |
- let url = Utils.makeURI("data:text/css," + encodeURIComponent(data.replace(/%%CLASSVISIBLETOP%%/g, this.objTabClassVisibleTop) |
- .replace(/%%CLASSVISIBLEBOTTOM%%/g, this.objTabClassVisibleBottom) |
- .replace(/%%CLASSHIDDEN%%/g, this.objTabClassHidden))); |
- Utils.styleService.loadAndRegisterSheet(url, Ci.nsIStyleSheetService.USER_SHEET); |
- onShutdown.add(function() |
- { |
- Utils.styleService.unregisterSheet(url, Ci.nsIStyleSheetService.USER_SHEET); |
- }); |
- |
- this.initializing = false; |
- this.initialized = true; |
- |
- if (this.delayedShowParams) |
- this._showTab.apply(this, this.delayedShowParams); |
- } |
- |
// Load CSS asynchronously |
try { |
let request = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest); |
request.mozBackgroundRequest = true; |
request.open("GET", "chrome://adblockplus/content/objtabs.css"); |
request.overrideMimeType("text/plain"); |
request.addEventListener("load", processCSSData.bind(this, request), false); |
@@ -360,17 +360,17 @@ var objTabs = |
function intersectRect(rect, wnd) |
{ |
// Cannot use wnd.innerWidth/Height because they won't account for scrollbars |
let doc = wnd.document; |
let wndWidth = doc.documentElement.clientWidth; |
let wndHeight = doc.documentElement.clientHeight; |
if (doc.compatMode == "BackCompat") // clientHeight will be bogus in quirks mode |
wndHeight = Math.max(doc.documentElement.offsetHeight, doc.body.offsetHeight) - wnd.scrollMaxY - 1; |
- |
+ |
rect.left = Math.max(rect.left, 0); |
rect.top = Math.max(rect.top, 0); |
rect.right = Math.min(rect.right, wndWidth); |
rect.bottom = Math.min(rect.bottom, wndHeight); |
} |
let rect = element.getBoundingClientRect(); |
let wnd = element.ownerDocument.defaultView; |