From fd10729941a8a21938d88770250dc4b7cb6a48af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 9 Jun 2017 17:19:50 +0200 Subject: [PATCH] style: Also print the class name when logging elements. Bug: 1368240 MozReview-Commit-ID: 1MSn4rty5RL --- components/style/gecko/wrapper.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 04e9a9888e6..40f587b1ea8 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -408,6 +408,24 @@ impl<'le> fmt::Debug for GeckoElement<'le> { if let Some(id) = self.get_id() { try!(write!(f, " id={}", id)); } + + let mut first = true; + let mut any = false; + self.each_class(|c| { + if first { + first = false; + any = true; + let _ = f.write_str(" class=\""); + } else { + let _ = f.write_str(" "); + } + let _ = write!(f, "{}", c); + }); + + if any { + f.write_str("\"")?; + } + write!(f, "> ({:#x})", self.as_node().opaque().0) } }