93839 - tooltiptext should work without specifying tooltip, r=pinkerton, sr=hyatt

This commit is contained in:
hewitt%netscape.com 2006-09-14 06:01:40 +00:00
parent fbb864dbdc
commit 4ad032739d
3 changed files with 28 additions and 44 deletions

View File

@ -88,24 +88,24 @@
tbautostretch="always" hidden="true" hasitems="false">
<toolbarbutton id="link-top" class="bookmark-item"
label="&topButton.label;" disabled="true" tooltip="aTooltip" />
label="&topButton.label;" disabled="true"/>
<toolbarbutton id="link-up" class="bookmark-item"
label="&upButton.label;" disabled="true" tooltip="aTooltip" />
label="&upButton.label;" disabled="true"/>
<toolbarseparator />
<toolbarbutton id="link-first" class="bookmark-item"
label="&firstButton.label;" disabled="true" tooltip="aTooltip" />
label="&firstButton.label;" disabled="true"/>
<toolbarbutton id="link-prev" class="bookmark-item"
label="&prevButton.label;" disabled="true" tooltip="aTooltip" />
label="&prevButton.label;" disabled="true"/>
<toolbarbutton id="link-next" class="bookmark-item"
label="&nextButton.label;" disabled="true" tooltip="aTooltip" />
label="&nextButton.label;" disabled="true"/>
<toolbarbutton id="link-last" class="bookmark-item"
label="&lastButton.label;" disabled="true" tooltip="aTooltip" />
label="&lastButton.label;" disabled="true"/>
<toolbarseparator />

View File

@ -1329,40 +1329,30 @@ function checkForDirectoryListing()
**/
function FillInHTMLTooltip(tipElement)
{
const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const XLinkNS = "http://www.w3.org/1999/xlink";
const Node = { ELEMENT_NODE : 1 }; // XXX Components.interfaces.Node;
var retVal = false;
var tipNode = document.getElementById("HTML_TOOLTIP_tooltipBox");
try {
while (tipNode.hasChildNodes())
tipNode.removeChild(tipNode.firstChild);
var titleText = "";
var XLinkTitleText = "";
while (!titleText && !XLinkTitleText && tipElement) {
if (tipElement.nodeType == Node.ELEMENT_NODE) {
titleText = tipElement.getAttribute("title");
XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
}
tipElement = tipElement.parentNode;
var titleText = null;
var XLinkTitleText = null;
while (!titleText && !XLinkTitleText && tipElement) {
if (tipElement.nodeType == Node.ELEMENT_NODE) {
titleText = tipElement.getAttribute("title");
XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
}
tipElement = tipElement.parentNode;
}
var texts = [titleText, XLinkTitleText];
var texts = [titleText, XLinkTitleText];
var tipNode = document.getElementById("aHTMLTooltip");
for (var i = 0; i < texts.length; ++i) {
var t = texts[i];
if (t.search(/\S/) >= 0) {
var tipLineElem = tipNode.ownerDocument.createElementNS(XULNS, "text");
tipLineElem.setAttribute("value", t);
tipNode.appendChild(tipLineElem);
retVal = true;
}
for (var i = 0; i < texts.length; ++i) {
var t = texts[i];
if (t && t.search(/\S/) >= 0) {
tipNode.setAttribute("label", t);
retVal = true;
}
} catch (e) {
}
return retVal;

View File

@ -108,9 +108,7 @@ Contributor(s): ______________________________________. -->
</keyset>
<popupset id="aHTMLTooltipSet">
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);" >
<vbox id="HTML_TOOLTIP_tooltipBox"/>
</tooltip>
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
<popup id="backMenu" position="after_start" onpopupshowing="return BrowserBackMenu(event);" oncommand="gotoHistoryIndex(event);"/>
<popup id="forwardMenu" position="after_start" onpopupshowing="return BrowserForwardMenu(event);" oncommand="gotoHistoryIndex(event);"/>
<popup id="sidebarPopup"/>
@ -119,9 +117,6 @@ Contributor(s): ______________________________________. -->
<!-- context menu -->
<popupset id="contentAreaContextSet"/>
<!-- tooltips -->
<popupset id="aTooltipSet"/>
</popupset>
<script type="application/x-javascript">
var gBookmarkPopup = null;
@ -129,12 +124,11 @@ Contributor(s): ______________________________________. -->
<toolbox id="navigator-toolbox" class="toolbox-top" deferattached="true">
<!-- Menu -->
<menubar id="main-menubar" persist="collapsed"
grippytooltip="aTooltip" grippytooltiptext="&menuBar.tooltip;"/>
<menubar id="main-menubar" persist="collapsed" grippytooltiptext="&menuBar.tooltip;"/>
<toolbar class="toolbar-primary chromeclass-toolbar" id="nav-bar" persist="collapsed"
grippytooltip="aTooltip" grippytooltiptext="&navigationToolbar.tooltip;"
tbalign="stretch" tooltip="aTooltip">
grippytooltiptext="&navigationToolbar.tooltip;"
tbalign="stretch">
<hbox id="nav-bar-buttons">
<toolbarbutton id="back-button" type="menu-button" class="toolbarbutton-1"
label="&backButton.label;"
@ -238,8 +232,8 @@ Contributor(s): ______________________________________. -->
ondragdrop="nsDragAndDrop.drop(event, personalToolbarObserver);"
ondraggesture="nsDragAndDrop.startDrag(event, personalToolbarObserver);"
ondragexit="nsDragAndDrop.dragExit(event, personalToolbarObserver);"
grippytooltip="aTooltip" grippytooltiptext="&personalToolbar.tooltip;"
tbalign="stretch" tooltip="aTooltip">
grippytooltiptext="&personalToolbar.tooltip;"
tbalign="stretch">
<toolbarbutton id="home-button" class="bookmark-item"
label="&homeButton.label;" persist="hidden"