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

RESOLVED FIXED in mozilla32

Status

()

RESOLVED FIXED
6 years ago
4 years ago

People

(Reporter: Gijs, Assigned: mstange)

Tracking

Trunk
mozilla32
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

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

Comment 1

5 years ago
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.
(Reporter)

Comment 2

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

Comment 3

5 years ago
Created attachment 8421908 [details] [diff] [review]
rip it out

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

Comment 5

5 years ago
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
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
(Reporter)

Comment 8

5 years ago
(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)
https://hg.mozilla.org/mozilla-central/rev/87349c65ee72
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(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
Last Resolved: 5 years ago4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.