From fcf69e879c1e2b39e855a08b4bdef667d9328618 Mon Sep 17 00:00:00 2001 From: "cst%yecc.com" Date: Thu, 19 Oct 2006 23:22:43 +0000 Subject: [PATCH] Bug 45375 Long web page tooltips should wrap instead of being cropped (multiline tooltips) Bug 67127 Newline in (web page) tooltips should not be converted to black bars Bug 356900 Low-spam place to work on previous two bugs. This fix is primarily short-term / for 1.8 branch, and should be revisited when reflow branch lands on trunk. r+sr=neil --- suite/browser/browser.js | 15 +++++++++++---- suite/browser/navigator.xul | 8 ++++++-- themes/classic/navigator/navigator.css | 7 +++++++ themes/modern/navigator/navigator.css | 7 +++++++ 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/suite/browser/browser.js b/suite/browser/browser.js index 16fa1c8e2c92..94351c7ece49 100644 --- a/suite/browser/browser.js +++ b/suite/browser/browser.js @@ -269,14 +269,21 @@ function FillInHTMLTooltip(tipElement) } var texts = [titleText, XLinkTitleText]; - var tipNode = document.getElementById("aHTMLTooltip"); - tipNode.style.direction = direction; for (var i = 0; i < texts.length; ++i) { var t = texts[i]; if (t && t.search(/\S/) >= 0) { - // XXX - Short-term fix to bug 67127: collapse whitespace here - tipNode.setAttribute("label", t.replace(/\s+/g, " ") ); + var hbox = document.getElementById("aHTMLTooltip").firstChild; + hbox.style.direction = direction; + var label = hbox.firstChild; + label.textContent = t; + + // Work around reflow bugs + hbox.width = ""; + hbox.height = ""; + hbox.width = label.boxObject.width; + hbox.height = label.boxObject.height; + retVal = true; } } diff --git a/suite/browser/navigator.xul b/suite/browser/navigator.xul index 51cdf5ec2284..f9e0fbf16493 100644 --- a/suite/browser/navigator.xul +++ b/suite/browser/navigator.xul @@ -39,7 +39,7 @@ ***** END LICENSE BLOCK ***** --> - + @@ -127,7 +127,11 @@ - + + + + diff --git a/themes/classic/navigator/navigator.css b/themes/classic/navigator/navigator.css index 3c7e37e1ac59..edc50fa1c291 100644 --- a/themes/classic/navigator/navigator.css +++ b/themes/classic/navigator/navigator.css @@ -366,3 +366,10 @@ toolbarbutton.chevron { toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { display: none; } + +/* For multi-line tooltips, we need our own style */ +.htmltooltip-label { + max-width: 40em; + margin: 0; + white-space: -moz-pre-wrap; +} diff --git a/themes/modern/navigator/navigator.css b/themes/modern/navigator/navigator.css index 4b0403028937..f0404efdb603 100644 --- a/themes/modern/navigator/navigator.css +++ b/themes/modern/navigator/navigator.css @@ -589,3 +589,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker { list-style-image: url("chrome://navigator/skin/icons/about-popups.gif"); margin: 6px 0px; } + +/* For multi-line tooltips, we need our own style */ +.htmltooltip-label { + max-width: 40em; + margin: 0; + white-space: -moz-pre-wrap; +}