Bug 1255841 - Explicitly send down the child index when building select popups in the parent r=mconley

This commit is contained in:
George Wright 2016-03-18 13:38:40 -04:00
parent 1922ce7aa8
commit 4718b95edf
2 changed files with 6 additions and 8 deletions

View File

@ -113,6 +113,7 @@ function buildOptionListForChildren(node) {
}
let info = {
index: child.index,
tagName: tagName,
textContent: textContent,
disabled: child.disabled,

View File

@ -62,9 +62,8 @@ this.SelectParentHelper = {
};
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
@ -98,10 +97,10 @@ function populateChildren(menulist, options, selectedIndex, zoom, startIndex = 0
}
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
@ -110,13 +109,11 @@ function populateChildren(menulist, options, selectedIndex, zoom, startIndex = 0
menulist.selectedItem = item;
}
item.setAttribute("value", index++);
item.setAttribute("value", option.index);
if (isInGroup) {
item.classList.add("contentSelectDropdown-ingroup")
}
}
}
return index;
}