From ecd4f52cfb93cb53e53bef6872d5212dc9fa98e1 Mon Sep 17 00:00:00 2001 From: "chanial%noos.fr" Date: Sun, 21 Dec 2003 04:09:02 +0000 Subject: [PATCH] workaround for bug 227951: add bookmarks dialog grows everytime the expander is clicked. Use of resizeTo instead of sizeToContent (buggy on Windows) git-svn-id: svn://10.0.0.236/trunk@150593 18797224-902f-48f8-a5cc-f745e15eee43 --- .../components/bookmarks/content/addBookmark2.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mozilla/browser/components/bookmarks/content/addBookmark2.js b/mozilla/browser/components/bookmarks/content/addBookmark2.js index 4e1cffafbcc..32595b352f9 100644 --- a/mozilla/browser/components/bookmarks/content/addBookmark2.js +++ b/mozilla/browser/components/bookmarks/content/addBookmark2.js @@ -78,6 +78,10 @@ var gMenulist; var gBookmarksTree; var gGroup; +# on windows, sizeToContent is buggy (see bug 227951), we''ll use resizeTo +# instead and cache the bookmarks tree view size. +var WSucks; + function Startup() { sizeToContent(); //XXXpch buggy imo, we shouldn't need it @@ -95,6 +99,11 @@ function Startup() gSelectedFolder = RDF.GetResource(gMenulist.selectedItem.id); gExpander.setAttribute("tooltiptext", gExpander.getAttribute("tooltiptextdown")); +# read the persisted attribute. If it is not present, set a default height. + WSucks = parseInt(gBookmarksTree.getAttribute("height")); + if (!WSucks) + WSucks = 150; + // fix no more persisted class attribute in old profiles var localStore = RDF.GetDataSource("rdf:local-store"); var rAttribute = RDF.GetResource("class"); @@ -210,9 +219,10 @@ function expandTree() var willCollapse = !gBookmarksTree.collapsed; gExpander.setAttribute("class",willCollapse?"down":"up"); gExpander.setAttribute("tooltiptext", gExpander.getAttribute("tooltiptext"+(willCollapse?"down":"up"))); - if (willCollapse) + if (willCollapse) { document.documentElement.buttons = "accept,cancel"; - else { + WSucks = gBookmarksTree.boxObject.height; + } else { document.documentElement.buttons = "accept,cancel,extra2"; # always open the bookmark root folder if (!gBookmarksTree.treeBoxObject.view.isContainerOpen(0)) @@ -221,7 +231,7 @@ function expandTree() gBookmarksTree.focus(); } gBookmarksTree.collapsed = willCollapse; - sizeToContent(); + resizeTo(window.outerWidth, window.outerHeight+(willCollapse?-WSucks:+WSucks)); } function setFolderTreeHeight()