Closed Bug 870238 Opened 11 years ago Closed 10 years ago

Firefox dumps a warning on startup (Method userSpaceScaleFactor in class NSWindow is deprecated on 10.7 and later)

Categories

(Core :: Widget: Cocoa, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: Gijs, Assigned: mstange)

Details

Attachments

(1 file)

The full warning is:

*** WARNING: Method userSpaceScaleFactor in class NSWindow is deprecated on 10.7 and later. It should not be used in new applications. Use convertRectToBacking: instead.
The message comes from GetDPI implementation http://dxr.mozilla.org/mozilla-central/source/widget/cocoa/nsCocoaWindow.mm#2481
(See also discussion in bug 857126 about GetDPI.)

Apparently backingScaleFactor is a possible replacement for userSpaceScaleFactor
<https://developer.apple.com/library/mac/documentation/cocoa/reference/applicationkit/classes/NSWindow_Class/Reference/Reference.html>.

However the HiDPI patch for bug 674373 already added backingScaleFactor usage to GetDPI():

> CGFloat scaleFactor = [aWindow userSpaceScaleFactor];
> float dpi = (heightPx / scaleFactor) / (heightMM / MM_PER_INCH_FLOAT);
> return dpi * backingScale; // <<--- this

Seems like scaleFactor and backingScale cancel each other out when backingScale is available.
(In reply to Nickolay_Ponomarev from comment #1)
> The message comes from GetDPI implementation
> http://dxr.mozilla.org/mozilla-central/source/widget/cocoa/nsCocoaWindow.
> mm#2481
> (See also discussion in bug 857126 about GetDPI.)
> 
> Apparently backingScaleFactor is a possible replacement for
> userSpaceScaleFactor
> <https://developer.apple.com/library/mac/documentation/cocoa/reference/
> applicationkit/classes/NSWindow_Class/Reference/Reference.html>.
> 
> However the HiDPI patch for bug 674373 already added backingScaleFactor
> usage to GetDPI():
> 
> > CGFloat scaleFactor = [aWindow userSpaceScaleFactor];
> > float dpi = (heightPx / scaleFactor) / (heightMM / MM_PER_INCH_FLOAT);
> > return dpi * backingScale; // <<--- this
> 
> Seems like scaleFactor and backingScale cancel each other out when
> backingScale is available.

Thanks for the research! I would imagine that we could get the same info as userSpaceScaleFactor by taking the screen rect and converting it to a backingrect using convertRectToBacking, and dividing the heights? Not 100% sure though. Markus, does that seem plausible?
Flags: needinfo?(mstange)
Attached patch rip it outSplinter Review
On my HiDPI machine, userSpaceScaleFactor is always one. I think it's always been that way, except if you used QuartzDebug to override it on a pre-10.7 version of OS X.
Attachment #8421908 - Flags: review?(jfkthame)
Flags: needinfo?(mstange)
Comment on attachment 8421908 [details] [diff] [review]
rip it out

Review of attachment 8421908 [details] [diff] [review]:
-----------------------------------------------------------------

Yes - AIUI, this is basically a relic of an older Apple plan for resolution independence, but it never really got adopted. Let's get rid of it.
Attachment #8421908 - Flags: review?(jfkthame) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/4b2db2286258
Assignee: nobody → mstange
Status: NEW → ASSIGNED
https://hg.mozilla.org/mozilla-central/rev/4b2db2286258
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
(In reply to Wes Kocher (:KWierso) from comment #7)
> https://hg.mozilla.org/mozilla-central/rev/4b2db2286258

In comment #6, this was listed as backed out. I'm now confused about whether this is in m-c or not. Did the push make it but not the backout? Are there just some checkins that aren't listed here? :-\
Flags: needinfo?(kwierso)
(In reply to :Gijs Kruitbosch from comment #8)
> (In reply to Wes Kocher (:KWierso) from comment #7)
> > https://hg.mozilla.org/mozilla-central/rev/4b2db2286258
> 
> In comment #6, this was listed as backed out. I'm now confused about whether
> this is in m-c or not. Did the push make it but not the backout? Are there
> just some checkins that aren't listed here? :-\

Oops, grabbed the wrong changeset for my merge. Fixed.
Flags: needinfo?(kwierso)
https://hg.mozilla.org/mozilla-central/rev/c1512bf25a70
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: