mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Add a custom Debug formatter for ClippingRegion
This will make display list dumps more likely to fit on a single line.
This commit is contained in:
parent
cad5a4e326
commit
3474a2f9e1
1 changed files with 15 additions and 1 deletions
|
@ -897,7 +897,7 @@ impl BaseDisplayItem {
|
|||
/// A clipping region for a display item. Currently, this can describe rectangles, rounded
|
||||
/// rectangles (for `border-radius`), or arbitrary intersections of the two. Arbitrary transforms
|
||||
/// are not supported because those are handled by the higher-level `StackingContext` abstraction.
|
||||
#[derive(Clone, PartialEq, Debug, HeapSizeOf, Deserialize, Serialize)]
|
||||
#[derive(Clone, PartialEq, HeapSizeOf, Deserialize, Serialize)]
|
||||
pub struct ClippingRegion {
|
||||
/// The main rectangular region. This does not include any corners.
|
||||
pub main: Rect<Au>,
|
||||
|
@ -1043,6 +1043,20 @@ impl ClippingRegion {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for ClippingRegion {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
if *self == ClippingRegion::max() {
|
||||
write!(f, "ClippingRegion::Max")
|
||||
} else if *self == ClippingRegion::empty() {
|
||||
write!(f, "ClippingRegion::Empty")
|
||||
} else if self.main == max_rect() {
|
||||
write!(f, "ClippingRegion(Complex={:?})", self.complex)
|
||||
} else {
|
||||
write!(f, "ClippingRegion(Rect={:?}, Complex={:?})", self.main, self.complex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ComplexClippingRegion {
|
||||
// TODO(pcwalton): This could be more aggressive by considering points that touch the inside of
|
||||
// the border radius ellipse.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue