More compact debug output for CSS values

```
Rect {
    start_corner: Vec2 { i: 0.0 px, b: 0.0 px },
    size: Vec2 { i: 1024.0 px, b: 20.0 px },
}
```

… instead of:

```
Rect {
    start_corner: Vec2 {
        inline: CSSPixelLength(
            0.0,
        ),
        block: CSSPixelLength(
            0.0,
        ),
    },
    size: Vec2 {
        inline: CSSPixelLength(
            1024.0,
        ),
        block: CSSPixelLength(
            0.0,
        ),
    },
}
```
This commit is contained in:
Simon Sapin 2019-10-15 17:55:57 +02:00
parent cfc3ffcd54
commit 13e494d74f
2 changed files with 32 additions and 3 deletions

View file

@ -611,7 +611,6 @@ impl Size {
Clone,
ComputeSquaredDistance,
Copy,
Debug,
MallocSizeOf,
PartialEq,
PartialOrd,
@ -623,6 +622,13 @@ impl Size {
#[repr(C)]
pub struct CSSPixelLength(CSSFloat);
impl fmt::Debug for CSSPixelLength {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(f)?;
f.write_str(" px")
}
}
impl CSSPixelLength {
/// Return a new CSSPixelLength.
#[inline]