Bug 1686476 [wpt PR 27145] - [AspectRatio] Correctly handle intrinsic size for replac...
[gecko.git] / widget / nsIScreen.idl
blobdb9e3f8942bb7e32d339378edf3ad7f396817221
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.idl"
9 %{C++
10 /**
11 * The display type of nsIScreen belongs to.
13 enum class DisplayType: int32_t {
14 DISPLAY_PRIMARY, // primary screen
15 DISPLAY_EXTERNAL, // wired displays, such as HDMI, DisplayPort, etc.
16 DISPLAY_VIRTUAL // wireless displays, such as Chromecast, WiFi-Display, etc.
20 [scriptable, uuid(826e80c8-d70f-42e2-8aa9-82c05f2a370a)]
21 interface nsIScreen : nsISupports
23 /**
24 * These report screen dimensions in (screen-specific) device pixels
26 void GetRect(out long left, out long top, out long width, out long height);
27 void GetAvailRect(out long left, out long top, out long width, out long height);
29 /**
30 * And these report in desktop pixels
32 void GetRectDisplayPix(out long left, out long top, out long width, out long height);
33 void GetAvailRectDisplayPix(out long left, out long top, out long width, out long height);
35 readonly attribute long pixelDepth;
36 readonly attribute long colorDepth;
38 /**
39 * The number of device pixels per desktop pixel for this screen (for
40 * hidpi configurations where there may be multiple device pixels per
41 * desktop px and/or per CSS px).
43 * This seems poorly named (something like devicePixelsPerDesktopPixel
44 * would be more accurate/explicit), but given that it is exposed to
45 * front-end code and may also be used by add-ons, it's probably not
46 * worth the disruption of changing it.
48 * Returns 1.0 if HiDPI mode is disabled or unsupported, or if the
49 * host OS uses device pixels as its desktop pixel units (e.g. Windows 7 or
50 * GTK/X11). Per-monitor DPI is available in Windows 8.1+, GTK/Wayland or
51 * macOS.
53 readonly attribute double contentsScaleFactor;
55 /**
56 * The default number of device pixels per unscaled CSS pixel for this
57 * screen. This is probably what contentsScaleFactor originally meant
58 * to be, prior to confusion between CSS pixels and desktop pixel units.
60 readonly attribute double defaultCSSScaleFactor;
62 /**
63 * The DPI of the screen.
65 readonly attribute float dpi;