Bug 218223: Long tooltips should wrap instead of cropping text, based on original SeaMonkey patch by Chris Thomas <cst@yecc.com>, Firefox patch by shaver, r=me

This commit is contained in:
gavin%gavinsharp.com 2007-04-24 16:20:24 +00:00
Родитель f6a532d681
Коммит 0fb0328b59
5 изменённых файлов: 48 добавлений и 9 удалений

Просмотреть файл

@ -20,3 +20,10 @@ menuitem.spell-suggestion {
window[sizemode="maximized"] #content .notification-inner {
border-right: 0px !important;
}
/* ::::: Tooltips (multi-line) from content ::::: */
.htmltooltip-label {
max-width: 40em;
margin: 0;
white-space: -moz-pre-wrap;
}

Просмотреть файл

@ -2680,15 +2680,29 @@ function FillInHTMLTooltip(tipElement)
tipElement = tipElement.parentNode;
}
var texts = [titleText, XLinkTitleText];
var tipNode = document.getElementById("aHTMLTooltip");
tipNode.style.direction = direction;
var tipNode = document.getElementById("aHTMLTooltip").firstChild;
var label = tipNode.firstChild;
for each (var t in [titleText, XLinkTitleText]) {
if (t && /\S/.test(t)) {
tipNode.style.direction = direction;
// Per HTML 4.01 6.2 (CDATA section), literal CRs and tabs should be
// replaced with spaces, and LFs should be removed entirely.
// XXX Bug 322270: We don't preserve the result of entities like &#13;,
// which should result in a line break in the tooltip, because we can't
// distinguish that from a literal character in the source by this point.
t = t.replace(/[\r\t]/g, ' ');
t = t.replace(/\n/g, '');
label.textContent = t;
//// XXX Work around reflow bugs (bug 357337 / bug 228673)
tipNode.width = "";
tipNode.height = "";
tipNode.width = label.boxObject.width;
tipNode.height = label.boxObject.height;
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, " ") );
retVal = true;
}
}

Просмотреть файл

@ -101,7 +101,11 @@
onpopupshowing="return BrowserForwardMenu(event);"
oncommand="gotoHistoryIndex(event);"
onclick="checkForMiddleClick(this, event);"/>
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);">
<hbox>
<label flex="1" class="htmltooltip-label"/>
</hbox>
</tooltip>
<popup type="autocomplete" chromedir="&locale.dir;" id="PopupAutoComplete"/>

Просмотреть файл

@ -1277,3 +1277,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
-moz-border-bottom-colors: -moz-mac-menushadow -moz-mac-menushadow ThreeDShadow !important;
-moz-border-left-colors: ThreeDLightShadow ThreeDHighlight !important;
}
/* ::::: Tooltips (multi-line) from content ::::: */
.htmltooltip-label {
max-width: 40em;
margin: 0;
white-space: -moz-pre-wrap;
}

Просмотреть файл

@ -1373,3 +1373,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
-moz-border-bottom-colors: #000000;
}
%endif
/* ::::: Tooltips (multi-line) from content ::::: */
.htmltooltip-label {
max-width: 40em;
margin: 0;
white-space: -moz-pre-wrap;
}