Browse files

Closes #519: Print preview does not work [r=Mardak]

Make print preview usable
(cherry picked from commit f0c8a2f)
  • Loading branch information...
1 parent 6567704 commit f1b73636eab0b20a0fdefe77bdb59dc1c1052114 aleth committed with Mardak Sep 10, 2011
Showing with 27 additions and 1 deletion.
  1. +27 −1 lessChromeHD/bootstrap.js
View
28 lessChromeHD/bootstrap.js
@@ -95,8 +95,10 @@ function prepareLessChrome(window) {
// Calculate the height of toolbars that should be shown
let TabsBar = document.getElementById("TabsToolbar");
let ToolbarMenu = document.getElementById("toolbar-menubar");
+ let PrintPreviewToolbarHeight = 0;
function getToolbarHeight() {
- return TabsBar.getBoundingClientRect().height + ToolbarMenu.getBoundingClientRect().height;
+ return TabsBar.getBoundingClientRect().height + ToolbarMenu.getBoundingClientRect().height
+ + PrintPreviewToolbarHeight;
}
// Figure out how much to shift the main browser
@@ -120,6 +122,30 @@ function prepareLessChrome(window) {
};
});
+ // Watch for creation of print preview toolbar
+ change(gNavToolbox.parentNode, "insertBefore", function(orig) {
+ return function(newElement, referenceElement) {
+ var insElement = orig.call(this, newElement, referenceElement);
+ if (newElement.id == "print-preview-toolbar") {
+ PrintPreviewToolbarHeight = insElement.getBoundingClientRect().height;
+ updateOffset();
+ }
+ return insElement;
+ };
+ });
+
+ // Watch for removal of print preview toolbar
+ change(gNavToolbox.parentNode, "removeChild", function(orig) {
+ return function(child) {
+ var oldChild = orig.call(this, child);
+ if (child.id == "print-preview-toolbar") {
+ PrintPreviewToolbarHeight = 0;
+ async(function() updateOffset(), 200);
+ }
+ return oldChild;
+ };
+ });
+
// Set the opacity of potentially hidden toolbars or clear it
function updateOpacity(opacity) {
// Set the opacity for every toolbar except tabs

0 comments on commit f1b7363

Please sign in to comment.