author | George Wright <george@mozilla.com> |
Fri, 18 Mar 2016 13:38:40 -0400 | |
changeset 327808 | f66ffb0d7984b2673cd57cca1d618bdf29d88a09 |
parent 327807 | eb528d042c851c297f40543d63dfb8d1ed5361ce |
child 327809 | f3431739c79d3fdc7bff53be2600c5bb7dd9fc6a |
push id | 6048 |
push user | kmoir@mozilla.com |
push date | Mon, 06 Jun 2016 19:02:08 +0000 |
treeherder | mozilla-beta@46d72a56c57d [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mconley |
bugs | 1255841 |
milestone | 48.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
toolkit/modules/SelectContentHelper.jsm | file | annotate | diff | comparison | revisions | |
toolkit/modules/SelectParentHelper.jsm | file | annotate | diff | comparison | revisions |
--- a/toolkit/modules/SelectContentHelper.jsm +++ b/toolkit/modules/SelectContentHelper.jsm @@ -108,16 +108,17 @@ function buildOptionListForChildren(node let textContent = tagName == 'OPTGROUP' ? child.getAttribute("label") : child.text; if (textContent == null) { textContent = ""; } let info = { + index: child.index, tagName: tagName, textContent: textContent, disabled: child.disabled, display: child.style.display, // We need to do this for every option element as each one can have // an individual style set for direction textDirection: getComputedDirection(child), tooltip: child.title,
--- a/toolkit/modules/SelectParentHelper.jsm +++ b/toolkit/modules/SelectParentHelper.jsm @@ -57,19 +57,18 @@ this.SelectParentHelper = { _unregisterListeners: function(popup) { popup.removeEventListener("command", this); popup.removeEventListener("popuphidden", this); }, }; -function populateChildren(menulist, options, selectedIndex, zoom, startIndex = 0, +function populateChildren(menulist, options, selectedIndex, zoom, isInGroup = false, isGroupDisabled = false, adjustedTextSize = -1) { - let index = startIndex; let element = menulist.menupopup; // -1 just means we haven't calculated it yet. When we recurse through this function // we will pass in adjustedTextSize to save on recalculations. if (adjustedTextSize == -1) { let win = element.ownerDocument.defaultView; // Grab the computed text size and multiply it by the remote browser's fullZoom to ensure @@ -93,30 +92,28 @@ function populateChildren(menulist, opti // A disabled optgroup disables all of its child options. let isDisabled = isGroupDisabled || option.disabled; if (isDisabled) { item.setAttribute("disabled", "true"); } if (isOptGroup) { - index = populateChildren(menulist, option.children, selectedIndex, zoom, - index, true, isDisabled, adjustedTextSize); + populateChildren(menulist, option.children, selectedIndex, zoom, + true, isDisabled, adjustedTextSize); } else { - if (index == selectedIndex) { + if (option.index == selectedIndex) { // We expect the parent element of the popup to be a <xul:menulist> that // has the popuponly attribute set to "true". This is necessary in order // for a <xul:menupopup> to act like a proper <html:select> dropdown, as // the <xul:menulist> does things like remember state and set the // _moz-menuactive attribute on the selected <xul:menuitem>. menulist.selectedItem = item; } - item.setAttribute("value", index++); + item.setAttribute("value", option.index); if (isInGroup) { item.classList.add("contentSelectDropdown-ingroup") } } } - - return index; }