From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- toolkit/content/widgets/autocomplete.xml | 2515 ++++++++++++++++++++++++++++ toolkit/content/widgets/browser.xml | 1571 +++++++++++++++++ toolkit/content/widgets/button.xml | 389 +++++ toolkit/content/widgets/checkbox.xml | 84 + toolkit/content/widgets/colorpicker.xml | 565 +++++++ toolkit/content/widgets/datetimebox.css | 45 + toolkit/content/widgets/datetimebox.xml | 807 +++++++++ toolkit/content/widgets/datetimepicker.xml | 1301 ++++++++++++++ toolkit/content/widgets/datetimepopup.xml | 181 ++ toolkit/content/widgets/dialog.xml | 448 +++++ toolkit/content/widgets/editor.xml | 195 +++ toolkit/content/widgets/expander.xml | 86 + toolkit/content/widgets/filefield.xml | 96 ++ toolkit/content/widgets/findbar.xml | 1397 +++++++++++++++ toolkit/content/widgets/general.xml | 231 +++ toolkit/content/widgets/groupbox.xml | 44 + toolkit/content/widgets/listbox.xml | 1144 +++++++++++++ toolkit/content/widgets/menu.xml | 286 ++++ toolkit/content/widgets/menulist.xml | 606 +++++++ toolkit/content/widgets/notification.xml | 551 ++++++ toolkit/content/widgets/numberbox.xml | 304 ++++ toolkit/content/widgets/optionsDialog.xml | 43 + toolkit/content/widgets/popup.xml | 650 +++++++ toolkit/content/widgets/preferences.xml | 1411 ++++++++++++++++ toolkit/content/widgets/progressmeter.xml | 116 ++ toolkit/content/widgets/radio.xml | 526 ++++++ toolkit/content/widgets/remote-browser.xml | 591 +++++++ toolkit/content/widgets/resizer.xml | 39 + toolkit/content/widgets/richlistbox.xml | 589 +++++++ toolkit/content/widgets/scale.xml | 232 +++ toolkit/content/widgets/scrollbar.xml | 35 + toolkit/content/widgets/scrollbox.xml | 908 ++++++++++ toolkit/content/widgets/spinbuttons.xml | 96 ++ toolkit/content/widgets/spinner.js | 514 ++++++ toolkit/content/widgets/splitter.xml | 37 + toolkit/content/widgets/stringbundle.xml | 96 ++ toolkit/content/widgets/tabbox.xml | 892 ++++++++++ toolkit/content/widgets/text.xml | 386 +++++ toolkit/content/widgets/textbox.xml | 646 +++++++ toolkit/content/widgets/timekeeper.js | 418 +++++ toolkit/content/widgets/timepicker.js | 277 +++ toolkit/content/widgets/toolbar.xml | 590 +++++++ toolkit/content/widgets/toolbarbutton.xml | 115 ++ toolkit/content/widgets/tree.xml | 1561 +++++++++++++++++ toolkit/content/widgets/videocontrols.css | 128 ++ toolkit/content/widgets/videocontrols.xml | 2027 ++++++++++++++++++++++ toolkit/content/widgets/wizard.xml | 607 +++++++ 47 files changed, 26376 insertions(+) create mode 100644 toolkit/content/widgets/autocomplete.xml create mode 100644 toolkit/content/widgets/browser.xml create mode 100644 toolkit/content/widgets/button.xml create mode 100644 toolkit/content/widgets/checkbox.xml create mode 100644 toolkit/content/widgets/colorpicker.xml create mode 100644 toolkit/content/widgets/datetimebox.css create mode 100644 toolkit/content/widgets/datetimebox.xml create mode 100644 toolkit/content/widgets/datetimepicker.xml create mode 100644 toolkit/content/widgets/datetimepopup.xml create mode 100644 toolkit/content/widgets/dialog.xml create mode 100644 toolkit/content/widgets/editor.xml create mode 100644 toolkit/content/widgets/expander.xml create mode 100644 toolkit/content/widgets/filefield.xml create mode 100644 toolkit/content/widgets/findbar.xml create mode 100644 toolkit/content/widgets/general.xml create mode 100644 toolkit/content/widgets/groupbox.xml create mode 100644 toolkit/content/widgets/listbox.xml create mode 100644 toolkit/content/widgets/menu.xml create mode 100644 toolkit/content/widgets/menulist.xml create mode 100644 toolkit/content/widgets/notification.xml create mode 100644 toolkit/content/widgets/numberbox.xml create mode 100644 toolkit/content/widgets/optionsDialog.xml create mode 100644 toolkit/content/widgets/popup.xml create mode 100644 toolkit/content/widgets/preferences.xml create mode 100644 toolkit/content/widgets/progressmeter.xml create mode 100644 toolkit/content/widgets/radio.xml create mode 100644 toolkit/content/widgets/remote-browser.xml create mode 100644 toolkit/content/widgets/resizer.xml create mode 100644 toolkit/content/widgets/richlistbox.xml create mode 100644 toolkit/content/widgets/scale.xml create mode 100644 toolkit/content/widgets/scrollbar.xml create mode 100644 toolkit/content/widgets/scrollbox.xml create mode 100644 toolkit/content/widgets/spinbuttons.xml create mode 100644 toolkit/content/widgets/spinner.js create mode 100644 toolkit/content/widgets/splitter.xml create mode 100644 toolkit/content/widgets/stringbundle.xml create mode 100644 toolkit/content/widgets/tabbox.xml create mode 100644 toolkit/content/widgets/text.xml create mode 100644 toolkit/content/widgets/textbox.xml create mode 100644 toolkit/content/widgets/timekeeper.js create mode 100644 toolkit/content/widgets/timepicker.js create mode 100644 toolkit/content/widgets/toolbar.xml create mode 100644 toolkit/content/widgets/toolbarbutton.xml create mode 100644 toolkit/content/widgets/tree.xml create mode 100644 toolkit/content/widgets/videocontrols.css create mode 100644 toolkit/content/widgets/videocontrols.xml create mode 100644 toolkit/content/widgets/wizard.xml (limited to 'toolkit/content/widgets') diff --git a/toolkit/content/widgets/autocomplete.xml b/toolkit/content/widgets/autocomplete.xml new file mode 100644 index 000000000..da2bf678d --- /dev/null +++ b/toolkit/content/widgets/autocomplete.xml @@ -0,0 +1,2515 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + null + null + false + + null + null + null + null + + + + + + + + null + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + parseInt(this.getAttribute("shrinkdelay")) || 0 + + + + + + + + + + + + 14 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + null + + + + + + + + = 1) + this.mController.handleTab(); + break; + case KeyEvent.DOM_VK_UP: + case KeyEvent.DOM_VK_DOWN: + case KeyEvent.DOM_VK_PAGE_UP: + case KeyEvent.DOM_VK_PAGE_DOWN: + cancel = this.mController.handleKeyNavigation(aEvent.keyCode); + break; + } + } + + // Handle keys we know aren't part of a shortcut, even with Alt or + // Ctrl. + switch (aEvent.keyCode) { + case KeyEvent.DOM_VK_ESCAPE: + cancel = this.mController.handleEscape(); + break; + case KeyEvent.DOM_VK_RETURN: + if (/Mac/.test(navigator.platform)) { + // Prevent the default action, since it will beep on Mac + if (aEvent.metaKey) + aEvent.preventDefault(); + } + if (this.mController.selection) { + this._selectionDetails = { + index: this.mController.selection.currentIndex, + kind: "key" + }; + } + cancel = this.handleEnter(aEvent); + break; + case KeyEvent.DOM_VK_DELETE: + if (/Mac/.test(navigator.platform) && !aEvent.shiftKey) { + break; + } + cancel = this.handleDelete(); + break; + case KeyEvent.DOM_VK_BACK_SPACE: + if (/Mac/.test(navigator.platform) && aEvent.shiftKey) { + cancel = this.handleDelete(); + } + break; + case KeyEvent.DOM_VK_DOWN: + case KeyEvent.DOM_VK_UP: + if (aEvent.altKey) + this.toggleHistoryPopup(); + break; + case KeyEvent.DOM_VK_F4: + if (!/Mac/.test(navigator.platform)) { + this.toggleHistoryPopup(); + } + break; + } + + if (cancel) { + aEvent.stopPropagation(); + aEvent.preventDefault(); + } + + return true; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + false + aCommand == "cmd_paste", + doCommand: function(aCommand) { + this._autocomplete._valueIsPasted = true; + this._autocomplete.editor.paste(this._kGlobalClipboard); + this._autocomplete._valueIsPasted = false; + }, + isCommandEnabled: function(aCommand) { + return this._autocomplete.editor.isSelectionEditable && + this._autocomplete.editor.canPaste(this._kGlobalClipboard); + }, + onEvent: function() {} + }) + ]]> + + + + + + + + + + + + + + + + + + + = 1) { + // mousemove sets selected index. Don't blindly use that selected + // index in this blur handler since if the popup is open you can + // easily "select" another match just by moving the mouse over it. + let filledVal = this.value.replace(/.+ >> /, "").toLowerCase(); + let selectedVal = null; + if (this.popup.selectedIndex >= 0) { + selectedVal = this.mController.getFinalCompleteValueAt( + this.popup.selectedIndex); + } + if (selectedVal && filledVal != selectedVal.toLowerCase()) { + for (let i = 0; i < this.mController.matchCount; i++) { + let matchVal = this.mController.getFinalCompleteValueAt(i); + if (matchVal.toLowerCase() == filledVal) { + this.popup.selectedIndex = i; + break; + } + } + } + this.mController.handleEnter(false); + } + if (!this.ignoreBlurWhileSearching) + this.detachController(); + } + ]]> + + + + + + + + + + + + + + + + + + + + + false + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0) + this.tree.treeBoxObject.ensureRowIsVisible(val < 0 ? 0 : val); + // Fire select event on xul:tree so that accessibility API + // support layer can fire appropriate accessibility events. + var event = document.createEvent('Events'); + event.initEvent("select", true, true); + this.tree.dispatchEvent(event); + return val; + ]]> + + + + + + + + + + + + + + + + + + 100 ? width : 100); + + // Adjust the direction of the autocomplete popup list based on the textbox direction, bug 649840 + var popupDirection = aElement.ownerDocument.defaultView.getComputedStyle(aElement).direction; + this.style.direction = popupDirection; + + this.openPopup(aElement, "after_start", 0, 0, false, false); + } + ]]> + + + + + + + + + + + + + + + + document.getAnonymousElementByAttribute(this, "anonid", "tree"); + + + + document.getAnonymousElementByAttribute(this, "anonid", "treecols"); + + + + + + + + + + + + null + false + false + + + + + + + + + + + + + + + + + + + 6 + + + -1 + + + + + + + + + + + + + aMaxRow && aIndex != aMaxRow) + newIdx = aMaxRow; + else if (!aReverse && aIndex == -1 || newIdx < 0 && aIndex != 0) + newIdx = 0; + + if (newIdx < 0 && aIndex == 0 || newIdx > aMaxRow && aIndex == aMaxRow) + aIndex = -1; + else + aIndex = newIdx; + + return aIndex; + ]]> + + + + + + + + + + + + { + this.mIsPopupHidingTick = false; + }, 0); + + // Reset the maxRows property to the cached "normal" value, and reset + // _normalMaxRows so that we can detect whether it was set by the input + // when the popupshowing handler runs. + + // Null-check this.mInput; see bug 1017914 + if (this.mInput) + this.mInput.maxRows = this._normalMaxRows; + this._normalMaxRows = -1; + // If the list was being navigated and then closed, make sure + // we fire accessible focus event back to textbox + + // Null-check this.mInput; see bug 1017914 + if (isListActive && this.mInput) { + this.mInput.mIgnoreFocus = true; + this.mInput._focus(); + this.mInput.mIgnoreFocus = false; + } + ]]> + + + + + + + + + + + + + + + + + + 0 + false + + + + + + + + + + + + + + + + + + + + + + + + + + 100 ? width : 100); + // invalidate() depends on the width attribute + this._invalidate(); + + this.openPopup(aElement, "after_start", 0, 0, false, false); + } + ]]> + + + + + + + + + + + + + + this.adjustHeight(), 0); + } else { + this._adjustHeightOnPopupShown = true; + } + + this._currentIndex = 0; + if (this._appendResultTimeout) { + clearTimeout(this._appendResultTimeout); + } + this._appendCurrentResult(reason); + ]]> + + + + + + + + + + + + + + + + + + + + + + + + this.maxRows) { + // Set a fixed max-height to avoid flicker when growing the panel. + let lastVisibleRowRect = rows[this.maxRows - 1].getBoundingClientRect(); + let visibleHeight = lastVisibleRowRect.bottom - firstRowRect.top; + this.richlistbox.style.maxHeight = + visibleHeight + this._rlbPadding + "px"; + } + + // The class `forceHandleUnderflow` is for the item might need to + // handle OverUnderflow or Overflow when the height of an item will + // be changed dynamically. + for (let i = 0; i < numRows; i++) { + if (rows[i].classList.contains("forceHandleUnderflow")) { + rows[i].handleOverUnderflow(); + } + } + + let lastRowRect = rows[numRows - 1].getBoundingClientRect(); + // Calculate the height to have the first row to last row shown + height = lastRowRect.bottom - firstRowRect.top + + this._rlbPadding; + } + + let animate = this._rlbAnimated && + this.getAttribute("dontanimate") != "true"; + let currentHeight = this.richlistbox.getBoundingClientRect().height; + if (height > currentHeight) { + // Grow immediately. + if (animate) { + this.richlistbox.removeAttribute("height"); + this.richlistbox.style.height = height + "px"; + } else { + this.richlistbox.style.removeProperty("height"); + this.richlistbox.height = height; + } + } else { + // Delay shrinking to avoid flicker. + this._shrinkTimeout = setTimeout(() => { + this._collapseUnusedItems(); + if (animate) { + this.richlistbox.removeAttribute("height"); + this.richlistbox.style.height = height + "px"; + } else { + this.richlistbox.style.removeProperty("height"); + this.richlistbox.height = height; + } + }, this.mInput.shrinkDelay); + } + ]]> + + + + + + + = matchCount) + break; + + var item; + + // trim the leading/trailing whitespace + var trimmedSearchString = controller.searchString.replace(/^\s+/, "").replace(/\s+$/, ""); + + let url = controller.getValueAt(this._currentIndex); + + if (this._currentIndex < existingItemsCount) { + // re-use the existing item + item = this.richlistbox.childNodes[this._currentIndex]; + item.setAttribute("dir", this.style.direction); + + // Completely reuse the existing richlistitem for invalidation + // due to new results, but only when: the item is the same, *OR* + // we are about to replace the currently mouse-selected item, to + // avoid surprising the user. + let iface = Components.interfaces.nsIAutoCompletePopup; + if (item.getAttribute("text") == trimmedSearchString && + invalidateReason == iface.INVALIDATE_REASON_NEW_RESULT && + (item.getAttribute("url") == url || + this.richlistbox.mouseSelectedIndex === this._currentIndex)) { + // Additionally, if the item is a searchengine action, then it + // should only be reused if the engine name is the same as the + // popup's override engine name, if any. + let action = item._parseActionUrl(url); + if (!action || + action.type != "searchengine" || + !this.overrideSearchEngineName || + action.params.engineName == this.overrideSearchEngineName) { + item.collapsed = false; + // Call adjustSiteIconStart only after setting collapsed= + // false. The calculations it does may be wrong otherwise. + item.adjustSiteIconStart(this._siteIconStart); + // The popup may have changed size between now and the last + // time the item was shown, so always handle over/underflow. + item.handleOverUnderflow(); + this._currentIndex++; + continue; + } + } + } + else { + // need to create a new item + item = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "richlistitem"); + item.setAttribute("dir", this.style.direction); + } + + // set these attributes before we set the class + // so that we can use them from the constructor + let iconURI = controller.getImageAt(this._currentIndex); + item.setAttribute("image", iconURI); + item.setAttribute("url", url); + item.setAttribute("title", controller.getCommentAt(this._currentIndex)); + item.setAttribute("originaltype", controller.getStyleAt(this._currentIndex)); + item.setAttribute("text", trimmedSearchString); + + if (this._currentIndex < existingItemsCount) { + // re-use the existing item + item._adjustAcItem(); + item.collapsed = false; + } + else { + // set the class at the end so we can use the attributes + // in the xbl constructor + item.className = "autocomplete-richlistitem"; + this.richlistbox.appendChild(item); + } + + // The binding may have not been applied yet. + setTimeout(() => { + let changed = item.adjustSiteIconStart(this._siteIconStart); + if (changed) { + item.handleOverUnderflow(); + } + }, 0); + + this._currentIndex++; + } + + if (typeof this.onResultsAdded == "function") + this.onResultsAdded(); + + if (this._currentIndex < matchCount) { + // yield after each batch of items so that typing the url bar is + // responsive + this._appendResultTimeout = setTimeout(() => this._appendCurrentResult(), 0); + } + ]]> + + + + + + + + + + + + + + + + + + + + + + document.getAnonymousElementByAttribute(this, "anonid", "richlistbox"); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + str).join(" ") + + // allow consumers that have extended popups to override + // the label values for the richlistitems + let panel = this.parentNode.parentNode; + if (panel.createResultLabel) { + return panel.createResultLabel(this, label); + } + + return label; + ]]> + + + + + + + + null + + + + + + + + false + + + + + + + + + + + + + + + + + + = 0) { + regions.push([matchIndex, matchIndex + searchLen]); + } + } + + // Sort the regions by start position then end position + regions = regions.sort((a, b) => { + let start = a[0] - b[0]; + return (start == 0) ? a[1] - b[1] : start; + }); + + // Generate the boundary indices from each region + let start = 0; + let end = 0; + let boundaries = []; + let len = regions.length; + for (let i = 0; i < len; i++) { + // We have a new boundary if the start of the next is past the end + let region = regions[i]; + if (region[0] > end) { + // First index is the beginning of match + boundaries.push(start); + // Second index is the beginning of non-match + boundaries.push(end); + + // Track the new region now that we've stored the previous one + start = region[0]; + } + + // Push back the end index for the current or new region + end = Math.max(end, region[1]); + } + + // Add the last region + boundaries.push(start); + boundaries.push(end); + + // Put on the end boundary if necessary + if (end < aText.length) + boundaries.push(aText.length); + + // Skip the first item because it's always 0 + return boundaries.slice(1); + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = 0 && index < aReplacements.length) { + pairs.push([...aReplacements[index]]); + } + } else { + pairs.push([part]); + } + } + + return pairs; + ]]> + + + + + + + + + + + + + null + + + + + + + + + + = 0) { + pairs = [ + [searchSuggestion.substring(0, idx), ""], + [searchQuery, "match"], + [searchSuggestion.substring(idx + searchQuery.length), ""], + ]; + } else { + pairs = [ + [searchSuggestion, ""], + ]; + } + } else { + pairs = [ + [searchQuery, ""], + ]; + } + let interpStr = pairs.map((pair, i) => `%${i + 1}$S`).join(""); + title = this._generateEmphasisPairs(interpStr, pairs); + + // If this is a default search match, we remove the image so we + // can style it ourselves with a generic search icon. + // We don't do this when matching an aliased search engine, + // because the icon helps with recognising which engine will be + // used (when using the default engine, we don't need that + // recognition). + if (!action.params.alias && !initialTypes.has("favicon")) { + this.removeAttribute("image"); + } + } else if (action.type == "visiturl") { + emphasiseUrl = false; + displayUrl = this._unescapeUrl(action.params.url); + title = displayUrl; + titleLooksLikeUrl = true; + let visitStr = this._stringBundle.GetStringFromName("visit"); + this._setUpDescription(this._actionText, visitStr, true); + } else if (action.type == "extension") { + let content = action.params.content; + displayUrl = content; + this._setUpDescription(this._actionText, content, true); + } + } + + if (!displayUrl) { + let input = popup.input; + let url = typeof(input.trimValue) == "function" ? + input.trimValue(originalUrl) : + originalUrl; + displayUrl = this._unescapeUrl(url); + } + // For performance reasons we may want to limit the displayUrl size. + if (popup.textRunsMaxLen) { + displayUrl = displayUrl.substr(0, popup.textRunsMaxLen); + } + this.setAttribute("displayurl", displayUrl); + + // Show the domain as the title if we don't have a title. + if (!title) { + title = displayUrl; + titleLooksLikeUrl = true; + try { + let uri = Services.io.newURI(originalUrl, null, null); + // Not all valid URLs have a domain. + if (uri.host) + title = uri.host; + } catch (e) {} + } + + this._tags.setAttribute("empty", "true"); + + if (type == "tag" || type == "bookmark-tag") { + // The title is separated from the tags by an endash + let tags; + [, title, tags] = title.match(/^(.+) \u2013 (.+)$/); + + // Each tag is split by a comma in an undefined order, so sort it + let sortedTags = tags.split(/\s*,\s*/).sort((a, b) => { + return a.localeCompare(a); + }); + + let anyTagsMatch = this._setUpTags(sortedTags); + if (anyTagsMatch) { + this._tags.removeAttribute("empty"); + } + if (type == "bookmark-tag") { + type = "bookmark"; + } + } else if (type == "keyword") { + // Note that this is a moz-action with action.type == keyword. + emphasiseUrl = false; + let keywordArg = this.getAttribute("text").replace(/^[^\s]+\s*/, ""); + if (!keywordArg) { + // Treat keyword searches without arguments as visiturl actions. + type = "visiturl"; + this.setAttribute("actiontype", "visiturl"); + let visitStr = this._stringBundle.GetStringFromName("visit"); + this._setUpDescription(this._actionText, visitStr, true); + } else { + let pairs = [[title, ""], [keywordArg, "match"]]; + let interpStr = + this._stringBundle.GetStringFromName("bookmarkKeywordSearch"); + title = this._generateEmphasisPairs(interpStr, pairs); + // The action box will be visible since this is a moz-action, but + // we want it to appear as if it were not visible, so set its text + // to the empty string. + this._setUpDescription(this._actionText, "", false); + } + } + + this.setAttribute("type", type); + + if (titleLooksLikeUrl) { + this._titleText.setAttribute("lookslikeurl", "true"); + } else { + this._titleText.removeAttribute("lookslikeurl"); + } + + if (Array.isArray(title)) { + // For performance reasons we may want to limit the title size. + if (popup.textRunsMaxLen) { + title = title.map(t => t.substr(0, popup.textRunsMaxLen)); + } + this._setUpEmphasisedSections(this._titleText, title); + } else { + // For performance reasons we may want to limit the title size. + if (popup.textRunsMaxLen) { + title = title.substr(0, popup.textRunsMaxLen); + } + this._setUpDescription(this._titleText, title, false); + } + this._setUpDescription(this._urlText, displayUrl, !emphasiseUrl); + + if (this._inOverflow) { + this._handleOverflow(); + } + ]]> + + + + + + + + + + + + + + 0; + ]]> + + + + + + itemWidth) { + // Title + tags + URL/action overflows the item width. + + // The percentage of the item width allocated to the title and tags. + let titleTagsPct = 0.66; + + let titleTagsAvailable = itemWidth - separatorURLActionWidth; + let titleTagsMaxWidth = Math.max( + titleTagsAvailable, + itemWidth * titleTagsPct + ); + if (titleTagsWidth > titleTagsMaxWidth) { + // Title + tags overflows the max title + tags width. + + // The percentage of the title + tags width allocated to the + // title. + let titlePct = 0.33; + + let titleAvailable = titleTagsMaxWidth - tagsRect.width; + let titleMaxWidth = Math.max( + titleAvailable, + titleTagsMaxWidth * titlePct + ); + let tagsAvailable = titleTagsMaxWidth - titleRect.width; + let tagsMaxWidth = Math.max( + tagsAvailable, + titleTagsMaxWidth * (1 - titlePct) + ); + this._titleText.style.maxWidth = titleMaxWidth + "px"; + this._tagsText.style.maxWidth = tagsMaxWidth + "px"; + } + let urlActionMaxWidth = Math.max( + itemWidth - titleTagsWidth, + itemWidth * (1 - titleTagsPct) + ); + urlActionMaxWidth -= separatorRect.width; + this._urlText.style.maxWidth = urlActionMaxWidth + "px"; + this._actionText.style.maxWidth = urlActionMaxWidth + "px"; + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + Date.now() + -1 + + + + + + + + 30) { + let item = event.target; + while (item && item.localName != "richlistitem") { + item = item.parentNode; + } + + if (!item) + return; + + let index = this.getIndexOfItem(item); + if (index != this.selectedIndex) { + this.mouseSelectedIndex = this.selectedIndex = index; + } + + this.mLastMoveTime = Date.now(); + } + ]]> + + + + + + + Date.now() + + + + + + + + 30) { + var rc = this.parentNode.treeBoxObject.getRowAt(event.clientX, event.clientY); + if (rc != this.parentNode.currentIndex) + this.parentNode.view.selection.select(rc); + this.mLastMoveTime = Date.now(); + } + ]]> + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml new file mode 100644 index 000000000..a5f37b62a --- /dev/null +++ b/toolkit/content/widgets/browser.xml @@ -0,0 +1,1571 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + webNavigation.goBack()); + ]]> + + + + + + webNavigation.goForward()); + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + this.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset)); + ]]> + + + + + + + + + + + + + this.webNavigation.loadURIWithOptions( + aURI, aFlags, aReferrerURI, aReferrerPolicy, + aPostData, null, null)); + ]]> + + + + + + + + + + + + + + + + + + + + + + this.webNavigation.gotoIndex(aIndex)); + ]]> + + + + + + + + + + + + + + + + + + + + + + null + + + + + + null + + + + + + null + + + + + + + + + + + + + + + + + + + + + + // Only useful for remote browsers. + + + + + + + + + + + + + + + + + + + + + + + + + null + + + + + + + + null + + + + + + + + + + + + + + null + + + + + + null + + + + + + + + + + + + + null + + + + null + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Components.classes['@mozilla.org/preferences-service;1'] + .getService(Components.interfaces.nsIPrefBranch); + + + null + + + + + // see bug 63370 for details + this._mStrBundle = Components.classes["@mozilla.org/intl/stringbundle;1"] + .getService(Components.interfaces.nsIStringBundleService) + .createBundle("chrome://global/locale/browser.properties"); + } + return this._mStrBundle; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { + let self = this; + this.messageManager.addMessageListener("PopupBlocking:ReplyGetBlockedPopupList", + function replyReceived(msg) { + self.messageManager.removeMessageListener("PopupBlocking:ReplyGetBlockedPopupList", + replyReceived); + resolve(msg.data.popupData); + } + ); + }); + ]]> + + + + + + + + + null + + + + + + + + + + + + + + + + + + + + + + + false + + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ({ + _startedLoadSinceLastUserTyping: false, + + startedLoad() { + this._startedLoadSinceLastUserTyping = true; + }, + finishedLoad() { + this._startedLoadSinceLastUserTyping = false; + }, + userTyped() { + this._startedLoadSinceLastUserTyping = false; + }, + }) + + + + + + + + null + + + + + + + + false + + + + false + + + + null + + + null + + + null + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10 + false + null + null + null + false + + + + + + + + + + + + + + + + + + 8) { // need high color for transparency + // Exclude second-rate platforms + this._autoScrollPopup.setAttribute("transparent", !/BeOS|OS\/2/.test(navigator.appVersion)); + // Enable translucency on Windows and Mac + this._autoScrollPopup.setAttribute("translucent", /Win|Mac/.test(navigator.platform)); + } + + this._autoScrollPopup.setAttribute("noautofocus", "true"); + this._autoScrollPopup.setAttribute("scrolldir", scrolldir); + this._autoScrollPopup.addEventListener("popuphidden", this, true); + this._autoScrollPopup.showPopup(document.documentElement, + screenX, + screenY, + "popup", null, null); + this._ignoreMouseEvents = true; + this._scrolling = true; + this._startX = screenX; + this._startY = screenY; + + window.addEventListener("mousemove", this, true); + window.addEventListener("mousedown", this, true); + window.addEventListener("mouseup", this, true); + window.addEventListener("DOMMouseScroll", this, true); + window.addEventListener("contextmenu", this, true); + window.addEventListener("keydown", this, true); + window.addEventListener("keypress", this, true); + window.addEventListener("keyup", this, true); + ]]> + + + + + + + this._AUTOSCROLL_SNAP || x < -this._AUTOSCROLL_SNAP) || + (y > this._AUTOSCROLL_SNAP || y < -this._AUTOSCROLL_SNAP)) + this._ignoreMouseEvents = false; + break; + } + case "mouseup": + case "mousedown": + case "contextmenu": { + if (!this._ignoreMouseEvents) { + // Use a timeout to prevent the mousedown from opening the popup again. + // Ideally, we could use preventDefault here, but contenteditable + // and middlemouse paste don't interact well. See bug 1188536. + setTimeout(() => this._autoScrollPopup.hidePopup(), 0); + } + this._ignoreMouseEvents = false; + break; + } + case "DOMMouseScroll": { + this._autoScrollPopup.hidePopup(); + event.preventDefault(); + break; + } + case "popuphidden": { + this._autoScrollPopup.removeEventListener("popuphidden", this, true); + this.stopScroll(); + break; + } + case "keydown": { + if (aEvent.keyCode == aEvent.DOM_VK_ESCAPE) { + // the escape key will be processed by + // nsXULPopupManager::KeyDown and the panel will be closed. + // So, don't consume the key event here. + break; + } + // don't break here. we need to eat keydown events. + } + case "keypress": + case "keyup": { + // All keyevents should be eaten here during autoscrolling. + aEvent.stopPropagation(); + aEvent.preventDefault(); + break; + } + } + } + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/content/widgets/button.xml b/toolkit/content/widgets/button.xml new file mode 100644 index 000000000..89d9d86c6 --- /dev/null +++ b/toolkit/content/widgets/button.xml @@ -0,0 +1,389 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + this.init(); + + + + + binding must contain an element with anonid=\"button\""; + + var menubuttonParent = this; + btn.addEventListener("mouseover", function() { + if (!this.disabled) + menubuttonParent.buttonover = true; + }, true); + btn.addEventListener("mouseout", function() { + menubuttonParent.buttonover = false; + }, true); + btn.addEventListener("mousedown", function() { + if (!this.disabled) { + menubuttonParent.buttondown = true; + document.addEventListener("mouseup", menubuttonParent, true); + } + }, true); + ]]> + + + + + + + + + + + + + + + + false + + + + + + + + + + + + + if (event.originalTarget == this) + this.open = true; + + + if (event.originalTarget == this) { + this.open = true; + // Prevent page from scrolling on the space key. + event.preventDefault(); + } + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/content/widgets/checkbox.xml b/toolkit/content/widgets/checkbox.xml new file mode 100644 index 000000000..c6a5babfd --- /dev/null +++ b/toolkit/content/widgets/checkbox.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/content/widgets/colorpicker.xml b/toolkit/content/widgets/colorpicker.xml new file mode 100644 index 000000000..30f8a6354 --- /dev/null +++ b/toolkit/content/widgets/colorpicker.xml @@ -0,0 +1,565 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "; + el.setAttribute("src", dataURI); + } + + this.hoverCell(this.mBox.childNodes[0].childNodes[0]); + + // used to capture keydown at the document level + this.mPickerKeyDown = function(aEvent) + { + document._focusedPicker.pickerKeyDown(aEvent); + } + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "); + this.setAttribute("color", val); + return val; + ]]> + + + + "); + + var popup = document.getAnonymousElementByAttribute(this, "anonid", "colorpopup") + popup._colorPicker = this; + + this.mPicker = document.getAnonymousElementByAttribute(this, "anonid", "colorpicker") + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 36 && event.keyCode < 41)) && !this.open) + this.showPopup(); + else if ( (event.keyCode == 27) && this.open) + this.hidePopup(); + ]]> + + + + + + + + diff --git a/toolkit/content/widgets/datetimebox.css b/toolkit/content/widgets/datetimebox.css new file mode 100644 index 000000000..4a9593a69 --- /dev/null +++ b/toolkit/content/widgets/datetimebox.css @@ -0,0 +1,45 @@ +/* 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/. */ + +@namespace url("http://www.w3.org/1999/xhtml"); +@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); + +.datetime-input-box-wrapper { + -moz-appearance: none; + display: inline-flex; + cursor: default; + background-color: inherit; + color: inherit; +} + +.datetime-input { + -moz-appearance: none; + text-align: center; + padding: 0; + border: 0; + margin: 0; + ime-mode: disabled; +} + +.datetime-separator { + margin: 0 !important; +} + +.datetime-input[readonly], +.datetime-input[disabled] { + color: GrayText; + -moz-user-select: none; +} + +.datetime-reset-button { + background-image: url(chrome://global/skin/icons/input-clear.svg); + background-color: transparent; + background-repeat: no-repeat; + background-size: 12px, 12px; + border: none; + height: 12px; + width: 12px; + align-self: center; + justify-content: flex-end; +} diff --git a/toolkit/content/widgets/datetimebox.xml b/toolkit/content/widgets/datetimebox.xml new file mode 100644 index 000000000..05591e65a --- /dev/null +++ b/toolkit/content/widgets/datetimebox.xml @@ -0,0 +1,807 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = this.mMaxHourInHour12) ? + this.mPMIndicator : this.mAMIndicator; + } + + if (!this.isEmpty(second)) { + let index = second.indexOf("."); + let millisecond; + if (index != -1) { + millisecond = second.substring(index + 1); + second = second.substring(0, index); + } + + if (!this.mSecondField) { + this.mSecondSeparator = this.insertSeparator(this.mSeparatorText); + this.mSecondField = this.insertAdditionalField(this.mPlaceHolder, + this.mMinSecond, this.mMaxSecond, this.mMaxLength, + this.mMaxLength); + } + this.setFieldValue(this.mSecondField, second); + + if (!this.isEmpty(millisecond)) { + if (!this.mMillisecField) { + this.mMillisecSeparator = this.insertSeparator( + this.mMillisecSeparatorText); + this.mMillisecField = this.insertAdditionalField( + this.mPlaceHolder, this.mMinMillisecond, this.mMaxMillisecond, + this.mMillisecMaxLength, this.mMillisecMaxLength); + } + this.setFieldValue(this.mMillisecField, millisecond); + } else if (this.mMillisecField) { + this.mMillisecField.remove(); + this.mMillisecField = null; + + this.mMillisecSeparator.remove(); + this.mMillisecSeparator = null; + } + } else { + if (this.mSecondField) { + this.mSecondField.remove(); + this.mSecondField = null; + + this.mSecondSeparator.remove(); + this.mSecondSeparator = null; + } + + if (this.mMillisecField) { + this.mMillisecField.remove(); + this.mMillisecField = null; + + this.mMillisecSeparator.remove(); + this.mMillisecSeparator = null; + } + } + this.notifyPicker(); + ]]> + + + + + + + + + + + + + = this.mMaxHourInHour12) ? this.mPMIndicator + : this.mAMIndicator; + } + } + + if (!this.isEmpty(minute)) { + this.setFieldValue(this.mMinuteField, minute); + } + ]]> + + + + + + + + + + + + + + + max) { + value -= (max - min + 1); + } else if (value < min) { + value += (max - min + 1); + } + this.setFieldValue(aTargetField, value); + aTargetField.select(); + ]]> + + + + + + + + + + + + + + = targetField.maxLength || n * 10 > max) { + buffer = ""; + this.advanceToNextField(); + } + targetField.setAttribute("typeBuffer", buffer); + } + ]]> + + + + + + + + this.mMaxHourInHour12) ? + value - this.mMaxHourInHour12 : value; + if (aValue == "00") { + value = this.mMaxHourInHour12; + } + } + // prepend zero + if (value < 10) { + value = "0" + value; + } + } else if (aField.maxLength == this.mMillisecMaxLength) { + // prepend zeroes + if (value < 10) { + value = "00" + value; + } else if (value < 100) { + value = "0" + value; + } + } + + aField.value = value; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + return (aValue == undefined || 0 === aValue.length); + + + + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/toolkit/content/widgets/datetimepicker.xml b/toolkit/content/widgets/datetimepicker.xml new file mode 100644 index 000000000..5f16f1ff0 --- /dev/null +++ b/toolkit/content/widgets/datetimepicker.xml @@ -0,0 +1,1301 @@ + + + + + + %datetimepickerDTD; +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + null + + document.getAnonymousElementByAttribute(this, "anonid", "input-one"); + + + document.getAnonymousElementByAttribute(this, "anonid", "input-two"); + + + document.getAnonymousElementByAttribute(this, "anonid", "input-three"); + + + document.getAnonymousElementByAttribute(this, "anonid", "input-ampm"); + + + document.getAnonymousElementByAttribute(this, "anonid", "sep-first"); + + + document.getAnonymousElementByAttribute(this, "anonid", "sep-second"); + + null + true + false + null + + + + var focusedInput = document.activeElement; + if (focusedInput == this._fieldOne || + focusedInput == this._fieldTwo || + focusedInput == this._fieldThree || + focusedInput == this._fieldAMPM) + return focusedInput; + return this._lastFocusedField || this._fieldOne; + + + + + + + + + + + + + + + + var event = document.createEvent("Events"); + event.initEvent(aEventName, true, true); + return !aTarget.dispatchEvent(event); + + + + + + + + + + + + + + + + this._init(); + + var cval = this.getAttribute("value"); + if (cval) { + try { + this.value = cval; + return; + } catch (ex) { } + } + this.dateValue = new Date(); + + + + if (this.attachedControl) { + this.attachedControl.attachedControl = null; + this.attachedControl = null; + } + + + + + + + + + + + 57)) + event.preventDefault(); + ]]> + + + + if (this._hasEntry) + this._increaseOrDecrease(1); + + + if (this._hasEntry) + this._increaseOrDecrease(-1); + + + + this._valueEntered = true; + + + + this._setValueOnChange(event.originalTarget); + + + + + + + + + false + false + true + true + "AM" + "PM" + + null + null + null + + + + + + + + + + + + 23) + throw "Invalid Hour"; + this._setFieldValue(this.hourField, valnum); + return val; + ]]> + + + + + 59) + throw "Invalid Minute"; + this._setFieldValue(this.minuteField, valnum); + return val; + ]]> + + + + + 59) + throw "Invalid Second"; + this._setFieldValue(this.secondField, valnum); + return val; + ]]> + + + + + = 12); + ]]> + + + = 12) + this.hour -= 12; + return val; + ]]> + + + + + return (this.getAttribute("hideseconds") == "true"); + + + if (val) + this.setAttribute("hideseconds", "true"); + else + this.removeAttribute("hideseconds"); + if (this.secondField) + this.secondField.parentNode.collapsed = val; + this._separatorSecond.collapsed = val; + return val; + + + + + = 60) + return 1; + return increment; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = 12) { + if (aValue > 12) + aValue -= 12; + this._fieldAMPM.value = this.pmIndicator; + } + else { + if (aValue == 0) + aValue = 12; + this._fieldAMPM.value = this.amIndicator; + } + } + } + else if (aField == this.minuteField) { + prependZero = this.minuteLeadingZero; + } + else if (aField == this.secondField) { + prependZero = this.secondLeadingZero; + } + + if (prependZero && aValue < 10) + aField.value = "0" + aValue; + else + aField.value = aValue; + ]]> + + + + + + + + = max) + return aNoWrap ? max - 1 : aValue - max; + return aValue; + ]]> + + + + + 12) + this.is24HourClock = true; + else + this.pmIndicator = numberFields[1] || numberFields[7]; + } + + var amTime = new Date(2000, 0, 1, 1, 7, 9).toLocaleTimeString(locale); + numberFields = amTime.match(numberOrder); + if (numberFields) { + this.hourLeadingZero = (numberFields[2].length > 1); + this.minuteLeadingZero = (numberFields[4].length > 1); + this.secondLeadingZero = (numberFields[6].length > 1); + + if (!this.is24HourClock) { + this.amIndicator = numberFields[1] || numberFields[7]; + if (numberFields[1]) { + var mfield = this._fieldAMPM.parentNode; + var mcontainer = mfield.parentNode; + mcontainer.insertBefore(mfield, mcontainer.firstChild); + } + var size = (numberFields[1] || numberFields[7]).length; + if (this.pmIndicator.length > size) + size = this.pmIndicator.length; + this._fieldAMPM.size = size; + this._fieldAMPM.maxLength = size; + } + else { + this._fieldAMPM.parentNode.collapsed = true; + } + } + + this.hideSeconds = this.hideSeconds; + ]]> + + + + + + + + + + + + + + + + false + true + true + + + + + + + + + + + + + + + + + 9999) + throw "Invalid Year"; + this._setFieldValue(this.yearField, valnum); + return val; + ]]> + + + + + 11) + throw "Invalid Month"; + this._setFieldValue(this.monthField, valnum); + return val; + ]]> + + + + + 31) + throw "Invalid Date"; + this._setFieldValue(this.dateField, valnum); + return val; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + max) + return aNoWrap ? max : min; + return aValue; + ]]> + + + + + 1); + this.monthLeadingZero = (numberFields[mi].length > 1); + this.dateLeadingZero = (numberFields[di].length > 1); + } + + this.yearField = document.getAnonymousElementByAttribute(this, "anonid", yfield); + if (!twoDigitYear) + this.yearField.parentNode.classList.add("datetimepicker-input-subbox", "datetimepicker-year"); + this.monthField = document.getAnonymousElementByAttribute(this, "anonid", mfield); + this.dateField = document.getAnonymousElementByAttribute(this, "anonid", dfield); + + this._fieldAMPM.parentNode.collapsed = true; + this.yearField.size = twoDigitYear ? 2 : 4; + this.yearField.maxLength = twoDigitYear ? 2 : 4; + ]]> + + + + + + + + + + + +