Closed Bug 596516 Opened 14 years ago Closed 9 years ago

On glass, the caption button box gets rendered black if #main-window is not -moz-win-borderless-glass...

Categories

(Core :: Widget: Win32, defect)

x86
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 601603
Tracking Status
blocking2.0 --- -

People

(Reporter: alfredkayser, Assigned: Felipe)

References

Details

On glass, the caption button box gets rendered black if #main-window is not -moz-win-borderless-glass...

In Area/Compositor/Glass mode the caption buttons (min/max/close) are always drawn using the system api for this, even if it doesn't have -moz-appearance set.

Evidence:
Bug 575870 - Implement the firefox button on xp, classic, and aero basic[/url]
which added the following code:
  @media all and (-moz-windows-compositor) {
 +  /* these should be hidden w/glass enabled. windows draws it's own buttons. */
 +  #titlebar-buttonbox {
 +    display: none;
 +  }[/code]. 
What I deduce from this is that on Win7/Vista with Glass enabled, the caption buttons are draw always (even if one wants to style the button box yourself).

Even more, as described in Bug 554982 - Current Aero implementation is using default Aero borders in main window, the #main-window must have :
-moz-appearance:-moz-win-borderless-glass;
background:transparent

Otherwise, rendering of the caption box goes wrong and results in black box. See: http://imagepaste.nullnetwork.net/viewimage.php?id=1292

For themes that want to do full theming/styling, this is a problem, as there is no way to overrule styling of the caption box, and one has to apply transparancy to main-window (even if one doesn't want to...)

This is all only for Win 7 with Glass enabled, and currently AMO rejects themes because of this bug.
Same effect for me:

http://i54.photobucket.com/albums/g112/mcdavis941/bug596516screenshot.png

That's with -moz-appearance: none on all the major window elements (window, toolbox, toolbars, toolbarbuttons, etc.).

On Vista.

Mozilla/5.0 (Windows NT 6.0; WOW64; rv:2.0b7pre) Gecko/20100914 Firefox/4.0b7pre
They are problems of theme with a theme no Mozilla on Vista/7.
Here are 2 screenshots with Walnut 1.8.64 and Firefox 4 beta 6 on Vista 64 bits.
http://www.aidesetastuces.fr.nf/images/fx4b6bug1.png
http://www.aidesetastuces.fr.nf/images/fx4b6bug2.png
I tested other themes, but it's worse.
This is a big issue for theme authors, so I'm nominating it as a blocker.

Alfred, can you please attach a minimal testcase? The most basic theme you can create that triggers this bug.
blocking2.0: --- → ?
Assignee: nobody → felipc
This depends on the solution for bug 601603, which will simplify this one.


On the theme, it will likely work like this: there is the #titlebar-buttonbox element which contains 3 elements for the min/max/close buttons, all of which have a specific -moz-appearance.

If you remove that -moz-appearance you'll be able to style your own buttons, and the black area won't show. How does that sound? Is that what theme authors would expect?


P.S. no need for a testcase
Depends on: 601603
(In reply to comment #4)
> If you remove that -moz-appearance you'll be able to style your own buttons,
> and the black area won't show. How does that sound? Is that what theme authors
> would expect?

That sounds good to me, depending on what exactly is required to get sizes and alignment right.  For example, it would be (obviously) a problem for themes if they needed to use a certain -moz-appearance keyword to access system-defined sizes, if that -moz-appearance keyword also set colors or other appearance values.
(In reply to comment #1)
> Same effect for me:
> That's with -moz-appearance: none on all the major window elements (window,
> toolbox, toolbars, toolbarbuttons, etc.).

Going back to the original topic of this bug ... AFAICT, using -moz-win-borderless-glass on #main-window gets me what I need.  I'm setting that and a background image on #main-window with background-position: 0px 8px, which lets the top border show through and gives the appearance of having normal glass borders on all four sides.  See the following screenshot.
The situation is already better now with the landing of bug 601603. You can style the buttons however you want and a black box won't show if you remove the native -moz-appearance: -moz-window-button-box{-maximized} from the #titlebar-buttonbox element.

Theme authors: please check the current nightlies and let me know what else is needed for theming the caption buttons.
Windows places caption buttons on glass windows by default. Skinning windows caption buttons is not possible. The way we could address this would be to provide a style |-moz-windows-nocaptionbuttons| that theme developers can apply to top level windows. Theme authors would then create and manage replacement buttons.

Removing -moz-appearance:-moz-win-borderless-glass on the main-window is not the way to solve this. Doing so will have unexpected results. See:

http://www.aidesetastuces.fr.nf/images/fx4b6bug1.png

The upper corner on the window will be messed up. We have to have some glass on top (about 8 px I think) to get rounded window corners.
(In reply to comment #9)
> provide a style |-moz-windows-nocaptionbuttons| 

That seems OK, if I understand what you're saying.  Would that be the value of -moz-appearance for the main window element (#main-window)?

By 'create and manage replacement buttons', you're talking about styling #titlebar-buttonbox and its .titlebar-button children, right?
Component: Widget: Win32 → Widget: Qt
Target Milestone: --- → mozilla2.0b7
(In reply to comment #8)

> Theme authors: please check the current nightlies and let me know what else is
> needed for theming the caption buttons.

My current issues are:
 
1 - aligning my self-styled caption buttons with the glow (which appears above and outside with window frame) coming from hovered system-styled caption buttons  

2 - misalignment between the right edge of the system-styled caption button and the background of the main window element, as you can see here:

http://i54.photobucket.com/albums/g112/mcdavis941/bug596516screenshot3.png

jimm's proposal from comment 9 seems like it would address both of those.  If there's no way to disable the glow, or undesirable to do that for some other reason, then I could try to deal with that by using a similar glow in my self-styled caption buttons.

Question: could you say whether you are or are not doing any masking/clipping of content to let the system-drawn caption buttons show through from behind?
(In reply to comment #10)
> (In reply to comment #9)
> > provide a style |-moz-windows-nocaptionbuttons| 
> 
> That seems OK, if I understand what you're saying.  Would that be the value of
> -moz-appearance for the main window element (#main-window)?

yes

> 
> By 'create and manage replacement buttons', you're talking about styling
> #titlebar-buttonbox and its .titlebar-button children, right?

yes

> Question: could you say whether you are or are not doing any masking/clipping
> of content to let the system-drawn caption buttons show through from behind?

We clear the content that is over the caption buttons if -moz-win-glass is applied to #main-window and -moz-titlebar-buttonbox is applied to #titlebar-buttonbox.

(when this bug was filed - and its original intent -, if the first condition wasn't met we'd clear them to a black area, but that has long been fixed in bug 601603 by adding the second condition).

> 1 - aligning my self-styled caption buttons with the glow (which appears above
> and outside with window frame) coming from hovered system-styled caption
> buttons  

I don't think it'll be possible to keep the outside glow at all for custom themed buttons as you meant. The only way to make custom buttons work is to remove the ones provided by Windows, and it is the OS that produces the glow outside of the window.

> 2 - misalignment between the right edge of the system-styled caption button
> and the background of the main window element, as you can see here:

I don't know why that is like that. I thought it was a Windows thing..
Assignee: felipc → nobody
Component: Widget: Qt → Widget: Win32
(sorry I didnt mean to reset the assignee flag, only to move it back to Widget::Win32)
Assignee: nobody → felipc
(In reply to comment #13)
> back to Widget::Win32

From history, it looks like that was my doing, sorry about that.  Looks like I also managed to change target milestone from '---' to 'mozilla2.0b7', so back to '---' now.
Target Milestone: mozilla2.0b7 → ---
(In reply to comment #12)
> I don't think it'll be possible to keep the outside glow at all for custom
> themed buttons as you meant. The only way to make custom buttons work is to
> remove the ones provided by Windows, and it is the OS that produces the glow
> outside of the window.
> 

Thanks, that sounds good.  I wanted to make sure removing the buttons also removed the glow.
The bug is back in Firefox with Walnut Theme, in a recent 4b8pre, but differently.
Here is a screenshot on Vista and Walnut Theme 1.8.67 (by Alfred Kayser):
http://www.aidesetastuces.fr.nf/images/fx4b8pre-bug.png
No visuals buttons but clicks areas are there yet...
These zones clicks are modeled on those of Windows.
I believe this bug no longer would apply on the Win10 theme, and most of the impediments for theme authors have been fixed or made workable by bug 601603, as mentioned in comment 4 and 8 here.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.