mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
auto merge of #2336 : bjz/servo/debug_str, r=pcwalton
This commit is contained in:
commit
38bf7fd098
13 changed files with 134 additions and 109 deletions
|
@ -26,6 +26,7 @@ use libc::uintptr_t;
|
||||||
use servo_net::image::base::Image;
|
use servo_net::image::base::Image;
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
use servo_util::range::Range;
|
use servo_util::range::Range;
|
||||||
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::slice::Items;
|
use std::slice::Items;
|
||||||
use style::computed_values::border_style;
|
use style::computed_values::border_style;
|
||||||
|
@ -633,23 +634,27 @@ impl DisplayItem {
|
||||||
for _ in range(0, level) {
|
for _ in range(0, level) {
|
||||||
indent.push_str("| ")
|
indent.push_str("| ")
|
||||||
}
|
}
|
||||||
debug!("{}+ {}", indent, self.debug_str());
|
debug!("{}+ {}", indent, self);
|
||||||
for child in self.children() {
|
for child in self.children() {
|
||||||
child.debug_with_level(level + 1);
|
child.debug_with_level(level + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn debug_str(&self) -> ~str {
|
|
||||||
let class = match *self {
|
|
||||||
SolidColorDisplayItemClass(_) => "SolidColor",
|
|
||||||
TextDisplayItemClass(_) => "Text",
|
|
||||||
ImageDisplayItemClass(_) => "Image",
|
|
||||||
BorderDisplayItemClass(_) => "Border",
|
|
||||||
LineDisplayItemClass(_) => "Line",
|
|
||||||
ClipDisplayItemClass(_) => "Clip",
|
|
||||||
PseudoDisplayItemClass(_) => "Pseudo",
|
|
||||||
};
|
|
||||||
format!("{} @ {} ({:x})", class, self.base().bounds, self.base().node.id())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Show for DisplayItem {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f.buf, "{} @ {} ({:x})",
|
||||||
|
match *self {
|
||||||
|
SolidColorDisplayItemClass(_) => "SolidColor",
|
||||||
|
TextDisplayItemClass(_) => "Text",
|
||||||
|
ImageDisplayItemClass(_) => "Image",
|
||||||
|
BorderDisplayItemClass(_) => "Border",
|
||||||
|
LineDisplayItemClass(_) => "Line",
|
||||||
|
ClipDisplayItemClass(_) => "Clip",
|
||||||
|
PseudoDisplayItemClass(_) => "Pseudo",
|
||||||
|
},
|
||||||
|
self.base().bounds,
|
||||||
|
self.base().node.id(),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ use gfx::render_task::RenderLayer;
|
||||||
use servo_msg::compositor_msg::{FixedPosition, LayerId, Scrollable};
|
use servo_msg::compositor_msg::{FixedPosition, LayerId, Scrollable};
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
use servo_util::geometry;
|
use servo_util::geometry;
|
||||||
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::num::Zero;
|
use std::num::Zero;
|
||||||
use style::computed_values::{LPA_Auto, LPA_Length, LPA_Percentage, LPN_Length, LPN_None};
|
use style::computed_values::{LPA_Auto, LPA_Length, LPA_Percentage, LPN_Length, LPN_None};
|
||||||
|
@ -1690,22 +1691,23 @@ impl Flow for BlockFlow {
|
||||||
LayerId(self.box_.node.id(), fragment_index)
|
LayerId(self.box_.node.id(), fragment_index)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
|
||||||
let txt = if self.is_float() {
|
|
||||||
"FloatFlow: ".to_owned()
|
|
||||||
} else if self.is_root() {
|
|
||||||
"RootFlow: ".to_owned()
|
|
||||||
} else {
|
|
||||||
"BlockFlow: ".to_owned()
|
|
||||||
};
|
|
||||||
txt.append(self.box_.debug_str())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn is_absolute_containing_block(&self) -> bool {
|
fn is_absolute_containing_block(&self) -> bool {
|
||||||
self.is_positioned()
|
self.is_positioned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Show for BlockFlow {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
if self.is_float() {
|
||||||
|
write!(f.buf, "FloatFlow: {}", self.box_)
|
||||||
|
} else if self.is_root() {
|
||||||
|
write!(f.buf, "RootFlow: {}", self.box_)
|
||||||
|
} else {
|
||||||
|
write!(f.buf, "BlockFlow: {}", self.box_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The inputs for the widths-and-margins constraint equation.
|
/// The inputs for the widths-and-margins constraint equation.
|
||||||
pub struct WidthConstraintInput {
|
pub struct WidthConstraintInput {
|
||||||
pub computed_width: MaybeAuto,
|
pub computed_width: MaybeAuto,
|
||||||
|
|
|
@ -38,6 +38,7 @@ use servo_util::namespace;
|
||||||
use servo_util::smallvec::SmallVec;
|
use servo_util::smallvec::SmallVec;
|
||||||
use servo_util::str::is_whitespace;
|
use servo_util::str::is_whitespace;
|
||||||
use std::cast;
|
use std::cast;
|
||||||
|
use std::fmt;
|
||||||
use std::from_str::FromStr;
|
use std::from_str::FromStr;
|
||||||
use std::iter::AdditiveIterator;
|
use std::iter::AdditiveIterator;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
@ -838,10 +839,10 @@ impl Box {
|
||||||
// Box position wrt to the owning flow.
|
// Box position wrt to the owning flow.
|
||||||
let box_bounds = self.border_box;
|
let box_bounds = self.border_box;
|
||||||
let absolute_box_bounds = box_bounds.translate(&flow_origin);
|
let absolute_box_bounds = box_bounds.translate(&flow_origin);
|
||||||
debug!("Box::build_display_list at rel={}, abs={}: {:s}",
|
debug!("Box::build_display_list at rel={}, abs={}: {}",
|
||||||
box_bounds,
|
box_bounds,
|
||||||
absolute_box_bounds,
|
absolute_box_bounds,
|
||||||
self.debug_str());
|
self);
|
||||||
debug!("Box::build_display_list: dirty={}, flow_origin={}",
|
debug!("Box::build_display_list: dirty={}, flow_origin={}",
|
||||||
layout_context.dirty,
|
layout_context.dirty,
|
||||||
flow_origin);
|
flow_origin);
|
||||||
|
@ -1396,40 +1397,21 @@ impl Box {
|
||||||
self.style().Box.get().overflow == overflow::hidden
|
self.style().Box.get().overflow == overflow::hidden
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a debugging string describing this box.
|
|
||||||
pub fn debug_str(&self) -> ~str {
|
|
||||||
let class_name = match self.specific {
|
|
||||||
GenericBox => "GenericBox",
|
|
||||||
IframeBox(_) => "IframeBox",
|
|
||||||
ImageBox(_) => "ImageBox",
|
|
||||||
ScannedTextBox(_) => "ScannedTextBox",
|
|
||||||
TableBox => "TableBox",
|
|
||||||
TableCellBox => "TableCellBox",
|
|
||||||
TableColumnBox(_) => "TableColumnBox",
|
|
||||||
TableRowBox => "TableRowBox",
|
|
||||||
TableWrapperBox => "TableWrapperBox",
|
|
||||||
UnscannedTextBox(_) => "UnscannedTextBox",
|
|
||||||
};
|
|
||||||
|
|
||||||
format!("({}{}{})",
|
|
||||||
class_name,
|
|
||||||
self.side_offsets_debug_string("bp", self.border_padding),
|
|
||||||
self.side_offsets_debug_string("m", self.margin))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// A helper function to return a debug string describing the side offsets for one of the rect
|
/// A helper function to return a debug string describing the side offsets for one of the rect
|
||||||
/// box model properties (border, padding, or margin).
|
/// box model properties (border, padding, or margin).
|
||||||
fn side_offsets_debug_string(&self, name: &str, value: SideOffsets2D<Au>) -> ~str {
|
fn side_offsets_debug_fmt(&self, name: &str,
|
||||||
let zero: SideOffsets2D<Au> = Zero::zero();
|
value: SideOffsets2D<Au>,
|
||||||
if value == zero {
|
f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
return "".to_str()
|
if value.is_zero() {
|
||||||
}
|
Ok(())
|
||||||
format!(" {}{},{},{},{}",
|
} else {
|
||||||
|
write!(f.buf, "{}{},{},{},{}",
|
||||||
name,
|
name,
|
||||||
value.top,
|
value.top,
|
||||||
value.right,
|
value.right,
|
||||||
value.bottom,
|
value.bottom,
|
||||||
value.left)
|
value.left)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sends the size and position of this iframe box to the constellation. This is out of line to
|
/// Sends the size and position of this iframe box to the constellation. This is out of line to
|
||||||
|
@ -1456,6 +1438,29 @@ impl Box {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Show for Box {
|
||||||
|
/// Outputs a debugging string describing this box.
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
try!(write!(f.buf, "({} ",
|
||||||
|
match self.specific {
|
||||||
|
GenericBox => "GenericBox",
|
||||||
|
IframeBox(_) => "IframeBox",
|
||||||
|
ImageBox(_) => "ImageBox",
|
||||||
|
ScannedTextBox(_) => "ScannedTextBox",
|
||||||
|
TableBox => "TableBox",
|
||||||
|
TableCellBox => "TableCellBox",
|
||||||
|
TableColumnBox(_) => "TableColumnBox",
|
||||||
|
TableRowBox => "TableRowBox",
|
||||||
|
TableWrapperBox => "TableWrapperBox",
|
||||||
|
UnscannedTextBox(_) => "UnscannedTextBox",
|
||||||
|
}));
|
||||||
|
try!(self.side_offsets_debug_fmt("bp", self.border_padding, f));
|
||||||
|
try!(write!(f.buf, " "));
|
||||||
|
try!(self.side_offsets_debug_fmt("m", self.margin, f));
|
||||||
|
write!(f.buf, ")")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// An object that accumulates display lists of child flows, applying a clipping rect if necessary.
|
/// An object that accumulates display lists of child flows, applying a clipping rect if necessary.
|
||||||
pub struct ChildDisplayListAccumulator {
|
pub struct ChildDisplayListAccumulator {
|
||||||
clip_display_item: Option<~ClipDisplayItem>,
|
clip_display_item: Option<~ClipDisplayItem>,
|
||||||
|
|
|
@ -55,6 +55,7 @@ use gfx::render_task::RenderLayer;
|
||||||
use servo_msg::compositor_msg::LayerId;
|
use servo_msg::compositor_msg::LayerId;
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
use std::cast;
|
use std::cast;
|
||||||
|
use std::fmt;
|
||||||
use std::iter::Zip;
|
use std::iter::Zip;
|
||||||
use std::num::Zero;
|
use std::num::Zero;
|
||||||
use std::sync::atomics::Relaxed;
|
use std::sync::atomics::Relaxed;
|
||||||
|
@ -65,7 +66,7 @@ use style::computed_values::{clear, position, text_align};
|
||||||
///
|
///
|
||||||
/// Note that virtual methods have a cost; we should not overuse them in Servo. Consider adding
|
/// Note that virtual methods have a cost; we should not overuse them in Servo. Consider adding
|
||||||
/// methods to `ImmutableFlowUtils` or `MutableFlowUtils` before adding more methods here.
|
/// methods to `ImmutableFlowUtils` or `MutableFlowUtils` before adding more methods here.
|
||||||
pub trait Flow {
|
pub trait Flow: fmt::Show + ToStr {
|
||||||
// RTTI
|
// RTTI
|
||||||
//
|
//
|
||||||
// TODO(pcwalton): Use Rust's RTTI, once that works.
|
// TODO(pcwalton): Use Rust's RTTI, once that works.
|
||||||
|
@ -267,11 +268,6 @@ pub trait Flow {
|
||||||
LayerId(pointer, fragment_id)
|
LayerId(pointer, fragment_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a debugging string describing this flow.
|
|
||||||
fn debug_str(&self) -> ~str {
|
|
||||||
"???".to_owned()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base access
|
// Base access
|
||||||
|
@ -915,7 +911,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||||
for _ in range(0, level) {
|
for _ in range(0, level) {
|
||||||
indent.push_str("| ")
|
indent.push_str("| ")
|
||||||
}
|
}
|
||||||
debug!("{}+ {}", indent, self.debug_str());
|
debug!("{}+ {}", indent, self.to_str());
|
||||||
for kid in imm_child_iter(self) {
|
for kid in imm_child_iter(self) {
|
||||||
kid.dump_with_level(level + 1)
|
kid.dump_with_level(level + 1)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ use servo_util::geometry::Au;
|
||||||
use servo_util::geometry;
|
use servo_util::geometry;
|
||||||
use servo_util::range::Range;
|
use servo_util::range::Range;
|
||||||
use std::iter::Enumerate;
|
use std::iter::Enumerate;
|
||||||
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::slice::{Items, MutItems};
|
use std::slice::{Items, MutItems};
|
||||||
use std::u16;
|
use std::u16;
|
||||||
|
@ -235,8 +236,8 @@ impl LineboxScanner {
|
||||||
// try_append_to_line.
|
// try_append_to_line.
|
||||||
match first_box.split_to_width(line_bounds.size.width, line_is_empty) {
|
match first_box.split_to_width(line_bounds.size.width, line_is_empty) {
|
||||||
CannotSplit => {
|
CannotSplit => {
|
||||||
error!("LineboxScanner: Tried to split unsplittable render box! {:s}",
|
error!("LineboxScanner: Tried to split unsplittable render box! {}",
|
||||||
first_box.debug_str());
|
first_box);
|
||||||
return (line_bounds, first_box_size.width);
|
return (line_bounds, first_box_size.width);
|
||||||
}
|
}
|
||||||
SplitDidFit(left, right) => {
|
SplitDidFit(left, right) => {
|
||||||
|
@ -356,11 +357,11 @@ impl LineboxScanner {
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("LineboxScanner: Trying to append box to line {:u} (box size: {}, green zone: \
|
debug!("LineboxScanner: Trying to append box to line {:u} (box size: {}, green zone: \
|
||||||
{}): {:s}",
|
{}): {}",
|
||||||
self.lines.len(),
|
self.lines.len(),
|
||||||
in_box.border_box.size,
|
in_box.border_box.size,
|
||||||
self.pending_line.green_zone,
|
self.pending_line.green_zone,
|
||||||
in_box.debug_str());
|
in_box);
|
||||||
|
|
||||||
let green_zone = self.pending_line.green_zone;
|
let green_zone = self.pending_line.green_zone;
|
||||||
|
|
||||||
|
@ -400,8 +401,8 @@ impl LineboxScanner {
|
||||||
let split = in_box.split_to_width(available_width, line_is_empty);
|
let split = in_box.split_to_width(available_width, line_is_empty);
|
||||||
let (left, right) = match (split, line_is_empty) {
|
let (left, right) = match (split, line_is_empty) {
|
||||||
(CannotSplit, _) => {
|
(CannotSplit, _) => {
|
||||||
debug!("LineboxScanner: Tried to split unsplittable render box! {:s}",
|
debug!("LineboxScanner: Tried to split unsplittable render box! {}",
|
||||||
in_box.debug_str());
|
in_box);
|
||||||
self.work_list.push_front(in_box);
|
self.work_list.push_front(in_box);
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -756,7 +757,7 @@ impl Flow for InlineFlow {
|
||||||
|
|
||||||
let mut intrinsic_widths = IntrinsicWidths::new();
|
let mut intrinsic_widths = IntrinsicWidths::new();
|
||||||
for (fragment, context) in self.boxes.mut_iter() {
|
for (fragment, context) in self.boxes.mut_iter() {
|
||||||
debug!("Flow: measuring {:s}", fragment.debug_str());
|
debug!("Flow: measuring {}", *fragment);
|
||||||
|
|
||||||
let box_intrinsic_widths = fragment.intrinsic_widths(Some(context));
|
let box_intrinsic_widths = fragment.intrinsic_widths(Some(context));
|
||||||
intrinsic_widths.minimum_width = geometry::max(intrinsic_widths.minimum_width,
|
intrinsic_widths.minimum_width = geometry::max(intrinsic_widths.minimum_width,
|
||||||
|
@ -954,16 +955,19 @@ impl Flow for InlineFlow {
|
||||||
self.base.floats = scanner.floats();
|
self.base.floats = scanner.floats();
|
||||||
self.base.floats.translate(Point2D(Au::new(0), -self.base.position.size.height));
|
self.base.floats.translate(Point2D(Au::new(0), -self.base.position.size.height));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
impl fmt::Show for InlineFlow {
|
||||||
let mut string = "InlineFlow: ".to_str();
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
try!(write!(f.buf, "InlineFlow"));
|
||||||
for (i, (fragment, _)) in self.boxes.iter().enumerate() {
|
for (i, (fragment, _)) in self.boxes.iter().enumerate() {
|
||||||
if i != 0 {
|
if i == 0 {
|
||||||
string.push_str(", ")
|
try!(write!(f.buf, ": {}", fragment))
|
||||||
|
} else {
|
||||||
|
try!(write!(f.buf, ", {}", fragment))
|
||||||
}
|
}
|
||||||
string.push_str(fragment.debug_str())
|
|
||||||
}
|
}
|
||||||
string
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ use layout::wrapper::ThreadSafeLayoutNode;
|
||||||
|
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
use servo_util::geometry;
|
use servo_util::geometry;
|
||||||
|
use std::fmt;
|
||||||
use style::computed_values::table_layout;
|
use style::computed_values::table_layout;
|
||||||
|
|
||||||
/// A table flow corresponded to the table's internal table box under a table wrapper flow.
|
/// A table flow corresponded to the table's internal table box under a table wrapper flow.
|
||||||
|
@ -287,10 +288,12 @@ impl Flow for TableFlow {
|
||||||
fn compute_absolute_position(&mut self) {
|
fn compute_absolute_position(&mut self) {
|
||||||
self.block_flow.compute_absolute_position()
|
self.block_flow.compute_absolute_position()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
impl fmt::Show for TableFlow {
|
||||||
let txt = "TableFlow: ".to_owned();
|
/// Outputs a debugging string describing this table flow.
|
||||||
txt.append(self.block_flow.box_.debug_str())
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f.buf, "TableFlow: {}", self.block_flow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,8 @@ use layout::context::LayoutContext;
|
||||||
use layout::flow::{TableCaptionFlowClass, FlowClass, Flow};
|
use layout::flow::{TableCaptionFlowClass, FlowClass, Flow};
|
||||||
use layout::wrapper::ThreadSafeLayoutNode;
|
use layout::wrapper::ThreadSafeLayoutNode;
|
||||||
|
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
pub struct TableCaptionFlow {
|
pub struct TableCaptionFlow {
|
||||||
pub block_flow: BlockFlow,
|
pub block_flow: BlockFlow,
|
||||||
|
@ -60,9 +62,10 @@ impl Flow for TableCaptionFlow {
|
||||||
fn compute_absolute_position(&mut self) {
|
fn compute_absolute_position(&mut self) {
|
||||||
self.block_flow.compute_absolute_position()
|
self.block_flow.compute_absolute_position()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
impl fmt::Show for TableCaptionFlow {
|
||||||
let txt = "TableCaptionFlow: ".to_owned();
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
txt.append(self.block_flow.box_.debug_str())
|
write!(f.buf, "TableCaptionFlow: {}", self.block_flow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ use layout::table::InternalTable;
|
||||||
use layout::wrapper::ThreadSafeLayoutNode;
|
use layout::wrapper::ThreadSafeLayoutNode;
|
||||||
|
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
pub struct TableCellFlow {
|
pub struct TableCellFlow {
|
||||||
|
@ -109,10 +110,10 @@ impl Flow for TableCellFlow {
|
||||||
fn compute_absolute_position(&mut self) {
|
fn compute_absolute_position(&mut self) {
|
||||||
self.block_flow.compute_absolute_position()
|
self.block_flow.compute_absolute_position()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
|
||||||
let txt = "TableCellFlow: ".to_owned();
|
|
||||||
txt.append(self.block_flow.box_.debug_str())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Show for TableCellFlow {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f.buf, "TableCellFlow: {}", self.block_flow)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,9 @@ use layout::context::LayoutContext;
|
||||||
use layout::flow::{BaseFlow, TableColGroupFlowClass, FlowClass, Flow};
|
use layout::flow::{BaseFlow, TableColGroupFlowClass, FlowClass, Flow};
|
||||||
use layout::model::{MaybeAuto};
|
use layout::model::{MaybeAuto};
|
||||||
use layout::wrapper::ThreadSafeLayoutNode;
|
use layout::wrapper::ThreadSafeLayoutNode;
|
||||||
|
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
pub struct TableColGroupFlow {
|
pub struct TableColGroupFlow {
|
||||||
|
@ -72,12 +74,13 @@ impl Flow for TableColGroupFlow {
|
||||||
/// Table column do not have height.
|
/// Table column do not have height.
|
||||||
fn assign_height(&mut self, _ctx: &mut LayoutContext) {
|
fn assign_height(&mut self, _ctx: &mut LayoutContext) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
impl fmt::Show for TableColGroupFlow {
|
||||||
let txt = "TableColGroupFlow: ".to_owned();
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
txt.append(match self.box_ {
|
match self.box_ {
|
||||||
Some(ref rb) => rb.debug_str(),
|
Some(ref rb) => write!(f.buf, "TableColGroupFlow: {}", rb),
|
||||||
None => "".to_owned(),
|
None => write!(f.buf, "TableColGroupFlow"),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ use layout::wrapper::ThreadSafeLayoutNode;
|
||||||
|
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
use servo_util::geometry;
|
use servo_util::geometry;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
pub struct TableRowFlow {
|
pub struct TableRowFlow {
|
||||||
|
@ -213,10 +214,10 @@ impl Flow for TableRowFlow {
|
||||||
fn compute_absolute_position(&mut self) {
|
fn compute_absolute_position(&mut self) {
|
||||||
self.block_flow.compute_absolute_position()
|
self.block_flow.compute_absolute_position()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
|
||||||
let txt = "TableRowFlow: ".to_owned();
|
|
||||||
txt.append(self.block_flow.box_.debug_str())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Show for TableRowFlow {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f.buf, "TableRowFlow: {}", self.block_flow.box_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ use layout::wrapper::ThreadSafeLayoutNode;
|
||||||
|
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
use servo_util::geometry;
|
use servo_util::geometry;
|
||||||
|
use std::fmt;
|
||||||
|
|
||||||
/// A table formatting context.
|
/// A table formatting context.
|
||||||
pub struct TableRowGroupFlow {
|
pub struct TableRowGroupFlow {
|
||||||
|
@ -195,10 +196,10 @@ impl Flow for TableRowGroupFlow {
|
||||||
fn compute_absolute_position(&mut self) {
|
fn compute_absolute_position(&mut self) {
|
||||||
self.block_flow.compute_absolute_position()
|
self.block_flow.compute_absolute_position()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
|
||||||
let txt = "TableRowGroupFlow: ".to_owned();
|
|
||||||
txt.append(self.block_flow.box_.debug_str())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Show for TableRowGroupFlow {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f.buf, "TableRowGroupFlow: {}", self.block_flow.box_)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ use layout::wrapper::ThreadSafeLayoutNode;
|
||||||
|
|
||||||
use servo_util::geometry::Au;
|
use servo_util::geometry::Au;
|
||||||
use servo_util::geometry;
|
use servo_util::geometry;
|
||||||
|
use std::fmt;
|
||||||
use style::computed_values::table_layout;
|
use style::computed_values::table_layout;
|
||||||
|
|
||||||
pub enum TableLayout {
|
pub enum TableLayout {
|
||||||
|
@ -188,14 +189,15 @@ impl Flow for TableWrapperFlow {
|
||||||
fn compute_absolute_position(&mut self) {
|
fn compute_absolute_position(&mut self) {
|
||||||
self.block_flow.compute_absolute_position()
|
self.block_flow.compute_absolute_position()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn debug_str(&self) -> ~str {
|
impl fmt::Show for TableWrapperFlow {
|
||||||
let txt = if self.is_float() {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
"TableWrapperFlow(Float): ".to_owned()
|
if self.is_float() {
|
||||||
|
write!(f.buf, "TableWrapperFlow(Float): {}", self.block_flow.box_)
|
||||||
} else {
|
} else {
|
||||||
"TableWrapperFlow: ".to_owned()
|
write!(f.buf, "TableWrapperFlow: {}", self.block_flow.box_)
|
||||||
};
|
}
|
||||||
txt.append(self.block_flow.box_.debug_str())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -237,8 +237,7 @@ impl TextRunScanner {
|
||||||
let range = new_ranges.get(logical_offset);
|
let range = new_ranges.get(logical_offset);
|
||||||
if range.length() == 0 {
|
if range.length() == 0 {
|
||||||
debug!("Elided an `UnscannedTextbox` because it was zero-length after \
|
debug!("Elided an `UnscannedTextbox` because it was zero-length after \
|
||||||
compression; {:s}",
|
compression; {}", in_boxes[i]);
|
||||||
in_boxes[i].debug_str());
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue