From 56fc1a66498127ac30f7612e8cd5e5d04b0fed1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Sat, 3 Mar 2018 22:33:50 +0100 Subject: [PATCH] style: Account for a few more cases in the node's debug-formatting code. --- components/style/gecko/wrapper.rs | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 661bc1137bd..8126f2e8670 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -170,14 +170,22 @@ impl<'ln> PartialEq for GeckoNode<'ln> { impl<'ln> fmt::Debug for GeckoNode<'ln> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if let Some(el) = self.as_element() { - el.fmt(f) - } else { - if self.is_text_node() { - write!(f, " ({:#x})", self.opaque().0) - } else { - write!(f, " ({:#x})", self.opaque().0) - } + return el.fmt(f) } + + if self.is_text_node() { + return write!(f, " ({:#x})", self.opaque().0) + } + + if self.is_document() { + return write!(f, " ({:#x})", self.opaque().0) + } + + if self.is_shadow_root() { + return write!(f, " ({:#x})", self.opaque().0) + } + + write!(f, " ({:#x})", self.opaque().0) } }