Last Comment Bug 651905 - Caption buttons show on top of the Firefox button with a RTL language pack applied to a LTR Firefox when system menu is displayed
: Caption buttons show on top of the Firefox button with a RTL language pack ap...
Status: RESOLVED FIXED
: rtl
Product: Core
Classification: Components
Component: Widget: Win32 (show other bugs)
: 2.0 Branch
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Simon Montagu :smontagu
:
: Jim Mathies [:jimm]
Mentors:
Depends on:
Blocks: 574454
  Show dependency treegraph
 
Reported: 2011-04-21 10:23 PDT by Eric Sh.
Modified: 2011-05-11 00:47 PDT (History)
14 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Firefox window menubar with buttons on top of the firefox button (10.76 KB, image/png)
2011-04-21 10:28 PDT, Eric Sh.
no flags Details
bug showen when using different theme (FXChrome) (13.62 KB, image/png)
2011-05-04 06:04 PDT, dror3go
no flags Details
menu patch (810 bytes, patch)
2011-05-05 03:08 PDT, Jim Mathies [:jimm]
no flags Details | Diff | Splinter Review
Use SetMenuItemInfo instead of EnableMenuItem (2.47 KB, patch)
2011-05-05 06:00 PDT, Simon Montagu :smontagu
jmathies: review+
Details | Diff | Splinter Review
LTR version of the bug (16.74 KB, image/png)
2011-05-05 06:17 PDT, Simon Montagu :smontagu
no flags Details

Description Eric Sh. 2011-04-21 10:23:52 PDT
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0
Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0) Gecko/20100101 Firefox/4.0

When I right click the menu bar of a normal window(not full screen one) with firefox button enabled, or with a full screen with the firefox button enabled and with the tabs not ontop, the normal close, maximize and minimize buttons show up ontop of the firefox button and they are on both sides of the menubar.

when I click on a place on the screen in firefox or outside it the buttons dissapear.

Note: This also happens sometimes when I right click the firefox task on the taskbar.

Reproducible: Always

Steps to Reproduce:
1. Open a firefox window set up as said in the deatils
2. Right click the menubar
Actual Results:  
Buttons show on top of the firefox button.

Expected Results:  
The firefox button will stay as it is.
Comment 1 Eric Sh. 2011-04-21 10:28:06 PDT
Created attachment 527579 [details]
Firefox window menubar with buttons on top of the firefox button
Comment 2 aravindm 2011-04-21 22:53:37 PDT
Mozilla/5.0 (Windows NT 6.1; rv:6.0a1) Gecko/20110421 Firefox/6.0a1

Works fine for me. 
Does the issue still occur if you start Firefox in Safe Mode?
http://support.mozilla.com/en-US/kb/Safe+Mode

How about with a new, empty profile?
http://support.mozilla.com/en-US/kb/Basic+Troubleshooting#Make_a_new_profile
Comment 3 Eric Sh. 2011-04-26 11:04:52 PDT
Have the same bug in Safe Mode and in a new profile I just created in the profile manager.

I also downloaded the portable version of firefox and looks like this bug is specific for the Right-To-Left version of firefox because I downloaded the Left-To-RIght portable version and it works fine.
Comment 4 Eric Sh. 2011-04-26 11:05:35 PDT
And why are you testing with firefox 6.0? This is a 4.0 bug.
Comment 5 Eric Sh. 2011-04-26 11:33:31 PDT
Just tested and found out that if you use an english version of firefox and install a right-to-left(for example hebrew or arabic) language pack you can replicate this bug

See:
http://kb.mozillazine.org/Language_packs#Downloading_a_language_pack

You'd better download a portable version or use a clean profile if you don't know any RTL language.
Comment 6 (mostly gone) XtC4UaLL [:xtc4uall] 2011-04-26 16:43:55 PDT
Moving to Core for further Investigation.
Comment 7 Kai Liu 2011-04-26 22:41:20 PDT
I don't think this is a widget issue.

I can't reproduce this using the steps in comment 0 with a full RTL version, nor with a Force RTL'ed LTR version.  So if the problem is present only on a LTR version with a RTL language pack, then it's probably an issue with how the language pack is being applied...
Comment 8 Eric Sh. 2011-04-29 14:07:34 PDT
(In reply to comment #7)
> I don't think this is a widget issue.
> 
> I can't reproduce this using the steps in comment 0 with a full RTL version,
> nor with a Force RTL'ed LTR version.  So if the problem is present only on a
> LTR version with a RTL language pack, then it's probably an issue with how the
> language pack is being applied...

That is very strange, what language is your RTL version?
And are you sing a RTL windows?

I will check on other computers with RTL firefox but not RTL windows and post soon...
Comment 9 Jim Mathies [:jimm] 2011-04-29 15:55:00 PDT
Rather odd because the caption buttons on the right look like they are being drawn by Windows, and the buttons on the left are drawn by us when the fx button is enabled on XP. We remove the entire non-client caption area in this case so Windows should not be drawing there at all.
Comment 10 :Ehsan Akhgari 2011-05-03 14:08:56 PDT
Tomer, can you reproduce this?
Comment 11 dror3go 2011-05-03 23:55:46 PDT
I can reproduce this bug, XP & Firefox 4.0.1.
Comment 12 Tomer Cohen :tomer 2011-05-04 02:31:35 PDT
Is it a theme issue? Becuase from the screenshot above I understand it only happen on Windows Classic theme.

(In reply to comment #11)
> I can reproduce this bug, XP & Firefox 4.0.1.

Thanks Dror! ☺
Comment 13 dror3go 2011-05-04 06:04:55 PDT
Created attachment 529978 [details]
bug showen when using different theme (FXChrome)

(In reply to comment #12)
> Is it a theme issue? Becuase from the screenshot above I understand it only
> happen on Windows Classic theme.

This bug is *not* a theme issue. The browser paints the 3 buttons for some reason.

To reproduce it, all that's needed is:
- Uncheck the "menu bar" under view -> toolbars
- Change intl.uidirection.en to "rtl" in about:config
- Make the window not maximized
- Open context menu for the window.
Comment 14 Jim Mathies [:jimm] 2011-05-04 12:29:32 PDT
(In reply to comment #13)
> Created attachment 529978 [details]
> bug showen when using different theme (FXChrome)
> 
> (In reply to comment #12)
> > Is it a theme issue? Becuase from the screenshot above I understand it only
> > happen on Windows Classic theme.
> 
> This bug is *not* a theme issue. The browser paints the 3 buttons for some
> reason.
> 
> To reproduce it, all that's needed is:
> - Uncheck the "menu bar" under view -> toolbars
> - Change intl.uidirection.en to "rtl" in about:config
> - Make the window not maximized
> - Open context menu for the window.

Can you do all that, but after changing the pref, restart first and see if the problem still exists?
Comment 15 dror3go 2011-05-04 23:21:31 PDT
> Can you do all that, but after changing the pref, restart first and see if the
> problem still exists?

Yes, it does.
Comment 16 Simon Montagu :smontagu 2011-05-05 00:15:17 PDT
Apparently this bug is only in Windows XP. However, we used to have a very similar bug in Windows 7, but it was fixed in attachment 472642 [details] [diff] [review] in bug 588735. See the screenshot (before the fix) in attachment 471984 [details].
Comment 17 Simon Montagu :smontagu 2011-05-05 00:26:53 PDT
(In reply to comment #16)
> Apparently this bug is only in Windows XP.

Correction: I can reproduce in Windows 7 with Windows Classic theme.
Comment 19 Simon Montagu :smontagu 2011-05-05 01:31:52 PDT
Jimm, could this have been caused by bug 602532 or bug 602450?
Comment 20 Simon Montagu :smontagu 2011-05-05 02:00:27 PDT
(In reply to comment #17)
> Correction: I can reproduce in Windows 7 with Windows Classic theme.

... or any non-Aero theme.
Comment 21 Jim Mathies [:jimm] 2011-05-05 02:26:25 PDT
(In reply to comment #19)
> Jimm, could this have been caused by bug 602532 or bug 602450?

Those are both specific to the system menu. If we have a case where the window is correct but the system menu isn't aligned right, then maybe, but since the window's command buttons are also aligned incorrectly, I'd say not likely.
Comment 22 Simon Montagu :smontagu 2011-05-05 02:30:30 PDT
Yes, but the misaligned command buttons only appear when the system menu is displayed.
Comment 23 Jim Mathies [:jimm] 2011-05-05 02:33:32 PDT
(In reply to comment #20)
> (In reply to comment #17)
> > Correction: I can reproduce in Windows 7 with Windows Classic theme.
> 
> ... or any non-Aero theme.

Ok, I can reproduce this now. I was under the impression the buttons were always being drawn in the wrong place, but I see now it's only when you bring up the system menu, and then they disappear after the menu is dismissed. This is definitely a widget drawing bug.
Comment 24 Jim Mathies [:jimm] 2011-05-05 02:44:46 PDT
On english systems with the rtl setting reversed, I see that the click alignment of the context menu is correct, but the text is not. I'm assuming there's nothing we can do about that since the context menu is created by the system.
Comment 25 Simon Montagu :smontagu 2011-05-05 03:00:32 PDT
Can we pass TPM_LAYOUTRTL to TrackPopupMenu when the window is RTL?
Comment 26 Jim Mathies [:jimm] 2011-05-05 03:03:26 PDT
(In reply to comment #25)
> Can we pass TPM_LAYOUTRTL to TrackPopupMenu when the window is RTL?

Ah, yes. I looked at the TPM params on msdn, they didn't list it except in a little blurb at the bottom :) That looks like it would fix the context menu.
Comment 27 Jim Mathies [:jimm] 2011-05-05 03:08:50 PDT
Created attachment 530264 [details] [diff] [review]
menu patch

Unfortunately it doesn't fix the buttons. Windows still thinks it's an ltr window.
Comment 28 Simon Montagu :smontagu 2011-05-05 03:53:13 PDT
Right, I see the reverse on Hebrew Windows - the system menu is always Hebrew, and always RTL, whatever the language and orientation of the app. It's the same in other apps, e.g. OpenOffice.
Comment 29 Jim Mathies [:jimm] 2011-05-05 04:17:32 PDT
On the caption button drawing, it looks like Windows is doing some spurious nc client area painting on either the context menu event or the mouse down event. We need to track down which and figure out some way to prevent it. WM_SETTEXT handling may hold clues on how to do this. If someone wants to pick this up please do, otherwise I'll try to get back to it at some point.
Comment 30 Simon Montagu :smontagu 2011-05-05 06:00:31 PDT
Created attachment 530287 [details] [diff] [review]
Use SetMenuItemInfo instead of EnableMenuItem

Apparently the spurious button painting is a side-effect of calling EnableMenuItem, and SetMenuItemInfo doesn't have the side-effect.
Comment 31 Jim Mathies [:jimm] 2011-05-05 06:16:40 PDT
Comment on attachment 530287 [details] [diff] [review]
Use SetMenuItemInfo instead of EnableMenuItem

They must repaint the buttons when you change the menu state.. tricky tricky.
Comment 32 Simon Montagu :smontagu 2011-05-05 06:17:42 PDT
Created attachment 530291 [details]
LTR version of the bug

By the way, the bug is reproducible without forcing RTL UI, as long as one uses a Firefox theme which changes the appearance of the control buttons.
Comment 33 :Ehsan Akhgari 2011-05-05 16:28:13 PDT
Comment on attachment 530264 [details] [diff] [review]
menu patch

Do we still want this?
Comment 34 Jim Mathies [:jimm] 2011-05-06 04:47:19 PDT
Comment on attachment 530264 [details] [diff] [review]
menu patch

I believe we still want this but I'll defer to Simon on it..
Comment 35 Simon Montagu :smontagu 2011-05-06 07:57:09 PDT
There are tryserver builds with attachment 530287 [details] [diff] [review] at http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/smontagu@mozilla.com-e9b2acd4baff/try-win32/

If someone can confirm that this fixes the bug in WinXP also, that would be great.
Comment 36 Simon Montagu :smontagu 2011-05-06 08:00:49 PDT
Comment on attachment 530264 [details] [diff] [review]
menu patch

What effect does this have exactly on an LTR Windows system?
Comment 37 Jim Mathies [:jimm] 2011-05-06 08:22:57 PDT
(In reply to comment #36)
> Comment on attachment 530264 [details] [diff] [review] [review]
> menu patch
> 
> What effect does this have exactly on an LTR Windows system?

It flips the alignment of the text in the system context menu. I thought that was part of this bug.
Comment 38 Simon Montagu :smontagu 2011-05-07 12:39:32 PDT
Comment on attachment 530264 [details] [diff] [review]
menu patch

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

Oh, sorry, I misunderstood comment 27.

Unfortunately, when I tested the patch on Hebrew Windows 7, it makes the system menu LTR when Firefox UI is RTL, which we don't want. I'd like to check out what it does on Hebrew XP, but I won't have access to an XP system until sometime next week.
Comment 39 Jim Mathies [:jimm] 2011-05-07 12:46:09 PDT
(In reply to comment #38)
> Comment on attachment 530264 [details] [diff] [review] [review]
> menu patch
> 
> Review of attachment 530264 [details] [diff] [review] [review]:
> -----------------------------------------------------------------
> 
> Oh, sorry, I misunderstood comment 27.
> 
> Unfortunately, when I tested the patch on Hebrew Windows 7, it makes the
> system menu LTR when Firefox UI is RTL, which we don't want. I'd like to
> check out what it does on Hebrew XP, but I won't have access to an XP system
> until sometime next week.

I was worried about that. I think we should only apply the flag when fx is ltr, and the os is rtl. (Although I guess it'll still be in english I think, regardless of the language firefox is using.)
Comment 40 Jim Mathies [:jimm] 2011-05-07 12:46:47 PDT
(In reply to comment #39)
> (In reply to comment #38)
> > Comment on attachment 530264 [details] [diff] [review] [review] [review]
> > menu patch
> > 
> > Review of attachment 530264 [details] [diff] [review] [review] [review]:
> > -----------------------------------------------------------------
> > 
> > Oh, sorry, I misunderstood comment 27.
> > 
> > Unfortunately, when I tested the patch on Hebrew Windows 7, it makes the
> > system menu LTR when Firefox UI is RTL, which we don't want. I'd like to
> > check out what it does on Hebrew XP, but I won't have access to an XP system
> > until sometime next week.
> 
> I was worried about that. I think we should only apply the flag when fx is
> ltr, and the os is rtl. (Although I guess it'll still be in english I think,
> regardless of the language firefox is using.)

eh, when fx is rtl, and the os is ltr!
Comment 41 Simon Montagu :smontagu 2011-05-07 12:52:00 PDT
I'm in two minds about this. Maybe we should always use the OS direction since the menu will always be in the OS language?
Comment 42 Jim Mathies [:jimm] 2011-05-08 07:39:02 PDT
(In reply to comment #41)
> I'm in two minds about this. Maybe we should always use the OS direction
> since the menu will always be in the OS language?

Fine with me, but I don't use rtl versions so I don't know how seriously rtl users take something like that. I'd suggest we file a follow up if we consider it serious enough and land your fix here for the bigger problem.
Comment 43 :Ehsan Akhgari 2011-05-10 15:57:06 PDT
(In reply to comment #41)
> I'm in two minds about this. Maybe we should always use the OS direction since
> the menu will always be in the OS language?

Yes, I think that is what we should do.
Comment 44 Simon Montagu :smontagu 2011-05-11 00:47:29 PDT
Pushed http://hg.mozilla.org/mozilla-central/rev/1f5db39fbb1a after Dror confirmed on IRC that the patch fixes XP also.

Note You need to log in before you can comment on or make changes to this bug.