diff options
Diffstat (limited to 'toolkit/content')
-rw-r--r-- | toolkit/content/dialogOverlay.js | 107 | ||||
-rw-r--r-- | toolkit/content/dialogOverlay.xul | 101 | ||||
-rw-r--r-- | toolkit/content/globalOverlay.xul | 38 | ||||
-rw-r--r-- | toolkit/content/inlineSpellCheckUI.js | 7 | ||||
-rw-r--r-- | toolkit/content/jar.mn | 7 | ||||
-rw-r--r-- | toolkit/content/license.html | 31 | ||||
-rw-r--r-- | toolkit/content/moz.build | 3 | ||||
-rw-r--r-- | toolkit/content/mozilla.xhtml | 6 | ||||
-rw-r--r-- | toolkit/content/nsClipboard.js | 64 | ||||
-rw-r--r-- | toolkit/content/nsUserSettings.js | 108 | ||||
-rw-r--r-- | toolkit/content/strres.js | 28 | ||||
-rw-r--r-- | toolkit/content/tests/widgets/test_videocontrols.html | 2 |
12 files changed, 495 insertions, 7 deletions
diff --git a/toolkit/content/dialogOverlay.js b/toolkit/content/dialogOverlay.js new file mode 100644 index 000000000..4b03f268f --- /dev/null +++ b/toolkit/content/dialogOverlay.js @@ -0,0 +1,107 @@ +/* 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/. */ + +var doOKFunction = 0; +var doCancelFunction = 0; +var doButton2Function = 0; +var doButton3Function = 0; + +// call this from dialog onload() to allow ok and cancel to call your code +// functions should return true if they want the dialog to close +function doSetOKCancel(okFunc, cancelFunc, button2Func, button3Func ) +{ + //dump("top.window.navigator.platform: " + top.window.navigator.platform + "\n"); + + doOKFunction = okFunc; + doCancelFunction = cancelFunc; + doButton2Function = button2Func; + doButton3Function = button3Func; +} + +function doOKButton() +{ + var close = true; + + if ( doOKFunction ) + close = doOKFunction(); + + if (close && top) + top.window.close(); +} + +function doCancelButton() +{ + var close = true; + + if ( doCancelFunction ) + close = doCancelFunction(); + + if (close && top) + top.window.close(); +} + +function doButton2() +{ + var close = true; + + if ( doButton2Function ) + close = doButton2Function(); + + if (close && top) + top.window.close(); +} + +function doButton3() +{ + var close = true; + + if ( doButton3Function ) + close = doButton3Function(); + + if (close && top) + top.window.close(); +} + +function moveToAlertPosition() +{ + // hack. we need this so the window has something like its final size + if (window.outerWidth == 1) { + dump("Trying to position a sizeless window; caller should have called sizeToContent() or sizeTo(). See bug 75649.\n"); + sizeToContent(); + } + + if (opener) { + var xOffset = (opener.outerWidth - window.outerWidth) / 2; + var yOffset = opener.outerHeight / 5; + + var newX = opener.screenX + xOffset; + var newY = opener.screenY + yOffset; + } else { + newX = (screen.availWidth - window.outerWidth) / 2; + newY = (screen.availHeight - window.outerHeight) / 2; + } + + // ensure the window is fully onscreen (if smaller than the screen) + if (newX < screen.availLeft) + newX = screen.availLeft + 20; + if ((newX + window.outerWidth) > (screen.availLeft + screen.availWidth)) + newX = (screen.availLeft + screen.availWidth) - window.outerWidth - 20; + + if (newY < screen.availTop) + newY = screen.availTop + 20; + if ((newY + window.outerHeight) > (screen.availTop + screen.availHeight)) + newY = (screen.availTop + screen.availHeight) - window.outerHeight - 60; + + window.moveTo( newX, newY ); +} + +function centerWindowOnScreen() +{ + var xOffset = screen.availWidth/2 - window.outerWidth/2; + var yOffset = screen.availHeight/2 - window.outerHeight/2; //(opener.outerHeight *2)/10; + + xOffset = ( xOffset > 0 ) ? xOffset : 0; + yOffset = ( yOffset > 0 ) ? yOffset : 0; + window.moveTo( xOffset, yOffset); +} diff --git a/toolkit/content/dialogOverlay.xul b/toolkit/content/dialogOverlay.xul new file mode 100644 index 000000000..09e00613e --- /dev/null +++ b/toolkit/content/dialogOverlay.xul @@ -0,0 +1,101 @@ +<?xml version="1.0"?> +# -*- Mode: HTML -*- +# 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/. +# +# WARNING!!! This file is obsoleted by the dialog.xml widget +# + +<!DOCTYPE overlay SYSTEM "chrome://global/locale/dialogOverlay.dtd"> + +<overlay id="dialogOverlay" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <script type="application/javascript" src="chrome://global/content/dialogOverlay.js"/> + +#ifdef XP_MACOSX +# + <hbox id="okCancelButtons"> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> + + <hbox id="okCancelHelpButtons"> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> + + <hbox id="okCancelButtonsRight"> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> + + <hbox id="okCancelHelpButtonsRight"> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + <spacer flex="1"/> + <button class="exit-dialog" id="Button3" label="" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="Button2" label="" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="right exit-dialog" id="ok" default="true" label="&okButton.label;" oncommand="doOKButton();"/> + </hbox> +# +#else +# + <hbox id="okCancelButtons"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <spacer flex="1"/> + </hbox> + + <hbox id="okCancelHelpButtons"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + <spacer flex="1"/> + </hbox> + + <hbox id="okCancelButtonsRight"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + </hbox> + + <hbox id="okCancelHelpButtonsRight"> + <spacer flex="1"/> + <button class="right exit-dialog" id="ok" label="&okButton.label;" default="true" oncommand="doOKButton();"/> + <button class="exit-dialog" id="Button2" label="&cancelButton.label;" collapsed="true" oncommand="doButton2();"/> + <button class="exit-dialog" id="Button3" label="&cancelButton.label;" collapsed="true" oncommand="doButton3();"/> + <button class="exit-dialog" id="cancel" label="&cancelButton.label;" oncommand="doCancelButton();"/> + <button class="exit-dialog" id="help" label="&helpButton.label;" oncommand="doHelpButton();"/> + </hbox> +#endif + + <keyset id="dialogKeys"> + <key keycode="VK_RETURN" oncommand="if (!document.getElementById('ok').disabled) doOKButton();"/> + <key keycode="VK_ESCAPE" oncommand="doCancelButton();"/> +#ifdef XP_MACOSX + <key key="." modifiers="meta" oncommand="doCancelButton();"/> +# +#endif + </keyset> + +</overlay> diff --git a/toolkit/content/globalOverlay.xul b/toolkit/content/globalOverlay.xul new file mode 100644 index 000000000..90268a8e4 --- /dev/null +++ b/toolkit/content/globalOverlay.xul @@ -0,0 +1,38 @@ +<?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/. --> + + +<overlay id="globalOverlay" + xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> + + <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/> + <script type="application/javascript"><![CDATA[ + + function FillInTooltip ( tipElement ) + { + var retVal = false; + var textNode = document.getElementById("TOOLTIP-tooltipText"); + if (textNode) { + while (textNode.hasChildNodes()) + textNode.removeChild(textNode.firstChild); + var tipText = tipElement.getAttribute("tooltiptext"); + if (tipText) { + var node = document.createTextNode(tipText); + textNode.appendChild(node); + retVal = true; + } + } + return retVal; + } + + ]]></script> + + <popupset id="aTooltipSet"> + <tooltip id="aTooltip" class="tooltip" onpopupshowing="return FillInTooltip(document.tooltipNode);"> + <label id="TOOLTIP-tooltipText" class="tooltip-label" flex="1"/> + </tooltip> + </popupset> + +</overlay> diff --git a/toolkit/content/inlineSpellCheckUI.js b/toolkit/content/inlineSpellCheckUI.js new file mode 100644 index 000000000..177ce90cd --- /dev/null +++ b/toolkit/content/inlineSpellCheckUI.js @@ -0,0 +1,7 @@ +/* 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/. */ + +Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm"); + +var InlineSpellCheckerUI = new InlineSpellChecker(); diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index 79065e78a..538e42952 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -66,6 +66,13 @@ toolkit.jar: content/global/timepicker.xhtml content/global/treeUtils.js content/global/viewZoomOverlay.js + content/global/globalOverlay.xul +* content/global/dialogOverlay.xul + content/global/dialogOverlay.js + content/global/inlineSpellCheckUI.js + content/global/nsClipboard.js + content/global/nsUserSettings.js + content/global/strres.js content/global/bindings/autocomplete.xml (widgets/autocomplete.xml) content/global/bindings/browser.xml (widgets/browser.xml) content/global/bindings/button.xml (widgets/button.xml) diff --git a/toolkit/content/license.html b/toolkit/content/license.html index 2e7982446..99ee42fde 100644 --- a/toolkit/content/license.html +++ b/toolkit/content/license.html @@ -121,6 +121,7 @@ <li><a href="about:license#hunspell-lt">Lithuanian Spellchecking Dictionary License</a></li> <li><a href="about:license#microformatsshiv">MIT license — microformat-shiv</a></li> <li><a href="about:license#myspell">MySpell License</a></li> + <li><a href="about:license#naturalSort">naturalSort License</a></li> <li><a href="about:license#nicer">nICEr License</a></li> <li><a href="about:license#node-properties">node-properties License</a></li> <li><a href="about:license#nrappkit">nrappkit License</a></li> @@ -4066,6 +4067,36 @@ SUCH DAMAGE. </pre> +<hr> + +<h1><a id="naturalSort"></a>naturalSort License</h1> + +<p>This license applies to <span class="path">devtools/client/shared/natural-sort.js</span>.</p> + +<pre> +The MIT License (MIT) + +Copyright (c) 2014 Gabriel Llamas + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +</pre> + <hr> <h1><a id="nicer"></a>nICEr License</h1> diff --git a/toolkit/content/moz.build b/toolkit/content/moz.build index cc86890bf..de50a82f5 100644 --- a/toolkit/content/moz.build +++ b/toolkit/content/moz.build @@ -17,9 +17,6 @@ if CONFIG['OS_TARGET'] == 'Android': if CONFIG['MOZ_ANDROID_CXX_STL'] == 'libc++': DEFINES['MOZ_USE_LIBCXX'] = True -if CONFIG['MOZ_BUILD_APP'] == 'mobile/android': - DEFINES['MOZ_FENNEC'] = True - JAR_MANIFESTS += ['jar.mn'] with Files('aboutTelemetry.*'): diff --git a/toolkit/content/mozilla.xhtml b/toolkit/content/mozilla.xhtml index 1ffde19e4..2acfc9f5d 100644 --- a/toolkit/content/mozilla.xhtml +++ b/toolkit/content/mozilla.xhtml @@ -13,7 +13,7 @@ <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset='utf-8' /> - <title>&mozilla.title.15.1;</title> + <title>&chronicles.title.55.2;</title> <style> html { @@ -54,11 +54,11 @@ a { <section> <p id="moztext"> - &mozilla.quote.15.1; + &chronicles.quote.55.2; </p> <p id="from"> - &mozilla.from.15.1; + &chronicles.from.55.2; </p> </section> diff --git a/toolkit/content/nsClipboard.js b/toolkit/content/nsClipboard.js new file mode 100644 index 000000000..d9f7c4589 --- /dev/null +++ b/toolkit/content/nsClipboard.js @@ -0,0 +1,64 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* 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/. */ + +/** + * nsClipboard - wrapper around nsIClipboard and nsITransferable + * that simplifies access to the clipboard. + **/ +var nsClipboard = { + _CB: null, + get mClipboard() + { + if (!this._CB) + { + const kCBContractID = "@mozilla.org/widget/clipboard;1"; + const kCBIID = Components.interfaces.nsIClipboard; + this._CB = Components.classes[kCBContractID].getService(kCBIID); + } + return this._CB; + }, + + currentClipboard: null, + /** + * Array/Object read (Object aFlavourList, long aClipboard, Bool aAnyFlag) ; + * + * returns the data in the clipboard + * + * @param FlavourSet aFlavourSet + * formatted list of desired flavours + * @param long aClipboard + * the clipboard to read data from (kSelectionClipboard/kGlobalClipboard) + * @param Bool aAnyFlag + * should be false. + **/ + read: function (aFlavourList, aClipboard, aAnyFlag) + { + this.currentClipboard = aClipboard; + var data = nsTransferable.get(aFlavourList, this.getClipboardTransferable, aAnyFlag); + return data.first.first; // only support one item + }, + + /** + * nsISupportsArray getClipboardTransferable (Object aFlavourList) ; + * + * returns a nsISupportsArray of the item on the clipboard + * + * @param Object aFlavourList + * formatted list of desired flavours. + **/ + getClipboardTransferable: function (aFlavourList) + { + const supportsContractID = "@mozilla.org/supports-array;1"; + const supportsIID = Components.interfaces.nsISupportsArray; + var supportsArray = Components.classes[supportsContractID].createInstance(supportsIID); + var trans = nsTransferable.createTransferable(); + for (var flavour in aFlavourList) + trans.addDataFlavor(flavour); + nsClipboard.mClipboard.getData(trans, nsClipboard.currentClipboard) + supportsArray.AppendElement(trans); + return supportsArray; + } +}; + diff --git a/toolkit/content/nsUserSettings.js b/toolkit/content/nsUserSettings.js new file mode 100644 index 000000000..e0c378caf --- /dev/null +++ b/toolkit/content/nsUserSettings.js @@ -0,0 +1,108 @@ +/* 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/. */ + + +/** + * nsPreferences - a wrapper around nsIPrefService. Provides built in + * exception handling to make preferences access simpler. + **/ +var nsPreferences = { + get mPrefService() + { + return Components.classes["@mozilla.org/preferences-service;1"] + .getService(Components.interfaces.nsIPrefBranch); + }, + + setBoolPref: function (aPrefName, aPrefValue) + { + try + { + this.mPrefService.setBoolPref(aPrefName, aPrefValue); + } + catch (e) + { + } + }, + + getBoolPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getBoolPref(aPrefName); + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + }, + + setUnicharPref: function (aPrefName, aPrefValue) + { + try + { + var str = Components.classes["@mozilla.org/supports-string;1"] + .createInstance(Components.interfaces.nsISupportsString); + str.data = aPrefValue; + this.mPrefService.setComplexValue(aPrefName, + Components.interfaces.nsISupportsString, str); + } + catch (e) + { + } + }, + + copyUnicharPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getComplexValue(aPrefName, + Components.interfaces.nsISupportsString).data; + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + }, + + setIntPref: function (aPrefName, aPrefValue) + { + try + { + this.mPrefService.setIntPref(aPrefName, aPrefValue); + } + catch (e) + { + } + }, + + getIntPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getIntPref(aPrefName); + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + }, + + getLocalizedUnicharPref: function (aPrefName, aDefVal) + { + try + { + return this.mPrefService.getComplexValue(aPrefName, + Components.interfaces.nsIPrefLocalizedString).data; + } + catch (e) + { + return aDefVal != undefined ? aDefVal : null; + } + return null; // quiet warnings + } +}; + diff --git a/toolkit/content/strres.js b/toolkit/content/strres.js new file mode 100644 index 000000000..928c8f75f --- /dev/null +++ b/toolkit/content/strres.js @@ -0,0 +1,28 @@ +/* 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/. */ + +var strBundleService = null; + +function srGetStrBundle(path) +{ + var strBundle = null; + + if (!strBundleService) { + try { + strBundleService = + Components.classes["@mozilla.org/intl/stringbundle;1"].getService(); + strBundleService = + strBundleService.QueryInterface(Components.interfaces.nsIStringBundleService); + } catch (ex) { + dump("\n--** strBundleService failed: " + ex + "\n"); + return null; + } + } + + strBundle = strBundleService.createBundle(path); + if (!strBundle) { + dump("\n--** strBundle createInstance failed **--\n"); + } + return strBundle; +} diff --git a/toolkit/content/tests/widgets/test_videocontrols.html b/toolkit/content/tests/widgets/test_videocontrols.html index 191aaef58..146c63a72 100644 --- a/toolkit/content/tests/widgets/test_videocontrols.html +++ b/toolkit/content/tests/widgets/test_videocontrols.html @@ -229,7 +229,7 @@ function runTest(event) { is(event.type, "seeked", "checking event type"); ok(true, "video position is at " + video.currentTime); var expectedTime = videoDuration / 2; - ok(Math.abs(video.currentTime - expectedTime) < 0.1, "checking expected playback position"); + ok(Math.abs(video.currentTime - expectedTime) < 0.1, "checking expected playback position Math.abs(" + video.currentTime + " - " + expectedTime + ") < .1"); SimpleTest.executeSoon(() => { synthesizeMouse(video, scrubberOffsetX + (scrubberWidth / 4), scrubberCenterY, { }); |