Backed out changeset 1b54dc70e042 (bug 1530709) for causing browser-chrome failures on browser_selectpopup_colors.js CLOSED TREE

This commit is contained in:
arthur.iakab 2019-09-03 20:58:45 +03:00
parent 86c74f0485
commit ffeeb56270
2 changed files with 23 additions and 41 deletions

View File

@ -26,8 +26,6 @@ XPCOMUtils.defineLazyGlobalGetters(this, ["InspectorUtils"]);
const kStateActive = 0x00000001; // NS_EVENT_STATE_ACTIVE
const kStateHover = 0x00000004; // NS_EVENT_STATE_HOVER
// Duplicated in SelectParent.jsm
// Please keep these lists in sync.
const SUPPORTED_PROPERTIES = [
"direction",
"color",

View File

@ -24,19 +24,6 @@ const PROPERTIES_RESET_WHEN_ACTIVE = [
"text-shadow",
];
// Duplicated in SelectChild.jsm
// Please keep these lists in sync.
const SUPPORTED_PROPERTIES = [
"direction",
"color",
"background-color",
"text-shadow",
"font-family",
"font-weight",
"font-size",
"font-style",
];
const customStylingEnabled = Services.prefs.getBoolPref(
"dom.forms.select.customstyling"
);
@ -132,24 +119,22 @@ var SelectParentHelper = {
);
}
let addedRule = false;
for (let property of SUPPORTED_PROPERTIES) {
let ruleBody = "";
for (let property in selectStyle) {
if (property == "background-color" || property == "direction") {
continue;
} // Handled above, or before.
if (
!selectStyle[property] ||
selectStyle[property] == uaStyle[property]
) {
continue;
if (selectStyle[property] != uaStyle[property]) {
ruleBody += `${property}: ${selectStyle[property]};`;
}
if (!addedRule) {
sheet.insertRule("#ContentSelectDropdown > menupopup {}", 0);
addedRule = true;
}
sheet.cssRules[0][property] = selectStyle[property];
}
if (addedRule) {
if (ruleBody) {
sheet.insertRule(
`#ContentSelectDropdown > menupopup {
${ruleBody}
}`,
0
);
sheet.insertRule(
`#ContentSelectDropdown > menupopup > :not([_moz-menuactive="true"]) {
color: inherit;
@ -431,30 +416,29 @@ var SelectParentHelper = {
}
if (customStylingEnabled) {
let addedRule = false;
for (const property of SUPPORTED_PROPERTIES) {
let ruleBody = "";
for (let property in style) {
if (property == "direction" || property == "font-size") {
continue;
} // handled above
if (!style[property] || style[property] == selectStyle[property]) {
if (style[property] == selectStyle[property]) {
continue;
}
if (PROPERTIES_RESET_WHEN_ACTIVE.includes(property)) {
if (!addedRule) {
sheet.insertRule(
`#ContentSelectDropdown > menupopup > :nth-child(${nthChildIndex}):not([_moz-menuactive="true"]) {
}`,
0
);
addedRule = true;
}
sheet.cssRules[0][property] = style[property];
ruleBody += `${property}: ${style[property]};`;
} else {
item.style.setProperty(property, style[property]);
}
}
if (addedRule) {
if (ruleBody) {
sheet.insertRule(
`#ContentSelectDropdown > menupopup > :nth-child(${nthChildIndex}):not([_moz-menuactive="true"]) {
${ruleBody}
}`,
0
);
if (
style["text-shadow"] != "none" &&
style["text-shadow"] != selectStyle["text-shadow"]