From f7ab5eb04192014873504cb54dacf9708708945f Mon Sep 17 00:00:00 2001 From: "cst%yecc.com" Date: Wed, 9 Aug 2006 22:48:23 +0000 Subject: [PATCH] Bug 345178 Remove tooltip width limit for tab-preview tooltips and improve preview behavior for small images r+sr=neil git-svn-id: svn://10.0.0.236/trunk@207014 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/themes/classic/global/mac/browser.css | 4 ++++ mozilla/themes/classic/global/win/browser.css | 4 ++++ .../xpfe/global/resources/content/bindings/tabbrowser.xml | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mozilla/themes/classic/global/mac/browser.css b/mozilla/themes/classic/global/mac/browser.css index b0cba41f737..940c10c2686 100644 --- a/mozilla/themes/classic/global/mac/browser.css +++ b/mozilla/themes/classic/global/mac/browser.css @@ -54,3 +54,7 @@ tab[busy] { margin: 0px; list-style-image: url("chrome://global/skin/icons/tab-new.gif"); } + +tooltip[tabpreview="true"] { + max-width: none; +} diff --git a/mozilla/themes/classic/global/win/browser.css b/mozilla/themes/classic/global/win/browser.css index 43a93afbd77..77c2ea29046 100644 --- a/mozilla/themes/classic/global/win/browser.css +++ b/mozilla/themes/classic/global/win/browser.css @@ -65,3 +65,7 @@ tab[busy] { position: relative; list-style-image: url('chrome://global/skin/icons/tab-drag-indicator.gif'); } + +tooltip[tabpreview="true"] { + max-width: none; +} diff --git a/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml b/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml index dd74dd57d4d..d1677a4881c 100644 --- a/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml +++ b/mozilla/xpfe/global/resources/content/bindings/tabbrowser.xml @@ -214,6 +214,7 @@ if (!this.mPrefs.getBoolPref("browser.tabs.tooltippreview.enable")) { label.removeAttribute("width"); + aPopup.removeAttribute("tabpreview"); return true; } @@ -225,6 +226,7 @@ } label.width = 0; + aPopup.setAttribute("tabpreview", "true"); var win = b.contentWindow; var w = win.innerWidth; var h = win.innerHeight; @@ -243,7 +245,10 @@ ctx.fillRect(0, 0, canvasW, canvasH); var img = b.contentDocument.body.firstChild; var ratio = img.naturalHeight / img.naturalWidth; - if (ratio * canvasW > canvasH) { + if (img.naturalHeight <= canvasH && img.naturalWidth <= canvasW) { + ctx.drawImage(img, 0, 0, img.naturalWidth, img.naturalHeight); + } + else if (ratio * canvasW > canvasH) { ctx.drawImage(img, 0, 0, canvasH / ratio, canvasH); } else {