diff --git a/src/components/main/layout/floats.rs b/src/components/main/layout/floats.rs index 4f58da33e33..db8bc67101f 100644 --- a/src/components/main/layout/floats.rs +++ b/src/components/main/layout/floats.rs @@ -8,6 +8,7 @@ use geom::size::Size2D; use servo_util::cowarc::CowArc; use servo_util::geometry::{Au, max, min}; use std::i32; +use std::fmt; use style::computed_values::float; /// The kind of float: left or right. @@ -43,6 +44,12 @@ struct Float { kind: FloatKind, } +impl fmt::Show for Float { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f.buf, "bounds={} kind={:?}", self.bounds, self.kind) + } +} + /// Information about the floats next to a flow. /// /// FIXME(pcwalton): When we have fast `MutexArc`s, try removing `#[deriving(Clone)]` and wrap in a @@ -64,6 +71,12 @@ impl FloatList { } } +impl fmt::Show for FloatList { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f.buf, "max_top={} floats={:?}", self.max_top, self.floats) + } +} + /// Wraps a `FloatList` to avoid allocation in the common case of no floats. /// /// FIXME(pcwalton): When we have fast `MutexArc`s, try removing `CowArc` and use a mutex instead. @@ -114,6 +127,12 @@ pub struct PlacementInfo { pub kind: FloatKind } +impl fmt::Show for PlacementInfo { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f.buf, "size={} ceiling={} max_width={} kind={:?}", self.size, self.ceiling, self.max_width, self.kind) + } +} + fn range_intersect(top_1: Au, bottom_1: Au, top_2: Au, bottom_2: Au) -> (Au, Au) { (max(top_1, top_2), min(bottom_1, bottom_2)) } @@ -128,6 +147,19 @@ pub struct Floats { offset: Point2D, } +impl fmt::Show for Floats { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.list.get() { + None => { + write!(f.buf, "[empty]") + } + Some(list) => { + write!(f.buf, "offset={} floats={}", self.offset, list) + } + } + } +} + impl Floats { /// Creates a new `Floats` object. pub fn new() -> Floats { diff --git a/src/components/main/layout/model.rs b/src/components/main/layout/model.rs index 3fda7357fe7..b1a759286dc 100644 --- a/src/components/main/layout/model.rs +++ b/src/components/main/layout/model.rs @@ -12,6 +12,7 @@ use style::computed_values::{LPA_Auto, LPA_Length, LPA_Percentage, LP_Length, LP use style::ComputedValues; use servo_util::geometry::Au; use servo_util::geometry; +use std::fmt; /// A collapsible margin. See CSS 2.1 ยง 8.3.1. pub struct AdjoiningMargins { @@ -249,6 +250,12 @@ pub struct IntrinsicWidths { pub surround_width: Au, } +impl fmt::Show for IntrinsicWidths { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f.buf, "min={}, pref={}, surr={}", self.minimum_width, self.preferred_width, self.surround_width) + } +} + impl IntrinsicWidths { pub fn new() -> IntrinsicWidths { IntrinsicWidths { diff --git a/src/components/util/geometry.rs b/src/components/util/geometry.rs index f1dd2d816ce..f63b7aa1cce 100644 --- a/src/components/util/geometry.rs +++ b/src/components/util/geometry.rs @@ -25,7 +25,7 @@ impl Default for Au { impl fmt::Show for Au { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Au(n) = *self; - write!(f.buf, "Au({})", n) + write!(f.buf, "Au(au={} px={})", n, to_frac_px(*self)) }} impl Add for Au {