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"> tbautostretch="always" hidden="true" hasitems="false">
<toolbarbutton id="link-top" class="bookmark-item" <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" <toolbarbutton id="link-up" class="bookmark-item"
label="&upButton.label;" disabled="true" tooltip="aTooltip" /> label="&upButton.label;" disabled="true"/>
<toolbarseparator /> <toolbarseparator />
<toolbarbutton id="link-first" class="bookmark-item" <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" <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" <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" <toolbarbutton id="link-last" class="bookmark-item"
label="&lastButton.label;" disabled="true" tooltip="aTooltip" /> label="&lastButton.label;" disabled="true"/>
<toolbarseparator /> <toolbarseparator />

View File

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

View File

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