Closed Bug 380203 Opened 17 years ago Closed 17 years ago

Mac scrollbar rendering extremely broken under complex transformations

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9beta1

People

(Reporter: roc, Assigned: cbarrett)

References

Details

Attachments

(2 files)

Attached file testcase
Open the testcase.
-- the scrollbars are in the wrong place (they should be inside the borders)
-- rotate. They are painted in the wrong places, and also with the wrong contents.
-- unrotate and then zoom in. Click in the scrollbar. It disappears.

Perhaps the HITheme APIs can't handle drawing to a context where we have set a transformation matrix? Probably other control drawing has similar problems. We may need to detect the difficult cases and draw to an intermediate offscreen surface to address this (GTK and Windows have similar mechanisms already).
We should figure out if we're going to do something about this for 1.9.
Flags: blocking1.9?
I think we should. The whole reason we've gone through the Cairo pain (well, one of the big reasons) is so that we can do stuff like this.
Also, we support this kind of thing on Windows and Linux. On those platforms we have generic helper classes for native theme rendering that check the graphics state and take a slow path to redirect rendering via an pixmap if necessary. They also have alpha recovery since the native graphics APIs don't support alpha properly, which hopefully Cocoa doesn't need.
I'm pretty sure I know how to do this, but I have to finish a couple other things before I can do it.
Flags: blocking1.9? → blocking1.9+
Assignee: joshmoz → cbarrett
I made a test app that does these same sorts of transforms -- using a different graphics API (NSScroller). It worked great, I didn't need to double buffer. We probably want to draw with that anyway for bug 54488.
Actually, it turns out we don't want to do that -- that rabbit hole goes very, very deep. Better to stick with the current code, which at least draws (mostly) correctly.

It turns out that drawing *any* native form control is completely busted. I modified the above testcase to draw a button, a radiobutton, and a checkbox. All three fell over horribly.

We still need to do a slow path for scrollbars, but there's something screwy with our transform matrix, I think.
Target Milestone: --- → mozilla1.9 M9
Depends on: 397792
I fixed the rotation in bug 397792, but there's some extra translation going on too, which I think is causing odd clipping isues? I'm not sure. Things are definitely getting better though!

Buttons are still broken, and should probably also get fixed. I think we can apply a scale factor though, instead of an offscreen buffer, and get the same results without double buffering. That's a separate bug though.
Depends on: 398471
Attached patch fix v1.0Splinter Review
Attachment #283646 - Flags: review?(joshmoz)
Comment on attachment 283646 [details] [diff] [review]
fix v1.0

+    CGContextTranslateCTM(aCGContext, 0, aBoxRect.size.height + (2*aBoxRect.origin.y));

Spaces on both sides of the '*' operator please. Can fix on checkin.
Attachment #283646 - Flags: superreview?(vladimir)
Attachment #283646 - Flags: review?(joshmoz)
Attachment #283646 - Flags: review+
Comment on attachment 283646 [details] [diff] [review]
fix v1.0

Looks ok, but what's NS_HANDLER and friends?
Attachment #283646 - Flags: superreview?(vladimir) → superreview+
Basically, macros for doing exception handling in ObjC. Normal looking language constructs were added in 10.3 but you have to turn them on. See bug 397381.
Checking in widget/src/cocoa/nsNativeThemeCocoa.mm;
/cvsroot/mozilla/widget/src/cocoa/nsNativeThemeCocoa.mm,v  <--  nsNativeThemeCocoa.mm
new revision: 1.62; previous revision: 1.61
done
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
verified fixed using Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.9a9pre) Gecko/2007100604 Minefield/3.0a9pre. I used the testcase in the bug to verify the fix, and took it through all the various transformations.
Status: RESOLVED → VERIFIED
Flags: in-litmus?
https://litmus.mozilla.org/show_test.cgi?id=5397 added to Litmus.
Flags: in-litmus? → in-litmus+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: