mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
6cfd64d931
- Bug 1195173 - Test asyncopen2 security checks for stylesheets (r=bz,ehsan) (358ae850a4) - Bug 1223644 - Clean up the nsSVGClipPathFrame reference loop detection code. r=longsonr (65042c3148) - Bug 1157064 - font-display descriptor parsing. r=dbaron (18f63d9244) - Bug 1242523 - Guard against GetWidget getting called with a null shell. r=snorp (55de891c6c) - Bug 1247679, part 3 - Replace NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK with JS_MEMBER. r=smaug (09435e582c) - Bug 1247515 - Check nsScriptErrorWithStack's mStack member for null before tracing; r=mccr8 (0cb1e09aa9) - Bug 1178803. Fix the handling of the 'length' key in IDB keypaths when operating on a string. r=bent (69f15272a8) - Bug 1201037 - coalesce network-events on Windows, r=mcmanus (5f48aab5c3) - Bug 1131626, fix autoscroll tests to work in e10s, r=felipe (c47adbaa10) - Bug 1231529 - Increase the timeout of browser_bug295977_autoscroll_overflow.js (691d27224d) - Bug 416611 - Changed BookmarkHTMLUtils.jsm to import bookmark tags from HTML document. r=mak (49a0accc13) - Bug 1130858 - Recipient autocomplete suggestion overrides ANY manual address input if quickly entered/pasted and confirmed with Enter/Tab before autocomplete suggestions disappear. r=mak (308196e116) - Bug 1197361. Optimize page thumbnails based on screen size. r=ttaubert (29dca20366) - Bug 555087 - Add check for exception when passing undefined parameter. r=adw (3588477c56) - Bug 1203803: Force cleanup for specific states only; r=khuey a=CLOSED TREE (2f9f78ad72) - Bug 1203803 - Remove forced cleanup from FactoryOp::ActorDestroy() since it cause more harm than good; r=khuey (76a00e58cb) - Bug 1195149 - Upgrade the check to a MOZ_RELEASE_ASSERT. r=janv (071d1fc267) - Bug 1185223 - crash at [@ mozilla::dom::quota::QuotaObject::Release() ]; r=khuey (d460972a45) - Bug 1229376 - Downgrade lastVacuumSize > 0 assertion to an NS_ASSERTION so we don't have to star it all over the place, rs=khuey (81d715ab71) - Bug 1239666 - part 1, get rid of the default parameter. r=waldo (639fb79ec3) - Bug 1239666 - part 2, dom/indexedDB change. r=khuey (6faaf25df4) - Bug 1239666 - part 3, devtools test case changes. r=sphink (c010d06a77) - Bug 1248309 - Fix caret size not updated when only zoom level is changed. r=roc (91cc5b35df) - Bug 1245649: Turn on no-trailing-spaces. r=Gijs (7f87c967af) - Bug 1245649: Enable no-negated-in-lhs, no-native-reassign, no-func-assign and no-labels. r=MattN (5f801e4a4c) - Bug 1197966 - Fix typo when releasing content-side probes in PerformanceStats-content.js. r=felipe (9241324efd) - Bug 1219144 - Performance alerts are now labelled with isJankVisible; r=avih,froydnj (c1549a24f5) - Bug 1219144 - Using the nsRefreshDriver's jank indication for performance monitoring;f?froydnj r=froydnj (735c6fba9c) - Bug 1211783 - Add KeyframeEffect interface to dom/webidl/KeyframeEffect.webidl. r=smaug,birtles (fca332fea0) - Bug 795681 - Print out failures in mozunit runner. r=gps (ce418e5ea8) - Bug 801679 - Handle expected failures and skipped tests in mozunit runner. r=gps (396ca02893) - Bug 1247833 - Display the class name in mozunit output. r=gps (0b5724f41c) - Bug 1245022 - Kill stlport's Makefile.in. r=mshal (225f662efc) - Bug 1194603 - Remove INTERNAL_TOOLS; r=mshal (e8e90ec1c3) - Bug 1247743 - Expose non-pinning JS_Atomize[UC]String JSAPI functions; r=terrence (66aa23066d) - Bug 1230071 - Enable warnings-as-errors in js/src. r=Waldo (a0c8acf6ad) - Bug 1007136 - Ensure malloc/free always match when using JSAutoByteString; r=bz (81dfcf036a) - Bug 1246850 - check the NotifyIpInterfaceChange() return code, r=mcmanus (bc224f287c) - Bug 739029 - null check a thread allocation in notifyaddrlistener r=bagder (ce0ddfc44c)
646 lines
26 KiB
XML
646 lines
26 KiB
XML
<?xml version="1.0"?>
|
|
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
|
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
|
|
|
|
|
<!DOCTYPE bindings [
|
|
<!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" >
|
|
%textcontextDTD;
|
|
]>
|
|
|
|
<bindings id="textboxBindings"
|
|
xmlns="http://www.mozilla.org/xbl"
|
|
xmlns:html="http://www.w3.org/1999/xhtml"
|
|
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
|
xmlns:xbl="http://www.mozilla.org/xbl">
|
|
|
|
<binding id="textbox" extends="xul:box" role="xul:textbox">
|
|
<resources>
|
|
<stylesheet src="chrome://global/content/textbox.css"/>
|
|
<stylesheet src="chrome://global/skin/textbox.css"/>
|
|
</resources>
|
|
|
|
<content>
|
|
<children/>
|
|
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context,spellcheck">
|
|
<html:input class="textbox-input" anonid="input"
|
|
xbl:inherits="value,type,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey,noinitialfocus,mozactionhint,spellcheck"/>
|
|
</xul:hbox>
|
|
</content>
|
|
|
|
<implementation implements="nsIDOMXULTextBoxElement, nsIDOMXULLabeledControlElement">
|
|
<!-- nsIDOMXULLabeledControlElement -->
|
|
<field name="crop">""</field>
|
|
<field name="image">""</field>
|
|
<field name="command">""</field>
|
|
<field name="accessKey">""</field>
|
|
|
|
<field name="mInputField">null</field>
|
|
<field name="mIgnoreClick">false</field>
|
|
<field name="mIgnoreFocus">false</field>
|
|
<field name="mEditor">null</field>
|
|
|
|
<property name="inputField" readonly="true">
|
|
<getter><![CDATA[
|
|
if (!this.mInputField)
|
|
this.mInputField = document.getAnonymousElementByAttribute(this, "anonid", "input");
|
|
return this.mInputField;
|
|
]]></getter>
|
|
</property>
|
|
|
|
<property name="value" onset="this.inputField.value = val; return val;"
|
|
onget="return this.inputField.value;"/>
|
|
<property name="defaultValue" onset="this.inputField.defaultValue = val; return val;"
|
|
onget="return this.inputField.defaultValue;"/>
|
|
<property name="label" onset="this.setAttribute('label', val); return val;"
|
|
onget="return this.getAttribute('label') ||
|
|
(this.labelElement ? this.labelElement.value :
|
|
this.placeholder);"/>
|
|
<property name="placeholder" onset="this.inputField.placeholder = val; return val;"
|
|
onget="return this.inputField.placeholder;"/>
|
|
<property name="emptyText" onset="this.placeholder = val; return val;"
|
|
onget="return this.placeholder;"/>
|
|
<property name="type" onset="if (val) this.setAttribute('type', val);
|
|
else this.removeAttribute('type'); return val;"
|
|
onget="return this.getAttribute('type');"/>
|
|
<property name="maxLength" onset="this.inputField.maxLength = val; return val;"
|
|
onget="return this.inputField.maxLength;"/>
|
|
<property name="disabled" onset="this.inputField.disabled = val;
|
|
if (val) this.setAttribute('disabled', 'true');
|
|
else this.removeAttribute('disabled'); return val;"
|
|
onget="return this.inputField.disabled;"/>
|
|
<property name="tabIndex" onget="return parseInt(this.getAttribute('tabindex'));"
|
|
onset="this.inputField.tabIndex = val;
|
|
if (val) this.setAttribute('tabindex', val);
|
|
else this.removeAttribute('tabindex'); return val;"/>
|
|
<property name="size" onset="this.inputField.size = val; return val;"
|
|
onget="return this.inputField.size;"/>
|
|
<property name="readOnly" onset="this.inputField.readOnly = val;
|
|
if (val) this.setAttribute('readonly', 'true');
|
|
else this.removeAttribute('readonly'); return val;"
|
|
onget="return this.inputField.readOnly;"/>
|
|
<property name="clickSelectsAll"
|
|
onget="return this.getAttribute('clickSelectsAll') == 'true';"
|
|
onset="if (val) this.setAttribute('clickSelectsAll', 'true');
|
|
else this.removeAttribute('clickSelectsAll'); return val;" />
|
|
|
|
<property name="editor" readonly="true">
|
|
<getter><![CDATA[
|
|
if (!this.mEditor) {
|
|
const nsIDOMNSEditableElement = Components.interfaces.nsIDOMNSEditableElement;
|
|
this.mEditor = this.inputField.QueryInterface(nsIDOMNSEditableElement).editor;
|
|
}
|
|
return this.mEditor;
|
|
]]></getter>
|
|
</property>
|
|
|
|
<method name="reset">
|
|
<body><![CDATA[
|
|
this.value = this.defaultValue;
|
|
try {
|
|
this.editor.transactionManager.clear();
|
|
return true;
|
|
}
|
|
catch(e) {}
|
|
return false;
|
|
]]></body>
|
|
</method>
|
|
|
|
<method name="select">
|
|
<body>
|
|
this.inputField.select();
|
|
</body>
|
|
</method>
|
|
|
|
<property name="controllers" readonly="true" onget="return this.inputField.controllers"/>
|
|
<property name="textLength" readonly="true"
|
|
onget="return this.inputField.textLength;"/>
|
|
<property name="selectionStart" onset="this.inputField.selectionStart = val; return val;"
|
|
onget="return this.inputField.selectionStart;"/>
|
|
<property name="selectionEnd" onset="this.inputField.selectionEnd = val; return val;"
|
|
onget="return this.inputField.selectionEnd;"/>
|
|
|
|
<method name="setSelectionRange">
|
|
<parameter name="aSelectionStart"/>
|
|
<parameter name="aSelectionEnd"/>
|
|
<body>
|
|
this.inputField.setSelectionRange( aSelectionStart, aSelectionEnd );
|
|
</body>
|
|
</method>
|
|
|
|
<method name="_setNewlineHandling">
|
|
<body><![CDATA[
|
|
var str = this.getAttribute("newlines");
|
|
if (str && this.editor) {
|
|
const nsIPlaintextEditor = Components.interfaces.nsIPlaintextEditor;
|
|
for (var x in nsIPlaintextEditor) {
|
|
if (/^eNewlines/.test(x)) {
|
|
if (str == RegExp.rightContext.toLowerCase()) {
|
|
this.editor.QueryInterface(nsIPlaintextEditor)
|
|
.newlineHandling = nsIPlaintextEditor[x];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]]></body>
|
|
</method>
|
|
|
|
<method name="_maybeSelectAll">
|
|
<body><![CDATA[
|
|
if (!this.mIgnoreClick && this.clickSelectsAll &&
|
|
document.activeElement == this.inputField &&
|
|
this.inputField.selectionStart == this.inputField.selectionEnd)
|
|
this.editor.selectAll();
|
|
]]></body>
|
|
</method>
|
|
|
|
<constructor><![CDATA[
|
|
var str = this.boxObject.getProperty("value");
|
|
if (str) {
|
|
this.inputField.value = str;
|
|
this.boxObject.removeProperty("value");
|
|
}
|
|
|
|
this._setNewlineHandling();
|
|
|
|
if (this.hasAttribute("emptytext"))
|
|
this.placeholder = this.getAttribute("emptytext");
|
|
]]></constructor>
|
|
|
|
<destructor>
|
|
<![CDATA[
|
|
if (this.inputField.value)
|
|
this.boxObject.setProperty('value', this.inputField.value);
|
|
this.mInputField = null;
|
|
]]>
|
|
</destructor>
|
|
|
|
</implementation>
|
|
|
|
<handlers>
|
|
<handler event="focus" phase="capturing">
|
|
<![CDATA[
|
|
if (this.hasAttribute("focused"))
|
|
return;
|
|
|
|
switch (event.originalTarget) {
|
|
case this:
|
|
// Forward focus to actual HTML input
|
|
this.inputField.focus();
|
|
break;
|
|
case this.inputField:
|
|
if (this.mIgnoreFocus) {
|
|
this.mIgnoreFocus = false;
|
|
} else if (this.clickSelectsAll) {
|
|
try {
|
|
const nsIEditorIMESupport =
|
|
Components.interfaces.nsIEditorIMESupport;
|
|
let imeEditor = this.editor.QueryInterface(nsIEditorIMESupport);
|
|
if (!imeEditor || !imeEditor.composing)
|
|
this.editor.selectAll();
|
|
} catch (e) {}
|
|
}
|
|
break;
|
|
default:
|
|
// Allow other children (e.g. URL bar buttons) to get focus
|
|
return;
|
|
}
|
|
this.setAttribute("focused", "true");
|
|
]]>
|
|
</handler>
|
|
|
|
<handler event="blur" phase="capturing">
|
|
<![CDATA[
|
|
this.removeAttribute("focused");
|
|
|
|
// don't trigger clickSelectsAll when switching application windows
|
|
if (window == window.top &&
|
|
window.constructor == ChromeWindow &&
|
|
document.activeElement == this.inputField)
|
|
this.mIgnoreFocus = true;
|
|
]]>
|
|
</handler>
|
|
|
|
<handler event="mousedown">
|
|
<![CDATA[
|
|
this.mIgnoreClick = this.hasAttribute("focused");
|
|
|
|
if (!this.mIgnoreClick) {
|
|
this.mIgnoreFocus = true;
|
|
this.inputField.setSelectionRange(0, 0);
|
|
if (event.originalTarget == this ||
|
|
event.originalTarget == this.inputField.parentNode)
|
|
this.inputField.focus();
|
|
}
|
|
]]>
|
|
</handler>
|
|
|
|
<handler event="click" action="this._maybeSelectAll();"/>
|
|
|
|
#ifndef XP_WIN
|
|
<handler event="contextmenu">
|
|
// Only care about context clicks on the textbox itself.
|
|
if (event.target != this)
|
|
return;
|
|
|
|
if (!event.button) // context menu opened via keyboard shortcut
|
|
return;
|
|
this._maybeSelectAll();
|
|
// see bug 576135 comment 4
|
|
let box = this.inputField.parentNode;
|
|
let menu = document.getAnonymousElementByAttribute(box, "anonid", "input-box-contextmenu");
|
|
box._doPopupItemEnabling(menu);
|
|
</handler>
|
|
#endif
|
|
</handlers>
|
|
</binding>
|
|
|
|
<binding id="timed-textbox" extends="chrome://global/content/bindings/textbox.xml#textbox">
|
|
<implementation>
|
|
<constructor><![CDATA[
|
|
try {
|
|
var consoleService = Components.classes["@mozilla.org/consoleservice;1"]
|
|
.getService(Components.interfaces.nsIConsoleService);
|
|
var scriptError = Components.classes["@mozilla.org/scripterror;1"]
|
|
.createInstance(Components.interfaces.nsIScriptError);
|
|
scriptError.init("Timed textboxes are deprecated. Consider using type=\"search\" instead.",
|
|
this.ownerDocument.location.href, null, null,
|
|
null, scriptError.warningFlag, "XUL Widgets");
|
|
consoleService.logMessage(scriptError);
|
|
} catch (e) {}
|
|
]]></constructor>
|
|
<field name="_timer">null</field>
|
|
<property name="timeout"
|
|
onset="this.setAttribute('timeout', val); return val;"
|
|
onget="return parseInt(this.getAttribute('timeout')) || 0;"/>
|
|
<property name="value"
|
|
onget="return this.inputField.value;">
|
|
<setter><![CDATA[
|
|
this.inputField.value = val;
|
|
if (this._timer)
|
|
clearTimeout(this._timer);
|
|
return val;
|
|
]]></setter>
|
|
</property>
|
|
<method name="_fireCommand">
|
|
<parameter name="me"/>
|
|
<body>
|
|
<![CDATA[
|
|
me._timer = null;
|
|
me.doCommand();
|
|
]]>
|
|
</body>
|
|
</method>
|
|
</implementation>
|
|
<handlers>
|
|
<handler event="input">
|
|
<![CDATA[
|
|
if (this._timer)
|
|
clearTimeout(this._timer);
|
|
this._timer = this.timeout && setTimeout(this._fireCommand, this.timeout, this);
|
|
]]>
|
|
</handler>
|
|
<handler event="keypress" keycode="VK_RETURN">
|
|
<![CDATA[
|
|
if (this._timer)
|
|
clearTimeout(this._timer);
|
|
this._fireCommand(this);
|
|
event.preventDefault();
|
|
]]>
|
|
</handler>
|
|
</handlers>
|
|
</binding>
|
|
|
|
<binding id="search-textbox" extends="chrome://global/content/bindings/textbox.xml#textbox">
|
|
<content>
|
|
<children/>
|
|
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context,spellcheck" align="center">
|
|
<html:input class="textbox-input" anonid="input" mozactionhint="search"
|
|
xbl:inherits="value,type,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey,mozactionhint,spellcheck"/>
|
|
<xul:deck class="textbox-search-icons" anonid="search-icons">
|
|
<xul:image class="textbox-search-icon" anonid="searchbutton-icon"
|
|
xbl:inherits="src=image,label=searchbuttonlabel,searchbutton,disabled"/>
|
|
<xul:image class="textbox-search-clear"
|
|
onclick="document.getBindingParent(this)._clearSearch();"
|
|
label="&searchTextBox.clear.label;"
|
|
xbl:inherits="disabled"/>
|
|
</xul:deck>
|
|
</xul:hbox>
|
|
</content>
|
|
<implementation>
|
|
<field name="_timer">null</field>
|
|
<field name="_searchIcons">
|
|
document.getAnonymousElementByAttribute(this, "anonid", "search-icons");
|
|
</field>
|
|
<field name="_searchButtonIcon">
|
|
document.getAnonymousElementByAttribute(this, "anonid", "searchbutton-icon");
|
|
</field>
|
|
<property name="timeout"
|
|
onset="this.setAttribute('timeout', val); return val;"
|
|
onget="return parseInt(this.getAttribute('timeout')) || 500;"/>
|
|
<property name="searchButton"
|
|
onget="return this.getAttribute('searchbutton') == 'true';">
|
|
<setter><![CDATA[
|
|
if (val) {
|
|
this.setAttribute("searchbutton", "true");
|
|
this.removeAttribute("aria-autocomplete");
|
|
// Hack for the button to get the right accessible:
|
|
this._searchButtonIcon.setAttribute("onclick", "true");
|
|
} else {
|
|
this.removeAttribute("searchbutton");
|
|
this._searchButtonIcon.removeAttribute("onclick");
|
|
this.setAttribute("aria-autocomplete", "list");
|
|
}
|
|
return val;
|
|
]]></setter>
|
|
</property>
|
|
<property name="value"
|
|
onget="return this.inputField.value;">
|
|
<setter><![CDATA[
|
|
this.inputField.value = val;
|
|
|
|
if (val)
|
|
this._searchIcons.selectedIndex = this.searchButton ? 0 : 1;
|
|
else
|
|
this._searchIcons.selectedIndex = 0;
|
|
|
|
if (this._timer)
|
|
clearTimeout(this._timer);
|
|
|
|
return val;
|
|
]]></setter>
|
|
</property>
|
|
<constructor><![CDATA[
|
|
// Ensure the button state is up to date:
|
|
this.searchButton = this.searchButton;
|
|
this._searchButtonIcon.addEventListener("click", (e) => this._iconClick(e), false);
|
|
]]></constructor>
|
|
<method name="_fireCommand">
|
|
<parameter name="me"/>
|
|
<body><![CDATA[
|
|
if (me._timer)
|
|
clearTimeout(me._timer);
|
|
me._timer = null;
|
|
me.doCommand();
|
|
]]></body>
|
|
</method>
|
|
<method name="_iconClick">
|
|
<body><![CDATA[
|
|
if (this.searchButton)
|
|
this._enterSearch();
|
|
else
|
|
this.focus();
|
|
]]></body>
|
|
</method>
|
|
<method name="_enterSearch">
|
|
<body><![CDATA[
|
|
if (this.disabled)
|
|
return;
|
|
if (this.searchButton && this.value && !this.readOnly)
|
|
this._searchIcons.selectedIndex = 1;
|
|
this._fireCommand(this);
|
|
]]></body>
|
|
</method>
|
|
<method name="_clearSearch">
|
|
<body><![CDATA[
|
|
if (!this.disabled && !this.readOnly && this.value) {
|
|
this.value = "";
|
|
this._fireCommand(this);
|
|
this._searchIcons.selectedIndex = 0;
|
|
return true;
|
|
}
|
|
return false;
|
|
]]></body>
|
|
</method>
|
|
</implementation>
|
|
<handlers>
|
|
<handler event="input">
|
|
<![CDATA[
|
|
if (this.searchButton) {
|
|
this._searchIcons.selectedIndex = 0;
|
|
return;
|
|
}
|
|
if (this._timer)
|
|
clearTimeout(this._timer);
|
|
this._timer = this.timeout && setTimeout(this._fireCommand, this.timeout, this);
|
|
this._searchIcons.selectedIndex = this.value ? 1 : 0;
|
|
]]>
|
|
</handler>
|
|
<handler event="keypress" keycode="VK_ESCAPE">
|
|
<![CDATA[
|
|
if (this._clearSearch()) {
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
}
|
|
]]>
|
|
</handler>
|
|
<handler event="keypress" keycode="VK_RETURN">
|
|
<![CDATA[
|
|
this._enterSearch();
|
|
event.preventDefault();
|
|
event.stopPropagation();
|
|
]]>
|
|
</handler>
|
|
</handlers>
|
|
</binding>
|
|
|
|
<binding id="textarea" extends="chrome://global/content/bindings/textbox.xml#textbox">
|
|
<content>
|
|
<xul:hbox class="textbox-input-box" flex="1" xbl:inherits="context,spellcheck">
|
|
<html:textarea class="textbox-textarea" anonid="input"
|
|
xbl:inherits="xbl:text=value,disabled,tabindex,rows,cols,readonly,wrap,placeholder,mozactionhint,spellcheck"><children/></html:textarea>
|
|
</xul:hbox>
|
|
</content>
|
|
</binding>
|
|
|
|
<binding id="input-box">
|
|
<content context="_child">
|
|
<children/>
|
|
<xul:menupopup anonid="input-box-contextmenu"
|
|
class="textbox-contextmenu"
|
|
onpopupshowing="var input =
|
|
this.parentNode.getElementsByAttribute('anonid', 'input')[0];
|
|
if (document.commandDispatcher.focusedElement != input)
|
|
input.focus();
|
|
this.parentNode._doPopupItemEnabling(this);"
|
|
oncommand="var cmd = event.originalTarget.getAttribute('cmd'); if(cmd) { this.parentNode.doCommand(cmd); event.stopPropagation(); }">
|
|
<xul:menuitem label="&undoCmd.label;" accesskey="&undoCmd.accesskey;" cmd="cmd_undo"/>
|
|
<xul:menuseparator/>
|
|
<xul:menuitem label="&cutCmd.label;" accesskey="&cutCmd.accesskey;" cmd="cmd_cut"/>
|
|
<xul:menuitem label="©Cmd.label;" accesskey="©Cmd.accesskey;" cmd="cmd_copy"/>
|
|
<xul:menuitem label="&pasteCmd.label;" accesskey="&pasteCmd.accesskey;" cmd="cmd_paste"/>
|
|
<xul:menuitem label="&deleteCmd.label;" accesskey="&deleteCmd.accesskey;" cmd="cmd_delete"/>
|
|
<xul:menuseparator/>
|
|
<xul:menuitem label="&selectAllCmd.label;" accesskey="&selectAllCmd.accesskey;" cmd="cmd_selectAll"/>
|
|
</xul:menupopup>
|
|
</content>
|
|
|
|
<implementation>
|
|
<method name="_doPopupItemEnabling">
|
|
<parameter name="popupNode"/>
|
|
<body>
|
|
<![CDATA[
|
|
var children = popupNode.childNodes;
|
|
for (var i = 0; i < children.length; i++) {
|
|
var command = children[i].getAttribute("cmd");
|
|
if (command) {
|
|
var controller = document.commandDispatcher.getControllerForCommand(command);
|
|
var enabled = controller.isCommandEnabled(command);
|
|
if (enabled)
|
|
children[i].removeAttribute("disabled");
|
|
else
|
|
children[i].setAttribute("disabled", "true");
|
|
}
|
|
}
|
|
]]>
|
|
</body>
|
|
</method>
|
|
|
|
<method name="_setMenuItemVisibility">
|
|
<parameter name="anonid"/>
|
|
<parameter name="visible"/>
|
|
<body><![CDATA[
|
|
document.getAnonymousElementByAttribute(this, "anonid", anonid).
|
|
hidden = ! visible;
|
|
]]></body>
|
|
</method>
|
|
|
|
<method name="doCommand">
|
|
<parameter name="command"/>
|
|
<body>
|
|
<![CDATA[
|
|
var controller = document.commandDispatcher.getControllerForCommand(command);
|
|
controller.doCommand(command);
|
|
]]>
|
|
</body>
|
|
</method>
|
|
</implementation>
|
|
</binding>
|
|
|
|
<binding id="input-box-spell" extends="chrome://global/content/bindings/textbox.xml#input-box">
|
|
<content context="_child">
|
|
<children/>
|
|
<xul:menupopup anonid="input-box-contextmenu"
|
|
class="textbox-contextmenu"
|
|
onpopupshowing="var input =
|
|
this.parentNode.getElementsByAttribute('anonid', 'input')[0];
|
|
if (document.commandDispatcher.focusedElement != input)
|
|
input.focus();
|
|
this.parentNode._doPopupItemEnablingSpell(this);"
|
|
onpopuphiding="this.parentNode._doPopupItemDisabling(this);"
|
|
oncommand="var cmd = event.originalTarget.getAttribute('cmd'); if(cmd) { this.parentNode.doCommand(cmd); event.stopPropagation(); }">
|
|
<xul:menuitem label="&spellNoSuggestions.label;" anonid="spell-no-suggestions" disabled="true"/>
|
|
<xul:menuitem label="&spellAddToDictionary.label;" accesskey="&spellAddToDictionary.accesskey;" anonid="spell-add-to-dictionary"
|
|
oncommand="this.parentNode.parentNode.spellCheckerUI.addToDictionary();"/>
|
|
<xul:menuitem label="&spellUndoAddToDictionary.label;" accesskey="&spellUndoAddToDictionary.accesskey;" anonid="spell-undo-add-to-dictionary"
|
|
oncommand="this.parentNode.parentNode.spellCheckerUI.undoAddToDictionary();"/>
|
|
<xul:menuseparator anonid="spell-suggestions-separator"/>
|
|
<xul:menuitem label="&undoCmd.label;" accesskey="&undoCmd.accesskey;" cmd="cmd_undo"/>
|
|
<xul:menuseparator/>
|
|
<xul:menuitem label="&cutCmd.label;" accesskey="&cutCmd.accesskey;" cmd="cmd_cut"/>
|
|
<xul:menuitem label="©Cmd.label;" accesskey="©Cmd.accesskey;" cmd="cmd_copy"/>
|
|
<xul:menuitem label="&pasteCmd.label;" accesskey="&pasteCmd.accesskey;" cmd="cmd_paste"/>
|
|
<xul:menuitem label="&deleteCmd.label;" accesskey="&deleteCmd.accesskey;" cmd="cmd_delete"/>
|
|
<xul:menuseparator/>
|
|
<xul:menuitem label="&selectAllCmd.label;" accesskey="&selectAllCmd.accesskey;" cmd="cmd_selectAll"/>
|
|
<xul:menuseparator anonid="spell-check-separator"/>
|
|
<xul:menuitem label="&spellCheckToggle.label;" type="checkbox" accesskey="&spellCheckToggle.accesskey;" anonid="spell-check-enabled"
|
|
oncommand="this.parentNode.parentNode.spellCheckerUI.toggleEnabled();"/>
|
|
<xul:menu label="&spellDictionaries.label;" accesskey="&spellDictionaries.accesskey;" anonid="spell-dictionaries">
|
|
<xul:menupopup anonid="spell-dictionaries-menu"
|
|
onpopupshowing="event.stopPropagation();"
|
|
onpopuphiding="event.stopPropagation();"/>
|
|
</xul:menu>
|
|
</xul:menupopup>
|
|
</content>
|
|
|
|
<implementation>
|
|
<field name="_spellCheckInitialized">false</field>
|
|
<field name="_enabledCheckbox">
|
|
document.getAnonymousElementByAttribute(this, "anonid", "spell-check-enabled");
|
|
</field>
|
|
<field name="_suggestionsSeparator">
|
|
document.getAnonymousElementByAttribute(this, "anonid", "spell-no-suggestions");
|
|
</field>
|
|
<field name="_dictionariesMenu">
|
|
document.getAnonymousElementByAttribute(this, "anonid", "spell-dictionaries-menu");
|
|
</field>
|
|
|
|
<property name="spellCheckerUI" readonly="true">
|
|
<getter><![CDATA[
|
|
if (!this._spellCheckInitialized) {
|
|
this._spellCheckInitialized = true;
|
|
|
|
const CI = Components.interfaces;
|
|
if (!(document instanceof CI.nsIDOMXULDocument))
|
|
return null;
|
|
|
|
var textbox = document.getBindingParent(this);
|
|
if (!textbox || !(textbox instanceof CI.nsIDOMXULTextBoxElement))
|
|
return null;
|
|
|
|
try {
|
|
Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm", this);
|
|
this.InlineSpellCheckerUI = new this.InlineSpellChecker(textbox.editor);
|
|
} catch(ex) { }
|
|
}
|
|
|
|
return this.InlineSpellCheckerUI;
|
|
]]></getter>
|
|
</property>
|
|
|
|
<method name="_doPopupItemEnablingSpell">
|
|
<parameter name="popupNode"/>
|
|
<body>
|
|
<![CDATA[
|
|
var spellui = this.spellCheckerUI;
|
|
if (!spellui || !spellui.canSpellCheck) {
|
|
this._setMenuItemVisibility("spell-no-suggestions", false);
|
|
this._setMenuItemVisibility("spell-check-enabled", false);
|
|
this._setMenuItemVisibility("spell-check-separator", false);
|
|
this._setMenuItemVisibility("spell-add-to-dictionary", false);
|
|
this._setMenuItemVisibility("spell-undo-add-to-dictionary", false);
|
|
this._setMenuItemVisibility("spell-suggestions-separator", false);
|
|
this._setMenuItemVisibility("spell-dictionaries", false);
|
|
return;
|
|
}
|
|
|
|
spellui.initFromEvent(document.popupRangeParent,
|
|
document.popupRangeOffset);
|
|
|
|
var enabled = spellui.enabled;
|
|
var showUndo = spellui.canSpellCheck && spellui.canUndo();
|
|
this._enabledCheckbox.setAttribute("checked", enabled);
|
|
|
|
var overMisspelling = spellui.overMisspelling;
|
|
this._setMenuItemVisibility("spell-add-to-dictionary", overMisspelling);
|
|
this._setMenuItemVisibility("spell-undo-add-to-dictionary", showUndo);
|
|
this._setMenuItemVisibility("spell-suggestions-separator", overMisspelling || showUndo);
|
|
|
|
// suggestion list
|
|
var numsug = spellui.addSuggestionsToMenu(popupNode, this._suggestionsSeparator, 5);
|
|
this._setMenuItemVisibility("spell-no-suggestions", overMisspelling && numsug == 0);
|
|
|
|
// dictionary list
|
|
var numdicts = spellui.addDictionaryListToMenu(this._dictionariesMenu, null);
|
|
this._setMenuItemVisibility("spell-dictionaries", enabled && numdicts > 1);
|
|
|
|
this._doPopupItemEnabling(popupNode);
|
|
]]>
|
|
</body>
|
|
</method>
|
|
<method name="_doPopupItemDisabling">
|
|
<body><![CDATA[
|
|
if (this.spellCheckerUI) {
|
|
this.spellCheckerUI.clearSuggestionsFromMenu();
|
|
this.spellCheckerUI.clearDictionaryListFromMenu();
|
|
}
|
|
]]></body>
|
|
</method>
|
|
</implementation>
|
|
</binding>
|
|
|
|
</bindings>
|