Closed Bug 1103635 Opened 10 years ago Closed 9 years ago

[e10s] New <select> dropdown doesn't honor RTL direction at all when e10s is enabled

Categories

(Core :: Widget, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
e10s m6+ ---
firefox40 --- fixed

People

(Reporter: ebrahim, Assigned: gw280)

References

(Blocks 1 open bug, )

Details

(Keywords: rtl)

Attachments

(2 files)

Attached image Visually explained
1. Open data:text/html,<center><select><optgroup label="LTR"><option>A)</option></optgroup></select><div dir="rtl"><select><optgroup label="RTL"><option>A)</option></optgroup></select>
2. Compare dropdowns of the two select elements.

Expected:
Dropdown of second <select> which is RTL should be flipped

Actual:
It is same first dropdown and is specially when neutral characters (like dots and bracket involved) it would be broken and not usable at all.

Have a look at the attachment also.
This seems to be a very recent regression: I can reproduce with mozilla-inbound but not with mozilla-central. What build are you testing with?
I am using Nightly builds, sorry that I didn't specified that.

about:buildconfig
Build Machine

B-2008-IX-0157
Source

Built from https://hg.mozilla.org/mozilla-central/rev/8c02f3280d0c
Build platform
target
x86_64-pc-mingw32
Build tools
Compiler 	Version 	Compiler flags
cl 	1800 	-TC -nologo -D_HAS_EXCEPTIONS=0 -W3 -Gy -FS -wd4244 -wd4267 -wd4819 -we4553
cl 	1800 	-TP -nologo -D_HAS_EXCEPTIONS=0 -W3 -Gy -FS -wd4251 -wd4244 -wd4267 -wd4345 -wd4351 -wd4482 -wd4800 -wd4819 -we4553 -GR- -DNDEBUG -DTRIMMED -Zi -UDEBUG -DNDEBUG -GL -wd4624 -wd4952 -O1 -Oi -Oy-
Configure arguments

--target=x86_64-pc-mingw32 --host=x86_64-pc-mingw32 --enable-crashreporter --enable-release --enable-update-channel=nightly --enable-update-packaging --enable-jemalloc --with-google-api-keyfile=/c/builds/gapi.data --with-google-oauth-api-keyfile=/c/builds/google-oauth-api.key --enable-signmar --enable-profiling --enable-js-diagnostics
Version: unspecified → Trunk
Alice, any chance you could please find the regression range here?  Thanks!
(In reply to :Ehsan Akhgari (not reading bugmail, needinfo? me!) from comment #3)
> Alice, any chance you could please find the regression range here?  Thanks!

I cannot reproduce on latest Nightly.
https://hg.mozilla.org/mozilla-central/rev/17de0f463944
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:37.0) Gecko/20100101 Firefox/37.0 ID:20141128114334
Still reproducible on Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:37.0) Gecko/20100101 Firefox/37.0 https://hg.mozilla.org/mozilla-central/rev/17de0f463944
tracking-e10s: --- → ?
Depends on: 1053981
Summary: New <select> dropdown doesn't honor RTL direction at all → [e10s] New <select> dropdown doesn't honor RTL direction at all when e10s is enabled
Status: UNCONFIRMED → NEW
Ever confirmed: true
This is a not recent regression.
The problem happens on e10s but not non-e10s. 
This problem also happens on Lunux as well as Windows if e10s is enabled.
OS: Windows 8.1 → All
Keywords: rtl
M6 to block e10s Aurora uplift.
Assignee: nobody → mconley
Assignee: mconley → gwright
Blocks: e10s-select
Attached patch rtl-select.patchSplinter Review
This propagates the text direction through to the relevant menuitems but it doesn't work because of a bug in nsTextBoxFrame where it refuses to do bidi processing unless RTL characters are present. I will file a separate bug for that.
Attachment #8593560 - Flags: review?(mconley)
Depends on: 1155359
Comment on attachment 8593560 [details] [diff] [review]
rtl-select.patch

Review of attachment 8593560 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks George!

::: toolkit/modules/SelectContentHelper.jsm
@@ +88,4 @@
>  
>  function buildOptionListForChildren(node) {
>    let result = [];
> +  let popupView = node.ownerDocument.defaultView;

I have no idea why the containing window is called "defaultView", but generally we call this "win" or "window" - since that's clearer. Can you change popupView -> win?

@@ +107,4 @@
>        let info = {
>          tagName: child.tagName,
>          textContent: textContent,
> +        textDirection: popupView.getComputedStyle(child, null).getPropertyValue("direction"),

The second argument to getComputedStyle is optional - you don't need to pass it here. And I think you can just do:

win.getComputedStyle(child).direction

::: toolkit/modules/SelectParentHelper.jsm
@@ +77,4 @@
>    for (let option of options) {
>      let item = element.ownerDocument.createElement("menuitem");
>      item.setAttribute("label", option.textContent);
> +    item.style.direction = option.textDirection;

So we have to do this for every individual menuitem? We can't do it for the popup once?

If so, we should mention that in a comment here.
Attachment #8593560 - Flags: review?(mconley) → review+
(In reply to Mike Conley (:mconley) - Needinfo me! from comment #9)
> So we have to do this for every individual menuitem? We can't do it for the
> popup once?
> 
> If so, we should mention that in a comment here.

Yes, because you can have an individual option element with the rtl style set; something like:

<select>
<optgroup label="RTL">
  <option style="direction: rtl;">A)</option>
  <option>B)</option>
</optgroup>
</select>

And A) should be rendered as "(A" (ie - RTL) and B) should stay as "B)".
Ah, yeah, that makes sense. Thanks.
https://hg.mozilla.org/mozilla-central/rev/f4d29724d782
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
QA Whiteboard: [good first verify][verify in Nightly only]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: