Closed Bug 602647 Opened 14 years ago Closed 14 years ago

Fennec needs a scriptable interface to GetDPI

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b7
Tracking Status
fennec 2.0+ ---

People

(Reporter: mbrubeck, Assigned: MikeK)

References

Details

Attachments

(1 file)

Fennec multiplies values from the "viewport" meta tag by a factor that is intended to correct for differences in display density. This factor is effectively a device-pixel to css-px ratio, which applies only to pages that set their scale with <meta name="viewport">. For some more background, see: http://limpet.net/mbrubeck/2010/05/11/fennec-meta-viewport.html Right now this factor a preference (zoom.dpiScale) with a hard-coded default of 150%. (This default is targeted at a handheld display with about 160 dpi.) We'd like to change this value based on the actual hardware display density. To do this in the front-end as we do now, we would like a scriptable way to call nsWindow::GetDPI.
tracking-fennec: --- → ?
Component: General → Graphics
Product: Fennec → Core
QA Contact: general → thebes
this is just chrome, right? Rationale for it blocking 2.0?
We need this to adapt our chrome to different-resolution screens, and also to choose the a CSS-to-device pixel ratio to apply to meta[name=viewport] values. Both of these are necessary if we decide to implement bug 590777 (support lower-resolution displays), which is currently blocking-fenec:2.0+.
Blocks: 590777
Sorry, actually this isn't needed for adapting our chrome theme - we can do that using mozmm and media queries. It's only needed for adjusting our content scaling.
Assignee: nobody → mkristoffersen
tracking-fennec: ? → 2.0+
can we just add this to nsIScreen?
sure, or nsIDOMWindowUtils.
When should we use a readonly attribute and when should we use a function to get such a value from an interface?
It doesn't matter that much. An attribute is fine
Attached patch Fix V1Splinter Review
Attachment #483183 - Flags: review?(doug.turner)
Comment on attachment 483183 [details] [diff] [review] Fix V1 roc, is it fine to expose dpi in this way?
Attachment #483183 - Flags: review?(doug.turner) → review?(roc)
You can compute this already by calling DOMWindowUtils.screenPixelsPerCSSPixel on a window with no zoom (e.g., the chrome window) and multiplying by 96.
(In reply to comment #10) > You can compute this already by calling DOMWindowUtils.screenPixelsPerCSSPixel > on a window with no zoom (e.g., the chrome window) and multiplying by 96. On my Android device where GetDPI should return 240 (and GetDefaultScale returns 1.0), DOMWindowUtils.screenPixelsPerCSSPixel*96 == 96. Is this expected?
Er, never mind, I don't know what I was thinking.
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
Target Milestone: mozilla2.0b8 → mozilla2.0b7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: