Closed Bug 495192 Opened 17 years ago Closed 17 years ago

nsIDOMScreen should report the dpi

Categories

(Core :: DOM: Core & HTML, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 486200

People

(Reporter: db48x, Assigned: db48x)

References

Details

Attachments

(1 file)

It currently reports the screen size and color depth, but not the dpi. Now that the dpi matters it can be included. Although it's rare that js will need to rely on the dpi information, it's still occasionally necessary. The case I'm encountering at the moment is a tree view that does hit testing on a tree cell; when the dpi is high enough the contents of the tree cell are scaled up and the hit tests become quite inaccurate. Granted, this particular example is in chrome code (in fact it's C++ that's compiled as a binary extension), and this patch makes the dpi information available to content as well as chrome. However, I don't see this as a problem.
Attached patch 495192-1.diffSplinter Review
Oh, I forgot to mention. This patch also adds two methods to nsIDOMScreen: scaleCSSPixelsToDevicePixels and the inverse. This means that nobody has to reverse-engineer the scale value to use from the dpi value, since that could change (again).
Assignee: nobody → db48x
Status: NEW → ASSIGNED
Depends on: 495002
We should not expose the DPI to script --- neither Web content, nor chrome. If there is a reason that tree views need to know the css-pixel-to-dev-pixel ratio, let's fix that directly.
The reason we should not expose this to script is that if we do, people will start doing strange things in their Web sites that are probably wrong.
Then again, my patch in bug 486200 actually exposes window.mozScreenPixelsPerCSSPixel, which is what you really want. So now I'm not sure :-)
Yea, I could certainly use the conversion factor instead of the methods. The methods seem cleaner to me though. Either way I guess I can live with it being chrome-only. What's the best way to implement that? Can I just check for chromity and return a failure code for content callers?
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
err, oops.
Component: DOM: Mozilla Extensions → DOM
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: