зеркало из https://github.com/mozilla/pjs.git
Bug 234638: tooltips for graphical emoticons; p=C��dric "chewey" Menge<bugzilla@mengemail.de>, r/sr=neil
This commit is contained in:
Родитель
afa6232b41
Коммит
24c1f449e8
|
@ -3375,7 +3375,7 @@ function GetSelectionContainer()
|
|||
return result;
|
||||
}
|
||||
|
||||
function FillInHTMLTooltip(tooltip)
|
||||
function FillInHTMLTooltipEditor(tooltip)
|
||||
{
|
||||
const XLinkNS = "http://www.w3.org/1999/xlink";
|
||||
var tooltipText = null;
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
<command id="toggleSidebar"/>
|
||||
</commandset>
|
||||
|
||||
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(this);"/>
|
||||
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltipEditor(this);"/>
|
||||
|
||||
<broadcaster id="args" value="about:blank"/>
|
||||
<broadcaster id="canPrint"/>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<toolbox id="mailToolbarToolbox">
|
||||
<menubar id="mail-menubar"/>
|
||||
</toolbox>
|
||||
|
||||
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
|
||||
|
||||
<!-- msg header view -->
|
||||
<vbox id="messagesBox" flex="1">
|
||||
|
@ -139,7 +141,8 @@
|
|||
<hbox id="msgHeaderView"/>
|
||||
|
||||
<!-- message view -->
|
||||
<browser id="messagepane" context="messagePaneContext"
|
||||
<browser id="messagepane" context="messagePaneContext"
|
||||
tooltip="aHTMLTooltip"
|
||||
style="height: 0px; min-height: 1px" flex="1" name="messagepane"
|
||||
disablesecurity="true" disablehistory="true" type="content-primary"
|
||||
onresize="return messagePaneOnResize(event);" autofind="false"
|
||||
|
|
|
@ -135,6 +135,8 @@
|
|||
</hbox>
|
||||
</popup>
|
||||
|
||||
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
|
||||
|
||||
<popup id="messagePaneContext"/>
|
||||
|
||||
<toolbox id="mailToolbarToolbox" class="toolbox-top">
|
||||
|
@ -186,6 +188,7 @@
|
|||
<hbox id="msgHeaderView"/>
|
||||
|
||||
<browser id="messagepane" name="messagepane" height="0" flex="1"
|
||||
tooltip="aHTMLTooltip"
|
||||
context="messagePaneContext" minwidth="1" minheight="1"
|
||||
disablesecurity="true" disablehistory="true" autofind="false"
|
||||
onresize="return messagePaneOnResize(event);"
|
||||
|
|
|
@ -228,59 +228,3 @@ function getMarkupDocumentViewer()
|
|||
{
|
||||
return getBrowser().markupDocumentViewer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content area tooltip.
|
||||
* XXX - this must move into XBL binding/equiv! Do not want to pollute
|
||||
* navigator.js with functionality that can be encapsulated into
|
||||
* browser widget. TEMPORARY!
|
||||
*
|
||||
* NOTE: Any changes to this routine need to be mirrored in ChromeListener::FindTitleText()
|
||||
* (located in mozilla/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp)
|
||||
* which performs the same function, but for embedded clients that
|
||||
* don't use a XUL/JS layer. It is important that the logic of
|
||||
* these two routines be kept more or less in sync.
|
||||
* (pinkerton)
|
||||
**/
|
||||
function FillInHTMLTooltip(tipElement)
|
||||
{
|
||||
var retVal = false;
|
||||
if (tipElement.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")
|
||||
return retVal;
|
||||
|
||||
const XLinkNS = "http://www.w3.org/1999/xlink";
|
||||
|
||||
|
||||
var titleText = null;
|
||||
var XLinkTitleText = null;
|
||||
var direction = tipElement.ownerDocument.dir;
|
||||
|
||||
while (!titleText && !XLinkTitleText && tipElement) {
|
||||
if (tipElement.nodeType == Node.ELEMENT_NODE) {
|
||||
titleText = tipElement.getAttribute("title");
|
||||
XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
|
||||
var defView = tipElement.ownerDocument.defaultView;
|
||||
// XXX Work around bug 350679:
|
||||
// "Tooltips can be fired in documents with no view".
|
||||
if (!defView)
|
||||
return retVal;
|
||||
direction = defView.getComputedStyle(tipElement, "")
|
||||
.getPropertyValue("direction");
|
||||
}
|
||||
tipElement = tipElement.parentNode;
|
||||
}
|
||||
|
||||
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) {
|
||||
tipNode.setAttribute("label", t);
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
|
|
@ -957,3 +957,59 @@ function getCharsetforSave(aDocument)
|
|||
|
||||
return window.content.document.characterSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content area tooltip.
|
||||
* XXX - this must move into XBL binding/equiv! Do not want to pollute
|
||||
* navigator.js with functionality that can be encapsulated into
|
||||
* browser widget. TEMPORARY!
|
||||
*
|
||||
* NOTE: Any changes to this routine need to be mirrored in ChromeListener::FindTitleText()
|
||||
* (located in mozilla/embedding/browser/webBrowser/nsDocShellTreeOwner.cpp)
|
||||
* which performs the same function, but for embedded clients that
|
||||
* don't use a XUL/JS layer. It is important that the logic of
|
||||
* these two routines be kept more or less in sync.
|
||||
* (pinkerton)
|
||||
**/
|
||||
function FillInHTMLTooltip(tipElement)
|
||||
{
|
||||
var retVal = false;
|
||||
if (tipElement.namespaceURI == "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul")
|
||||
return retVal;
|
||||
|
||||
const XLinkNS = "http://www.w3.org/1999/xlink";
|
||||
|
||||
|
||||
var titleText = null;
|
||||
var XLinkTitleText = null;
|
||||
var direction = tipElement.ownerDocument.dir;
|
||||
|
||||
while (!titleText && !XLinkTitleText && tipElement) {
|
||||
if (tipElement.nodeType == Node.ELEMENT_NODE) {
|
||||
titleText = tipElement.getAttribute("title");
|
||||
XLinkTitleText = tipElement.getAttributeNS(XLinkNS, "title");
|
||||
var defView = tipElement.ownerDocument.defaultView;
|
||||
// XXX Work around bug 350679:
|
||||
// "Tooltips can be fired in documents with no view".
|
||||
if (!defView)
|
||||
return retVal;
|
||||
direction = defView.getComputedStyle(tipElement, "")
|
||||
.getPropertyValue("direction");
|
||||
}
|
||||
tipElement = tipElement.parentNode;
|
||||
}
|
||||
|
||||
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) {
|
||||
tipNode.setAttribute("label", t);
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче