From 99a7eb889cc06685ee25971b3f3131f8ebddb953 Mon Sep 17 00:00:00 2001 From: Neil Deakin Date: Fri, 21 Oct 2016 15:55:25 -0400 Subject: [PATCH] Bug 1309652, use computed display when determining option display values, r=felipe --- .../content/test/general/browser_selectpopup.js | 8 ++++---- toolkit/modules/SelectContentHelper.jsm | 14 +++++++++----- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/browser/base/content/test/general/browser_selectpopup.js b/browser/base/content/test/general/browser_selectpopup.js index a6a7fb801ca0..873eb697d58e 100644 --- a/browser/base/content/test/general/browser_selectpopup.js +++ b/browser/base/content/test/general/browser_selectpopup.js @@ -42,18 +42,18 @@ const PAGECONTENT_SMALL = ""; const PAGECONTENT_SOMEHIDDEN = - "" + + "" + ""; const PAGECONTENT_TRANSLATED = diff --git a/toolkit/modules/SelectContentHelper.jsm b/toolkit/modules/SelectContentHelper.jsm index ce8dfca25c9e..0f005934cf9c 100644 --- a/toolkit/modules/SelectContentHelper.jsm +++ b/toolkit/modules/SelectContentHelper.jsm @@ -87,7 +87,7 @@ this.SelectContentHelper.prototype = { rect: rect, options: this._buildOptionList(), selectedIndex: this.element.selectedIndex, - direction: getComputedDirection(this.element) + direction: getComputedStyles(this.element).direction }); gOpen = true; }, @@ -192,13 +192,15 @@ this.SelectContentHelper.prototype = { } -function getComputedDirection(element) { - return element.ownerDocument.defaultView.getComputedStyle(element).getPropertyValue("direction"); +function getComputedStyles(element) { + return element.ownerDocument.defaultView.getComputedStyle(element); } function buildOptionListForChildren(node) { let result = []; + let win = node.ownerDocument.defaultView; + for (let child of node.children) { let tagName = child.tagName.toUpperCase(); @@ -214,15 +216,17 @@ function buildOptionListForChildren(node) { textContent = ""; } + let cs = getComputedStyles(child); + let info = { index: child.index, tagName: tagName, textContent: textContent, disabled: child.disabled, - display: child.style.display, + display: cs.display, // We need to do this for every option element as each one can have // an individual style set for direction - textDirection: getComputedDirection(child), + textDirection: cs.direction, tooltip: child.title, // XXX this uses a highlight color when this is the selected element. // We need to suppress such highlighting in the content process to get