Closed Bug 507947 Opened 15 years ago Closed 15 years ago

NSRectFill fails when drawRect isn't on the stack

Categories

(Core :: Widget: Cocoa, defect)

All
macOS
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9.2a1
Tracking Status
status1.9.2 --- beta1-fixed
status1.9.1 --- .4-fixed

People

(Reporter: mstange, Assigned: mstange)

References

Details

(Keywords: verified1.9.1, verified1.9.2)

Attachments

(2 files)

We use NSRectFill in several places in native theme rendering, for example when drawing toolbars. However, I noticed that this doesn't work when drawing with Canvas.drawWindow: Toolbars never seem to make it into the Ctrl+Tab previews, for example. Instead, sometimes I've noticed grey lines or boxes at the bottom of the window, which has also been reported here: https://www.mozdev.org/bugs/show_bug.cgi?id=21200

So what seems to happen is that when we're not drawing inside drawRect, i.e. when [NSView focusView] is nil, NSRectFill instead draws into the next best window, preferable in a flipped way (on the bottom instead of at the top of the window, for example).

I don't know why this happens, but I found out that CGFillRect does not do these things. So I'm replacing all calls to NSRectFill with CGFillRect, factored out into a DrawNativeGreyColorInRect in nsNativeThemeColors.h.
The other change I'm making is to treat the window always as active when there's no focusView because I think it makes more sense for tab previews.
Attachment #392191 - Flags: review?(joshmoz)
Attachment #392191 - Flags: review?(joshmoz) → review+
http://hg.mozilla.org/mozilla-central/rev/9d37b381e2ae
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Attached patch simple reftestSplinter Review
Before this patch, -moz-appearance: toolbar didn't draw anything when used inside canvas.drawWindow, so this should be enough.
Attachment #392432 - Flags: review?(roc)
Comment on attachment 392191 [details] [diff] [review]
v1: replace NSRectFill with CGContextFillRect

fixes the spurious appearance of grey boxes on a page with certain combinations of extensions (e.g. FireFTP + Ctrl-Tab), very low risk, has test
Attachment #392191 - Flags: approval1.9.1.3?
Attachment #392191 - Flags: approval1.9.1.3? → approval1.9.1.4?
Comment on attachment 392191 [details] [diff] [review]
v1: replace NSRectFill with CGContextFillRect

Approved for 1.9.1.4, a=dveditz for release-drivers
Attachment #392191 - Flags: approval1.9.1.4? → approval1.9.1.4+
Verified fixed on 1.9.2 and 1.9.1 based on check-ins and passing reftests.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: