mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 482921 part 9 - Support tooltips in the View Source window. r=gavin.sharp.
This commit is contained in:
parent
256c728c79
commit
8fd1c9834b
@ -771,3 +771,39 @@ function UpdateBackForwardCommands() {
|
||||
else
|
||||
forwardBroadcaster.setAttribute("disabled", "true");
|
||||
}
|
||||
|
||||
// FIXME copied and modified from browser.js.
|
||||
// Deduplication is part of bug 480356.
|
||||
function FillInHTMLTooltip(tipElement)
|
||||
{
|
||||
var retVal = false;
|
||||
var titleText = null;
|
||||
var direction = tipElement.ownerDocument.dir;
|
||||
|
||||
while (!titleText && tipElement) {
|
||||
if (tipElement.nodeType == Node.ELEMENT_NODE) {
|
||||
titleText = tipElement.getAttribute("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 tipNode = document.getElementById("aHTMLTooltip");
|
||||
tipNode.style.direction = direction;
|
||||
|
||||
if (titleText && /\S/.test(titleText)) {
|
||||
// Make CRLF and CR render one line break each.
|
||||
titleText = titleText.replace(/\r\n/g, '\n');
|
||||
titleText = titleText.replace(/\r/g, '\n');
|
||||
tipNode.setAttribute("label", titleText);
|
||||
retVal = true;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
@ -142,6 +142,8 @@
|
||||
|
||||
</keyset>
|
||||
|
||||
<tooltip id="aHTMLTooltip" onpopupshowing="return FillInHTMLTooltip(document.tooltipNode);"/>
|
||||
|
||||
<menupopup id="viewSourceContextMenu">
|
||||
<menuitem id="context-back"
|
||||
label="&backCmd.label;"
|
||||
@ -236,7 +238,7 @@
|
||||
<vbox id="appcontent" flex="1">
|
||||
|
||||
<browser id="content" type="content-primary" name="content" src="about:blank" flex="1"
|
||||
context="viewSourceContextMenu" showcaret="true"/>
|
||||
context="viewSourceContextMenu" showcaret="true" tooltip="aHTMLTooltip"/>
|
||||
<findbar id="FindToolbar" browserid="content"/>
|
||||
</vbox>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user