mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
auto merge of #1212 : larsbergstrom/servo/dump_flows, r=brson
With @ryanhc Will add more debugging information for RenderBoxes in InlineFlows and `dump_str` for each of the RenderBoxes later.
This commit is contained in:
commit
4a830517e5
4 changed files with 43 additions and 2 deletions
|
@ -506,5 +506,19 @@ impl FlowContext for BlockFlow {
|
||||||
|
|
||||||
*first_in_flow = false;
|
*first_in_flow = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn debug_str(&self) -> ~str {
|
||||||
|
if self.is_root {
|
||||||
|
~"BlockFlow(root)"
|
||||||
|
} else {
|
||||||
|
let txt = ~"BlockFlow: ";
|
||||||
|
txt.append(match self.box {
|
||||||
|
Some(rb) => {
|
||||||
|
rb.debug_str()
|
||||||
|
}
|
||||||
|
None => { ~"" }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -315,5 +315,8 @@ impl FlowContext for FloatFlow {
|
||||||
// Margins between a floated box and any other box do not collapse.
|
// Margins between a floated box and any other box do not collapse.
|
||||||
*collapsing = Au::new(0);
|
*collapsing = Au::new(0);
|
||||||
}
|
}
|
||||||
|
fn debug_str(&self) -> ~str {
|
||||||
|
~"FloatFlow"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ use layout::float_context::{FloatContext, Invalid};
|
||||||
use layout::incremental::RestyleDamage;
|
use layout::incremental::RestyleDamage;
|
||||||
use layout::inline::InlineFlow;
|
use layout::inline::InlineFlow;
|
||||||
|
|
||||||
use extra::dlist::{DList,MutDListIterator};
|
use extra::dlist::{DList, DListIterator, MutDListIterator};
|
||||||
use extra::container::Deque;
|
use extra::container::Deque;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use geom::rect::Rect;
|
use geom::rect::Rect;
|
||||||
|
@ -127,6 +127,11 @@ pub fn base<'a>(this: &'a FlowContext) -> &'a FlowData {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Iterates over the children of this immutable flow.
|
||||||
|
pub fn imm_child_iter<'a>(flow: &'a FlowContext) -> DListIterator<'a,~FlowContext:> {
|
||||||
|
base(flow).children.iter()
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn mut_base<'a>(this: &'a mut FlowContext) -> &'a mut FlowData {
|
pub fn mut_base<'a>(this: &'a mut FlowContext) -> &'a mut FlowData {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -162,6 +167,9 @@ pub trait ImmutableFlowUtils {
|
||||||
|
|
||||||
/// Dumps the flow tree for debugging.
|
/// Dumps the flow tree for debugging.
|
||||||
fn dump(self);
|
fn dump(self);
|
||||||
|
|
||||||
|
/// Dumps the flow tree for debugging, with a prefix to indicate that we're at the given level.
|
||||||
|
fn dump_with_level(self, level: uint);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait MutableFlowUtils {
|
pub trait MutableFlowUtils {
|
||||||
|
@ -411,7 +419,19 @@ impl<'self> ImmutableFlowUtils for &'self FlowContext {
|
||||||
|
|
||||||
/// Dumps the flow tree for debugging.
|
/// Dumps the flow tree for debugging.
|
||||||
fn dump(self) {
|
fn dump(self) {
|
||||||
// TODO(pcwalton): Fill this in.
|
self.dump_with_level(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Dumps the flow tree for debugging, with a prefix to indicate that we're at the given level.
|
||||||
|
fn dump_with_level(self, level: uint) {
|
||||||
|
let mut indent = ~"";
|
||||||
|
for _ in range(0, level) {
|
||||||
|
indent.push_str("| ")
|
||||||
|
}
|
||||||
|
debug!("{}+ {}", indent, self.debug_str());
|
||||||
|
for kid in imm_child_iter(self) {
|
||||||
|
kid.dump_with_level(level + 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -891,5 +891,9 @@ impl FlowContext for InlineFlow {
|
||||||
*collapsible = Au::new(0);
|
*collapsible = Au::new(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn debug_str(&self) -> ~str {
|
||||||
|
~"InlineFlow"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue