diff --git a/components/gfx/display_list/mod.rs b/components/gfx/display_list/mod.rs index 1b7195fa201..be4aecd3a45 100644 --- a/components/gfx/display_list/mod.rs +++ b/components/gfx/display_list/mod.rs @@ -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, @@ -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.