Bug 1103635 - Handle RTL when processing <select> elements for e10s r=mconley

This commit is contained in:
George Wright 2015-04-15 16:00:29 -04:00
parent 4d77f86aab
commit e2b02a1638
2 changed files with 7 additions and 0 deletions

View File

@ -88,8 +88,11 @@ this.SelectContentHelper.prototype = {
function buildOptionListForChildren(node) {
let result = [];
let win = node.ownerDocument.defaultView;
for (let child of node.children) {
let tagName = child.tagName.toUpperCase();
if (tagName == 'OPTION' || tagName == 'OPTGROUP') {
let textContent =
tagName == 'OPTGROUP' ? child.getAttribute("label")
@ -104,6 +107,9 @@ function buildOptionListForChildren(node) {
let info = {
tagName: child.tagName,
textContent: textContent,
// We need to do this for every option element as each one can have
// an individual style set for direction
textDirection: win.getComputedStyle(child).getPropertyValue("direction"),
// XXX this uses a highlight color when this is the selected element.
// We need to suppress such highlighting in the content process to get
// the option's correct unhighlighted color here.

View File

@ -77,6 +77,7 @@ function populateChildren(element, options, selectedIndex, startIndex = 0, isGro
for (let option of options) {
let item = element.ownerDocument.createElement("menuitem");
item.setAttribute("label", option.textContent);
item.style.direction = option.textDirection;
element.appendChild(item);