diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2016-08-08 15:52:24 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2016-08-21 03:40:28 +0200 |
commit | bc71e8b65b1da3959c28d820a7bc54725118bcef (patch) | |
tree | 593b58bc11fbc88c6796bd82c048734aa85f5e20 /components/script/layout_wrapper.rs | |
parent | 477cae67df2827b067ec2ef4e72ef10272d6791d (diff) | |
download | servo-bc71e8b65b1da3959c28d820a7bc54725118bcef.tar.gz servo-bc71e8b65b1da3959c28d820a7bc54725118bcef.zip |
Add some fmt::Debug implementations
Diffstat (limited to 'components/script/layout_wrapper.rs')
-rw-r--r-- | components/script/layout_wrapper.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/components/script/layout_wrapper.rs b/components/script/layout_wrapper.rs index cbf04b48e5b..431fe55f9b0 100644 --- a/components/script/layout_wrapper.rs +++ b/components/script/layout_wrapper.rs @@ -49,6 +49,7 @@ use script_layout_interface::{HTMLCanvasData, LayoutNodeType, TrustedNodeAddress use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData}; use selectors::matching::{DeclarationBlock, ElementFlags}; use selectors::parser::{AttrSelector, NamespaceConstraint}; +use std::fmt; use std::marker::PhantomData; use std::mem::{transmute, transmute_copy}; use std::sync::Arc; @@ -405,6 +406,16 @@ pub struct ServoLayoutElement<'le> { chain: PhantomData<&'le ()>, } +impl<'le> fmt::Debug for ServoLayoutElement<'le> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + try!(write!(f, "<{}", self.element.local_name())); + if let &Some(ref id) = unsafe { &*self.element.id_attribute() } { + try!(write!(f, " id={}", id)); + } + write!(f, ">") + } +} + impl<'le> PresentationalHintsSynthetizer for ServoLayoutElement<'le> { fn synthesize_presentational_hints_for_legacy_attributes<V>(&self, hints: &mut V) where V: Push<DeclarationBlock<Vec<PropertyDeclaration>>> @@ -926,7 +937,7 @@ impl<ConcreteNode> Iterator for ThreadSafeLayoutNodeChildrenIterator<ConcreteNod /// A wrapper around elements that ensures layout can only /// ever access safe properties and cannot race on elements. -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] pub struct ServoThreadSafeLayoutElement<'le> { element: &'le Element, } |