1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//! Units and geometry, typed as GPUI's `gpui::geometry`: a length is
//! [`Points`] (GPUI's `Pixels`), [`Rems`], a [`Percentage`] (a fraction:
//! `0.5` is 50%) or one of the lengths styles give
//! ([`AbsoluteLength`], [`DefiniteLength`], [`Length`]); an angle is
//! [`Radians`]; shapes are generic over their unit ([`Point`], [`Size`],
//! [`Bounds`], [`Edges`], [`Corners`]). Public API takes and returns these,
//! never a bare `f32` for a length, an angle or a fraction (held by the
//! `unit_types` test; docs/dev/geometry.md).
//!
//! NSH lays out in points; [`DevicePixels`] and [`ScaledPixels`] exist
//! only where a platform draws or reports pixels. Conversions happen at
//! the boundaries: taffy here (`taffy.rs`, the one place), the platforms
//! where they hand values to their toolkits, `nsh-js` where it decodes JS
//! numbers.
//!
//! The units are `#[repr(transparent)]` newtypes and the shapes
//! `#[repr(C)]` structs of them: zero cost on hot paths. Deviations from
//! GPUI are deliberate and listed in docs/dev/geometry.md (points rather
//! than pixels, `f32`'s comparisons rather than a total order, a public
//! `.0`, CSS angle constructors).
pub use ;
pub use ;
pub use ;
/// Bounds at `x`, `y` of `width` × `height` points, for the core's
/// layout code, which computes in taffy's `f32`.
pub const
/// A size of `width` × `height` points, for the core's layout code.
pub const