Mac scrollbar rendering extremely broken under complex transformations

VERIFIED FIXED in mozilla1.9beta1

Status

()

VERIFIED FIXED
11 years ago
10 years ago

People

(Reporter: roc, Assigned: cbarrett)

Tracking

Trunk
mozilla1.9beta1
x86
Mac OS X
Points:
---
Dependency tree / graph
Bug Flags:
blocking1.9 +
in-litmus +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

Created attachment 264267 [details]
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).
(Assignee)

Comment 1

11 years ago
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.

Comment 4

11 years ago
I'm pretty sure I know how to do this, but I have to finish a couple other things before I can do it.

Updated

11 years ago
Flags: blocking1.9? → blocking1.9+

Updated

11 years ago
Assignee: joshmoz → cbarrett
(Assignee)

Comment 5

11 years ago
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.
(Assignee)

Comment 6

11 years ago
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.

Updated

11 years ago
Target Milestone: --- → mozilla1.9 M9
(Assignee)

Updated

11 years ago
Depends on: 397792
(Assignee)

Comment 7

11 years ago
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.
(Assignee)

Updated

11 years ago
Depends on: 398471
(Assignee)

Comment 8

11 years ago
Created attachment 283646 [details] [diff] [review]
fix v1.0
Attachment #283646 - Flags: review?(joshmoz)

Comment 9

11 years ago
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+
(Assignee)

Comment 11

11 years ago
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.
(Assignee)

Comment 12

11 years ago
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
Last Resolved: 11 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.