Closed Bug 610643 Opened 14 years ago Closed 14 years ago

Firefox 4 doesn't render the title bar precisely when maximized in Windows XP

Categories

(Core :: Widget: Win32, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
blocking2.0 --- final+

People

(Reporter: jhnpwa, Assigned: jimm)

References

(Blocks 1 open bug)

Details

(Keywords: polish)

Attachments

(5 files, 10 obsolete files)

11.75 KB, text/html
Details
3.52 KB, image/png
Details
2.63 KB, patch
neil
: review+
Details | Diff | Splinter Review
4.05 KB, patch
neil
: review+
dao
: review+
Details | Diff | Splinter Review
15.59 KB, image/png
Details
User-Agent:       Mozilla/5.0 (Windows NT 5.1; rv:2.0b6) Gecko/20100101 Firefox/4.0b6
Build Identifier: Mozilla/5.0 (Windows NT 5.1; rv:2.0b6) Gecko/20100101 Firefox/4.0b6

The title bar rendered by Firefox is very different from the original Microsoft one.

Reproducible: Always

Steps to Reproduce:
1. Hide the menu bar.
2. Maximize the window.
3. Compare it to other window which contain a title bar painted by Windows XP.(IE8, Firefox 3, Windows Explorer etc.)
Actual Results:  
The title bar painted by Firefox is different.

Expected Results:  
The title bar painted by Firefox is pixel perfect.

A comparison between IE8 and Firefox version 4.0b6 is attached.
Component: Shell Integration → Theme
QA Contact: shell.integration → theme
Component: Theme → Widget: Win32
Depends on: 574454
Product: Firefox → Core
QA Contact: theme → win32
Blocks: 574454
No longer depends on: 574454
We seem to be missing a lighter upper border for some reason.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: polish
Summary: Firefox 4 beta 6 don't render the title bar precisely when maximized in Windows XP → Firefox 4 doesn't render the title bar precisely when maximized in Windows XP
Also, the left and right sides should be darker. We have front-end code that cuts off these areas, which seems slightly bogus:

308 #titlebar {
309   -moz-appearance: -moz-window-titlebar;
310   /* we only need to the middle section, hide the edges of the
311   theme background beyond the window frame. */
312   margin-left: -15px;
313   margin-right: -15px;
314 }
FWIW, Opera lacks the upper border as well.
(In reply to comment #3)
> Also, the left and right sides should be darker. We have front-end code that
> cuts off these areas, which seems slightly bogus:
> 
> 308 #titlebar {
> 309   -moz-appearance: -moz-window-titlebar;
> 310   /* we only need to the middle section, hide the edges of the
> 311   theme background beyond the window frame. */
> 312   margin-left: -15px;
> 313   margin-right: -15px;
> 314 }

Unfortunately that's unavoidable. The win theme lib doesn't offer a titlebar inner section background. We have to render the whole thing including edges. Since we only want the inner part, we have to push the edged out of view.

We might be able to compensate here by decreasing the margin values so borders are off screen but the immediate border area we want is visible.
(In reply to comment #3)
> 312   margin-left: -15px;
> 313   margin-right: -15px;

Remove those two on aero basic and you'll see the problem.
We might be able to do the right clipping down in the theme lib as well. We have more info down there on the os/desktop settings. I'll see what I can work up.
Attached patch top border fix (obsolete) — Splinter Review
This addresses the missing top border when the window is maximized.
Assignee: nobody → jmathies
requesting blocking so the patches here can land.
blocking2.0: --- → ?
Attached patch corners v.1 (obsolete) — Splinter Review
(In reply to comment #10)
> Created attachment 490405 [details] [diff] [review]
> corners v.1

This addresses the problem, but it has the funny side effect of squishing all the titlebar content in. Dao, any ideas? I'll attach a screen shot.
Attached image titlebar squished (obsolete) —
(In reply to comment #11)
> (In reply to comment #10)
> > Created attachment 490405 [details] [diff] [review] [details]
> > corners v.1
> 
> This addresses the problem, but it has the funny side effect of squishing all
> the titlebar content in. Dao, any ideas? I'll attach a screen shot.

doh! right below it.
Attached patch corners (obsolete) — Splinter Review
Attachment #490405 - Attachment is obsolete: true
Attachment #490406 - Attachment is obsolete: true
Attached patch classic edges (obsolete) — Splinter Review
with the other changes, this fixes maximized windows in classic mode - remove the edges and paint the gradient across the entire titlebar.
Attached patch corners (obsolete) — Splinter Review
no need for the zero margins, they should reset on their own.
Attachment #490407 - Attachment is obsolete: true
fix for classic mode, the buttons are inset by one additional pixel.
Comment on attachment 490410 [details] [diff] [review]
corners

>-#titlebar {
>+#main-window[sizemode="normal"] > #titlebar {
>   -moz-appearance: -moz-window-titlebar;
>   /* we only need to the middle section, hide the edges of the
>   theme background beyond the window frame. */
>   margin-left: -15px;
>   margin-right: -15px;
> }

This is actually a bit off for sizemode=normal too. Can we decrease the values or handle this in widget code as suggested earlier?
(In reply to comment #18)
> Comment on attachment 490410 [details] [diff] [review]
> corners
> 
> >-#titlebar {
> >+#main-window[sizemode="normal"] > #titlebar {
> >   -moz-appearance: -moz-window-titlebar;
> >   /* we only need to the middle section, hide the edges of the
> >   theme background beyond the window frame. */
> >   margin-left: -15px;
> >   margin-right: -15px;
> > }
> 
> This is actually a bit off for sizemode=normal too. Can we decrease the values
> or handle this in widget code as suggested earlier?

On which theme are you seeing an issue?

I don't think we want to do this down in widget because if we ever get around to implementing bug 590945, we're going to need the corners. (Alternatively I guess we could create matching titlebar corner styles, but that is probably more hassle than just doing the stretching here for now.)
XP Luna. It looks right if I change the margins to -4px.
(In reply to comment #20)
> XP Luna. It looks right if I change the margins to -4px.

Hmm, that value needs to be equal to the border frame width, which changes based on the theme and user customizations.

I'm not see anything wrong though on Luna, can you post a screen shot of the problem?
Attached patch corners (obsolete) — Splinter Review
Alright, updated patch that does the clipping in widget. I'll file a follow up on implementing titlebar left edge and right edge appearance styles. 

I need to throw all this at try and do a bunch of testing.
Attachment #490410 - Attachment is obsolete: true
Blocks: 612026
Attached patch classic edges (obsolete) — Splinter Review
Fixes a couple problems in classic mode.
Attachment #490409 - Attachment is obsolete: true
Attachment #490483 - Attachment is patch: true
Attached patch theme changes (obsolete) — Splinter Review
makes sure button metrics get refreshed when flipping between themes.

I just pushed this last set to try, if everything looks good I'll kick off some reviews.
Blocks: 586233
Attached patch theme changesSplinter Review
Attachment #490484 - Attachment is obsolete: true
Attachment #490404 - Flags: review?(neil)
Attachment #490411 - Flags: review?(dao)
Comment on attachment 490425 [details] [diff] [review]
corners

Part of this is in 'top border fix'. Clip out the left and right edges as well.
Attachment #490425 - Flags: review?(neil)
Comment on attachment 490483 [details] [diff] [review]
classic edges

Don't draw the edges either now that they're clipped.
Attachment #490483 - Flags: review?(neil)
Comment on attachment 490650 [details] [diff] [review]
theme changes

Sorry neil. One more, reset the button info flags so when the theme changes we refresh button metrics.
Attachment #490650 - Flags: review?(neil)
Comment on attachment 490411 [details] [diff] [review]
classic mode close button padding

I realize this is just continuing the current pattern, but given bug 606160, this seems like the wrong approach.
Attachment #490411 - Flags: review?(dao) → review-
Actually, let make this simpler by combining three into one.
Attachment #490404 - Attachment is obsolete: true
Attachment #490425 - Attachment is obsolete: true
Attachment #490483 - Attachment is obsolete: true
Attachment #490658 - Flags: review?(neil)
Attachment #490404 - Flags: review?(neil)
Attachment #490425 - Flags: review?(neil)
Attachment #490483 - Flags: review?(neil)
Comment on attachment 490658 [details] [diff] [review]
3 in 1 - native themeing changes

r? -> Dao for the browser.css changes in here.
Attachment #490658 - Flags: review?(dao)
Attachment #490411 - Attachment is obsolete: true
Attachment #490658 - Flags: review?(dao) → review+
blocking2.0: ? → final+
Comment on attachment 490650 [details] [diff] [review]
theme changes

>+      nsUXThemeData::InitTitlebarInfo();
Am I going mad or is this the only real change in this patch?
(In reply to comment #35)
> Comment on attachment 490650 [details] [diff] [review]
> theme changes
> 
> >+      nsUXThemeData::InitTitlebarInfo();
> Am I going mad or is this the only real change in this patch?

-  // Use system metrics for pre-vista
-  if (nsWindow::GetWindowsVersion() < VISTA_VERSION) {
-    sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed = PR_TRUE;
-  }
+  // Use system metrics for pre-vista, otherwise trigger a
+  // refresh on the next layout.
+  sTitlebarInfoPopulatedAero = sTitlebarInfoPopulatedThemed =
+    (nsWindow::GetWindowsVersion() < VISTA_VERSION);

This also sets the two flags to false on vista+.
Comment on attachment 490658 [details] [diff] [review]
3 in 1 - native themeing changes

>+  if (aWidgetType == NS_THEME_WINDOW_TITLEBAR) {
>+    // Clip out the left and right corners of the frame, all we want in
>+    // is the middle section.
>+    widgetRect.left -= GetSystemMetrics(SM_CXFRAME);
>+    widgetRect.right += GetSystemMetrics(SM_CXFRAME);
>+  } else if (aWidgetType == NS_THEME_WINDOW_TITLEBAR_MAXIMIZED) {
>+    // The origin of the window is off screen when maximized and windows
>+    // doesn't compensate for this in rendering the background. Push the
>+    // top of the bitmap down by SM_CYFRAME so we get the full graphic.
>+    widgetRect.top += GetSystemMetrics(SM_CYFRAME);
>+  }
>+
>   // For left edge and right edge tabs, we need to adjust the widget
>   // rects and clip rects so that the edges don't get drawn.
>   if (aWidgetType == NS_THEME_TAB) {
This patch seems reasonable although I'd probably like to see an else added before check in.
(In reply to comment #36)
> This also sets the two flags to false on vista+.
I was confused because the bug only claims to relate to XP.
(In reply to comment #38)
> (In reply to comment #36)
> > This also sets the two flags to false on vista+.
> I was confused because the bug only claims to relate to XP.

To fix the xp issue we changed things generically. The old way of doing this was to paint the full titlebar, including left and right sides, on the surface handed into the theme code. Then we stretched the titlbar in css to compensate. 

Originally we were going to handle the whole window frame in xul, but we ended up with just the middle section of the titlebar. So this moves the clipping down into the theme code and removes the stretching from css, which was basically a temporary hack.

I filed off a new bug blocking the full xul frame bug to add titlebar corner widgets. I don't think that's going to get in for 4.0. It's primarily aimed at full persona skinning, but people seem pretty happy with the partial skinning we have now.
(In reply to comment #37)
> Comment on attachment 490658 [details] [diff] [review]
> 3 in 1 - native themeing changes
> This patch seems reasonable although I'd probably like to see an else added
> before check in.

Sure. What we really need to do is over haul this code to use a switch. I've been doing a little cleanup here and there but haven't tackled the whole thing since I don't have the time now.
Blocks: 606160
Attachment #490650 - Flags: review?(neil) → review+
Comment on attachment 490658 [details] [diff] [review]
3 in 1 - native themeing changes

I agree, switch(!)ing to a switch is beyond the scope of this bug.
Attachment #490658 - Flags: review?(neil) → review+
http://hg.mozilla.org/mozilla-central/rev/d9cf761c6af4
http://hg.mozilla.org/mozilla-central/rev/6f14ee061815
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
With a hourly build (build id: 20101129082826) the maximized window looks as it should be, but if it's not then a gray line appears on top of the title bar. See attached screenshot.
And the maximize button is stuck in the maximized form. It should show only one rectangle if the window is not maximized.
(In reply to comment #44)
> With a hourly build (build id: 20101129082826) the maximized window looks as it
> should be, but if it's not then a gray line appears on top of the title bar.
> See attached screenshot.

Odd, I just took a look at 82f2a2e86728, and everything looks fine on Luna. Are there specific steps to reproduce?
I just downloaded the zipped version from http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-central-win32/1291087888/ (which is as far as I know the lasted build at this time) and unzipped it to a different location than the regular Firefox installation.
Strange the nightly build (build ID: 20101130030317) works perfectly
But not every time.

If I go to http://logout.hu/temak/faradt_goz/listaz.php and click on one name next to to avatars, a new window pop-up.

If the original window is not maximized then the new one looks as it should. But when the original is maximized then the new one looks as the attachment.

I guess the problem is that the properties of the maximized and non-maximized title bar get mixed up. It seems that the height comes from the non-maximized, but the "design" from the maximized one. and the gray line above the title bar comes from the height difference from the two design.
(In reply to comment #50)
> But not every time.
> 
> If I go to http://logout.hu/temak/faradt_goz/listaz.php and click on one name
> next to to avatars, a new window pop-up.
> 
> If the original window is not maximized then the new one looks as it should.
> But when the original is maximized then the new one looks as the attachment.
> 
> I guess the problem is that the properties of the maximized and non-maximized
> title bar get mixed up. It seems that the height comes from the non-maximized,
> but the "design" from the maximized one. and the gray line above the title bar
> comes from the height difference from the two design.

Sounds like this will be fixed by bug 575725 or bug 610057.
After enabling the tabs in title bar the rendering of the title bar doesn't looks as a normal title bar.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: