Closed Bug 397717 Opened 18 years ago Closed 18 years ago

[10.5] Advanced Preferences Pane tabs render incorrectly

Categories

(Core Graveyard :: Widget: Mac, defect)

1.8 Branch
x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: marcia, Assigned: cbarrett)

References

Details

Attachments

(3 files, 1 obsolete file)

Attached image Screenshot of issue
Seen using Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.8pre) Gecko/2007092505 BonEcho/2.0.0.8pre. STR: 1. Go to the advanced preference pane 2. Observe the attached screenshot.
mozilla/gfx/src/mac/nsNativeThemeMac.cpp In Mac OS X 10.5, Appearance Manager draws new-style tabs by default. There is no way to change the control version back to the old-style tabs that it draws on 10.4. If we rewrote the tab-rendering code to use HITheme we could specify the old tab type, but HITheme is 10.3+ and we have to support 10.2. Apple should not have changed this Appearance Manager behavior, yuck. Here are our options: 1. Don't fix this bug (bad) 2. Rewrite our code to use new-style tabs (very hard, very risky). This is hard because new-style tabs have certain layout requirements that complicate things, like the fact that tabs draw over the selected panel by about 10-15 pixels. Also 10.2 doesn't support new-style tabs (iirc) so we'd have to special case that all over. 3. Use weak linking an 10.5 special casing to render tabs with HITheme on 10.5 I guess we're going with option 3. Lets hope HITheme plays nice with Quickdraw.
I see this issue on Thunderbird trunk as well. There are a number of preferences panels that don't render correctly.
I just noticed this happens in the Page Info dialog as well in Firefox 2.0.0.8.
Assignee: joshmoz → cbarrett
Looks like hurdle #1 is going to be the fact that HIThemeDrawTab wants a CGContext, but we're drawing with QuickDraw. Fantastic.
IIRC, mento had some interesting code in the bug where we toyed with doing 10.3-style tabs that also addressed that hurdle. I think. (But then my memory's not what it used to be anymore, apparently.)
Does QA have a machine I can test this on 10.2 with?
(In reply to comment #8) > Does QA have a machine I can test this on 10.2 with? > Yes, we have a PPC machine in the lab which has all flavors.
See bug 231313. I got this working in the past (but the tabs had to be above the pane they control, see that bug) but the system left blue turds behind in the separators between tabs. I couldn't get rid of the turds, so the patch didn't go anywhere. (It was hard to find because it's assigned to Josh, even though the experimental code was mine.) Apple shouldn't have changed this without accounting for the ugly lack of end caps. This will be a little annoying to fix with weak linking if you're still building ppc with the 10.2.8.sdk. It should be a breeze if you can build ppc with the 10.3.9.sdk (while still targeting 10.2), which is a definite possibility, but that might be changing too much for a stable branch.
Assignee: cbarrett → joshmoz
Component: Widget: Cocoa → Widget: Mac
QA Contact: cocoa → mac
Assignee: joshmoz → cbarrett
Attached patch fix 1.0 (obsolete) — Splinter Review
I load the symbol for HIThemeDrawTab at runtime, and this code will only run on 10.5. Works fine on my 10.5 machine (running the outdated 9a528d, unfortunately).
Attachment #285535 - Flags: review?(joshmoz)
Attached patch fix 1.0.1Splinter Review
Fix a whitespace problem, I hope.
Attachment #285535 - Attachment is obsolete: true
Attachment #285538 - Flags: review?(joshmoz)
Attachment #285535 - Flags: review?(joshmoz)
I have a couple more whitespace fixes, will fix on checkin (or in the next round of this patch if there are review comments)
Comment on attachment 285538 [details] [diff] [review] fix 1.0.1 Can you put the start and end CGContext code into separate functions like in the NPAPI example code? If we ever need that again it'll be nice, and it is easy code to separate out.
Comment on attachment 285538 [details] [diff] [review] fix 1.0.1 + // Get a CGContext from our QuickDraw port fo HITheme to draw into. "fo" -> "for" + HIThemeTabDrawInfo tdi; This makes it so you can only compile against an SDK that has HITheme. I think we have tinderboxes compiling against the 10.2 SDK. Did you have a reason why this would be OK? Otherwise I think you need to copy the definition of HIThemeTabDrawInfo into our source.
Attachment #285538 - Flags: review?(joshmoz) → review-
(In reply to comment #15) > (From update of attachment 285538 [details] [diff] [review]) > + // Get a CGContext from our QuickDraw port fo HITheme to draw into. > > "fo" -> "for" Fixed > + HIThemeTabDrawInfo tdi; > > This makes it so you can only compile against an SDK that has HITheme. I think > we have tinderboxes compiling against the 10.2 SDK. Did you have a reason why > this would be OK? Otherwise I think you need to copy the definition of > HIThemeTabDrawInfo into our source. Nope, I just overlooked it. Any suggestions on where to put that definition? Just at the top of this file? When can be back in the MV office I plan to test compile whatever patch I have at that point on a 10.2 machine to make sure it builds and produces a working build.
(In reply to comment #14) > (From update of attachment 285538 [details] [diff] [review]) > Can you put the start and end CGContext code into separate functions like in > the NPAPI example code? If we ever need that again it'll be nice, and it is > easy code to separate out. Sure. should I just have them in this same file?
We can use the new API on 10.3 and up, can't we? If so, we can cut code size for the Intel build a little bit if we use some preprocessor magic to eliminate the old codepath on that platform. You can use the code referenced in comment 10 as a guide.
To clarify Mark's comment, he is talking about the fact that we don't need to include the Appearance Manager code path on Intel because all Intel machines have access to HITheme.
(In reply to comment #18) > We can use the new API on 10.3 and up, can't we? > > If so, we can cut code size for the Intel build a little bit if we use some > preprocessor magic to eliminate the old codepath on that platform. You can use > the code referenced in comment 10 as a guide. The code in comment 10 doesn't have any preprocessor magic in it? Is it just #ifdef PPC for Mozilla code? I'll get back to this bug when I'm back in the office, since it will be much easier to make sure this works right with access to a 10.2 machine.
Guess I didn't mean comment 10, then. Sorry, I meant the TransitionWindowWithOptions stuff in widget/src/mac/nsMacWindow.cpp. You can actually avoid the CFBundle loading stuff and eliminate the extra codepaths on x86. The general idea is: // begin mento-section #if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_3 // SDK is older than 10.3 // Declare things that aren't declared in the 10.2 SDK. Your patch doesn't // do this and won't build for ppc in the official build environment without // taking this into account. typedef struct HIThemeTabDrawInfo { UInt32 version; ... } HIThemeTabDrawInfo; #endif typedef OSStatus (*funcptr)(...); #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3 // The compiler will warn about this, but it results in the "else" clause // being stripped. This is exactly what we want. You can avoid the // warning with an extra #if around the "else" clause below instead of // writing if (1) here, but be sure to leave all {scoping} the same no // in all preprocessing cases. if (1) #else // I recommend using nsToolkit::OSXVersion() to avoid duplicated code. // Also, it caches the version avoiding repeated calls, and it'll probably // eliminate the "gestalt failed, do nothing" case in your patch. You can // use widget/src/mac/nsToolkit from gfx on this branch. if (nsToolkit::OSXVersion() >= MAC_OS_X_VERSION_10_3_HEX) #endif { funcptr f; #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3 // Deployment target is 10.3 or higher, we can link against this directly f = ::HIThemeDrawTab; #else // Deployment target is less than 10.3, need to look up the symbol at // runtime. This isn't weak linking, that's something else. Weak // linking would be even more painful to use here because we support // building with the 10.2 SDK. (The details of the differences between // this and weak linking are beyond scope here, but talk to me if you're // interested.) f = (funcptr)::CFBundleGetFunctionPointerForName(..., "HIThemeDrawTab"); #endif // end mento-section, begin cbarrett-section // new codepath using the new stuff you wrote f(...); } else { // existing codepath, old API ::DrawThemeTab(...) }
Great, thanks Mark. Yeah, I know the difference between getting a symbol at runtime and weak linking, just failed to indicate that in the comments :\
I think I forgot to add at some point that the same thing happens on trunk builds with the Advanced Preferences pane, although it the tabs look a bit different. Page Info is not affected because we changed the layout for FF 3.
Apple fixed this bug in the final release of Mac OS X 10.5. We don't have to fix it on our end any more.
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: