Closed Bug 376408 Opened 17 years ago Closed 15 years ago

[vista] corners of tooltips not transparent (opacity wrong)

Categories

(Core :: Widget: Win32, defect, P4)

x86
Windows Vista
defect

Tracking

()

VERIFIED FIXED
mozilla1.9.2a1

People

(Reporter: info.ldr, Assigned: jimm)

References

Details

(Keywords: polish, Whiteboard: [polish-hard][polish-visual][polish-p2])

Attachments

(5 files, 2 obsolete files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; de; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3

Vista tool tips are not rectangular, they're rounded at the corners.
With the default theme they appear as rectangle, the empty space at the corners is filled with black instead of being transparent. It's just a little cosmetic problem. (I'll add a screenshot as attachment)

Reproducible: Always

Steps to Reproduce:
1. Hover a toolbar button to see a tool tip



Default theme
Attached image Screenshot
Version: unspecified → 2.0 Branch
Don't see any dupes, but I definitely see this issue. Confirming...
Status: UNCONFIRMED → NEW
Component: General → OS Integration
Ever confirmed: true
Keywords: polish
QA Contact: general → os.integration
Summary: Tooltips Vista - Opacity → [vista] corners of tooltips not opaque (opacity wrong)
Version: 2.0 Branch → Trunk
Attached image Comparision shots
Just confirming and adding a clearer screenshot. It seems like it wouldn't be that noticible but it is, you really pick up on it. (imho)
The problem is that they *are* opaque in Firefox. Fixing summary.
Summary: [vista] corners of tooltips not opaque (opacity wrong) → [vista] corners of tooltips not transparent (opacity wrong)
Component: OS Integration → Themes
Product: Firefox → Core
QA Contact: os.integration → themes
As you can see in attachment 330811 [details] the corners can also have a white background.
Flags: wanted1.9.1?
Component: Themes → Widget: Win32
QA Contact: themes → win32
If we can't fix the window issue easily (and I'm not sure how we'd do that -- we'd have to create the right window style possibly?), then we should stop using the rounded corners, IMO.
Flags: wanted1.9.1? → wanted1.9.1+
Priority: -- → P4
Shouldn't this be as simple as creating a rounded-corner rectangle region (CreateRoundRectRgn [1]) and setting it as the tooltip window's region (SetWindowRgn [2])?  I just don't know where to do that, or I'd come up with a patch...

[1] http://msdn.microsoft.com/en-us/library/ms536690(VS.85).aspx
[2] http://msdn.microsoft.com/en-us/library/ms534845(VS.85).aspx
I don't think it's that simple - the OS theme decides what's transparent and what's not; I expect you'd need to make the window an alpha blended window that's entirely transparent, then draw the theme into it. (I don't think it's necessarily limited to Vista in that regard, either.)
(In reply to comment #9)
> I don't think it's that simple - the OS theme decides what's transparent and
> what's not; I expect you'd need to make the window an alpha blended window
> that's entirely transparent, then draw the theme into it. (I don't think it's
> necessarily limited to Vista in that regard, either.)

Hmmm, using SetWindowRgn does not make some areas transparent, it excludes them from the window content, so effectively whatever gets painted on them is not visible.  This is of course assuming that tooltips in Gecko on Windows are implemented using a separate window with its own HWND, etc.
This bug is still out there. The background of the rectangle is now white, however. Bringing Vladimir's comment again; instead of implementing rounded tooltips, how about square ones on Windows? At least they would render as intended and not sully the first impression (IMHO).
this bug is eligible for bug 462080
Whiteboard: [polish-hard][polish-visual]
Blocks: wine
Assignee: nobody → jmathies
Blocks: 458864
Attached patch tooltip region theme fix v.1 (obsolete) — Splinter Review
This addresses the problem, but unfortunately it’s not a generic solution. Some background – with the exception of text tooltips are drawn by the theme module, including the background gradient and the border. Tooltip windows do not use transparency, but they do use a window clipping region to clip out certain parts of the window from being displayed. (This should be set via SetWindowRgn.)  Setting the window region does two things – it completely clips out the corners of the tooltip window, and it causes windows to adjust the drop shadow inward so that both the tooltip corners and the surrounding drop shadow effect are displayed correctly. 

Window regions are peculiar, they need to be set and cleared at specific times – on window creation and any time the window is resized or moved. To fix the tooltip problem, the region we have to set doesn’t come from a generic region creation routine like CreateRoundedRectRgn, it comes from the native windows theme library though GetThemeBackgroundRegion.

A generic solution in nsWindow would involve calls into the theme lib to check to see if the window’s widget is themed. Unfortunately to do that we need to call nsNativeThemeWin’s GetThemePartAndState with a frame pointer and some style information indicating the type of widget being displayed. nsWindow though doesn’t have access to that info AFAICT.

So this is start on a fix. It only applies regions on tooltips, and it hard codes a couple tooltip constants that would come from GetThemePartAndState for NS_THEME_TOOLTIP. I’ll keep looking at this but I thought I’d post what I have in case anyone has any ideas / comments.
Attached patch tooltip region theme fix v.2 (obsolete) — Splinter Review
This is cleaned up version of this patch. I have an experimental patch that handles this in a more generic way which passes style information down through the widget interface. But in the end I decided that since transparency isn't effected in this case by the style's 'part' and 'state', there's no need to bring that information down. ['part' is the part of the overall widget we are working on (left border, right border, button face, ..) and 'state' is the state of the part (hover, disabled, enabled, ..)] In the current case with tooltips we are dealing with the entire window only, so these values are set to defaults.

Somewhere down the line widgets might have window clipping regions that change based on state, in which case nsWindow would need access to an nsIFrame pointer and the widget type. (See nsNativeThemeWin's GetThemePartAndState for more info.)
Attachment #360933 - Attachment is obsolete: true
Attachment #362888 - Flags: review?(vladimir)
This is a slight update to the original that adds support for popup panels, which addresses a the same issue in a few other window - 

http://img234.imageshack.us/img234/4803/31416834jb2.jpg
https://bugzilla.mozilla.org/attachment.cgi?id=330811
Jim, These screenshots show the problem (not the solution), right?
(In reply to comment #18)
> Jim, These screenshots show the problem (not the solution), right?

Correct, this patch corrects these issues.
Comment on attachment 363210 [details] [diff] [review]
tooltip region theme fix v.3

sorry, missed the review request on this -- this looks fine
Jim, I took a look at your patch and it looks like it would be a good candidate for Firefox 3.5. Are you ok with this?
(In reply to comment #21)
> Jim, I took a look at your patch and it looks like it would be a good candidate
> for Firefox 3.5. Are you ok with this?

Sure, let me get it landed and lets request approval.
Attachment #363210 - Flags: superreview?(roc)
Attachment #362888 - Flags: review?(vladimir)
Attachment #362888 - Attachment is obsolete: true
Attachment #363210 - Flags: superreview?(roc) → superreview+
landed on mozilla-central:
http://hg.mozilla.org/mozilla-central/rev/593d36f8c437
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Attachment #363210 - Flags: approval1.9.1?
Has this caused Bug 485484?
(In reply to comment #24)
> Has this caused Bug 485484?

It shouldn't since the region settings are only applied when nsUXThemeData::sIsVistaOrLater is true.
(In reply to comment #25)
> (In reply to comment #24)
> > Has this caused Bug 485484?
> 
> It shouldn't since the region settings are only applied when
> nsUXThemeData::sIsVistaOrLater is true.

It might be the clear region call, which is applied to all windows. But I wouldn't think clearing the window region would cause problems with xp's native theme drawing of window borders. We could test to find out.
Attached patch xp touchup patchSplinter Review
Touchup patch to address xp border bug in bug 485484.
Attachment #369704 - Flags: review?(vladimir)
xp touchup patch landed on mozilla-central:
http://hg.mozilla.org/mozilla-central/rev/9e33f1b0a4dc
Jim, the rounded corners still show two white pixels for me with Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a1pre) Gecko/20090403 Minefield/3.6a1pre. Should this be handled in another bug?
Target Milestone: --- → mozilla1.9.2a1
(In reply to comment #29)
> Jim, the rounded corners still show two white pixels for me with Mozilla/5.0
> (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a1pre) Gecko/20090403
> Minefield/3.6a1pre. Should this be handled in another bug?

You know I noticed this as well, and was able to deal with it somewhat by doing a double pass on the rendering. But in the end I took that out because if you look around at some other tooltips on Vista, especially down on the quick launch bar and other applications, you'll see the same anomaly. So I came to conclusion this was a short coming in the windows themeing GetBackgroundRegion code, and not in our use of it.
Thanks for the explanation Jim. I tried to make it visible with IE7 and its easy when hovering the home button. So everything we can do is fine.

Verified fixed with Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2a1pre) Gecko/20090403 Minefield/3.6a1pre
Status: RESOLVED → VERIFIED
Attachment #363210 - Flags: approval1.9.1? → approval1.9.1+
Comment on attachment 363210 [details] [diff] [review]
tooltip region theme fix v.3

a191=beltzner for this and the XP touchup patch
Verified on 1.9.1 with Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1b4pre) Gecko/20090414 Shiretoko/3.5b4pre ID:20090414044032
Keywords: verified1.9.1
Attachment #363210 - Flags: approval1.9.1+
Is there anyway this can reland on branch?
Depends on: 489912
This bug's priority relative to the set of other polish bugs is:
P2 - Polish issue that is in a secondary interface, occasionally encountered, and is easily identifiable.

tooltips are secondary UI, but this bug was also easily identifiable.
Whiteboard: [polish-hard][polish-visual] → [polish-hard][polish-visual][polish-p2]
No longer depends on: 489912
I'm no expert in bugzilla, but shouldn't this not be "VERIFIED FIXED" since it never landed?
This landed on trunk successfully. It was only backed out on branch. It will be fixed in Firefox 3.6.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: