Don't allocate strings in Debug for DisplayItem

This commit is contained in:
Anthony Ramine 2019-10-12 09:38:49 +02:00 committed by Josh Matthews
parent 3da51b4d2a
commit 97d6351202

View file

@ -736,20 +736,20 @@ impl fmt::Debug for DisplayItem {
f, f,
"{} @ {:?} {:?}", "{} @ {:?} {:?}",
match *self { match *self {
DisplayItem::Rectangle(_) => "Rectangle".to_owned(), DisplayItem::Rectangle(_) => "Rectangle",
DisplayItem::Text(_) => "Text".to_owned(), DisplayItem::Text(_) => "Text",
DisplayItem::Image(_) => "Image".to_owned(), DisplayItem::Image(_) => "Image",
DisplayItem::Border(_) => "Border".to_owned(), DisplayItem::Border(_) => "Border",
DisplayItem::Gradient(_) => "Gradient".to_owned(), DisplayItem::Gradient(_) => "Gradient",
DisplayItem::RadialGradient(_) => "RadialGradient".to_owned(), DisplayItem::RadialGradient(_) => "RadialGradient",
DisplayItem::Line(_) => "Line".to_owned(), DisplayItem::Line(_) => "Line",
DisplayItem::BoxShadow(_) => "BoxShadow".to_owned(), DisplayItem::BoxShadow(_) => "BoxShadow",
DisplayItem::PushTextShadow(_) => "PushTextShadow".to_owned(), DisplayItem::PushTextShadow(_) => "PushTextShadow",
DisplayItem::PopAllTextShadows(_) => "PopTextShadow".to_owned(), DisplayItem::PopAllTextShadows(_) => "PopTextShadow",
DisplayItem::Iframe(_) => "Iframe".to_owned(), DisplayItem::Iframe(_) => "Iframe",
DisplayItem::PushStackingContext(_) | DisplayItem::PushStackingContext(_) |
DisplayItem::PopStackingContext(_) | DisplayItem::PopStackingContext(_) |
DisplayItem::DefineClipScrollNode(_) => "".to_owned(), DisplayItem::DefineClipScrollNode(_) => "",
}, },
self.bounds(), self.bounds(),
self.base().clip_rect self.base().clip_rect