From e8d13f3103450a68ea29e14303dea06b6e573b2a Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Thu, 23 Mar 2017 13:34:21 -0400 Subject: [PATCH] Bug 1349701 - Update the styles of element, as well as another bug where we weren't passing the correct number of arguments to this.populate. MozReview-Commit-ID: 8LAeIliRXhZ --HG-- extra : rebase_source : 19c573ffebf700de4b4a470ceb1d2706a8088574 --- .../test/forms/browser_selectpopup_colors.js | 18 ++++++++++++++++++ toolkit/modules/SelectContentHelper.jsm | 10 ++++++++++ toolkit/modules/SelectParentHelper.jsm | 3 +++ 3 files changed, 31 insertions(+) diff --git a/browser/base/content/test/forms/browser_selectpopup_colors.js b/browser/base/content/test/forms/browser_selectpopup_colors.js index a197d4ea9f0a..d88093df2cb3 100644 --- a/browser/base/content/test/forms/browser_selectpopup_colors.js +++ b/browser/base/content/test/forms/browser_selectpopup_colors.js @@ -91,6 +91,15 @@ const DISABLED_OPTGROUP_AND_OPTIONS = ' ' + ""; +const SELECT_CHANGES_COLOR_ON_FOCUS = + "" + + ""; + function getSystemColor(color) { // Need to convert system color to RGB color. let textarea = document.createElementNS("http://www.w3.org/1999/xhtml", "textarea"); @@ -279,3 +288,12 @@ add_task(function* test_disabled_optgroup_and_options() { yield testSelectColors(DISABLED_OPTGROUP_AND_OPTIONS, 17, {skipSelectColorTest: true}); }); + +add_task(function* test_disabled_optgroup_and_options() { + let options = { + selectColor: "rgb(0, 0, 0)", + selectBgColor: "rgb(255, 165, 0)" + }; + + yield testSelectColors(SELECT_CHANGES_COLOR_ON_FOCUS, 2, options); +}); diff --git a/toolkit/modules/SelectContentHelper.jsm b/toolkit/modules/SelectContentHelper.jsm index 85e376ccba7e..5101ec53ae31 100644 --- a/toolkit/modules/SelectContentHelper.jsm +++ b/toolkit/modules/SelectContentHelper.jsm @@ -94,9 +94,11 @@ this.SelectContentHelper.prototype = { showDropDown() { this.element.openInParentProcess = true; let rect = this._getBoundingContentRect(); + DOMUtils.addPseudoClassLock(this.element, ":focus"); let computedStyles = getComputedStyles(this.element); this._selectBackgroundColor = computedStyles.backgroundColor; this._selectColor = computedStyles.color; + DOMUtils.clearPseudoClassLocks(this.element); this.global.sendAsyncMessage("Forms:ShowDropDown", { direction: computedStyles.direction, isOpenedViaTouch: this.isOpenedViaTouch, @@ -124,6 +126,14 @@ this.SelectContentHelper.prototype = { _update() { // The