mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1255841 - Explicitly send down the child index when building select popups in the parent r=mconley
This commit is contained in:
parent
1922ce7aa8
commit
4718b95edf
@ -113,6 +113,7 @@ function buildOptionListForChildren(node) {
|
||||
}
|
||||
|
||||
let info = {
|
||||
index: child.index,
|
||||
tagName: tagName,
|
||||
textContent: textContent,
|
||||
disabled: child.disabled,
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user