Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate the DOM and layout into separate crates. #474

Merged
merged 9 commits into from May 30, 2013

Remove the layout debug methods.

Premature abstraction; nothing used the traits polymorphically. Furthermore,
they increased coupling between layout and the DOM.
  • Loading branch information
pcwalton committed May 28, 2013
commit 0ea1a94f8e8a07378d23552a620a45d610db31c7
@@ -12,7 +12,6 @@ use dom::characterdata::CharacterData;
use dom::document::Document;
use dom::element::{Element, ElementTypeId, HTMLImageElement, HTMLImageElementTypeId};
use dom::element::{HTMLStyleElementTypeId};
use layout::debug::DebugMethods;
use scripting::script_task::global_script_context;

use core::cast::transmute;
@@ -354,16 +353,14 @@ impl<View> AbstractNode<View> {
obj: raw
}
}
}

impl<View> DebugMethods for AbstractNode<View> {
// Dumps the subtree rooted at this node, for debugging.
fn dump(&self) {
/// Dumps the subtree rooted at this node, for debugging.
pub fn dump(&self) {
self.dump_indent(0);
}

// Dumps the node tree, for debugging, with indentation.
fn dump_indent(&self, indent: uint) {
/// Dumps the node tree, for debugging, with indentation.
pub fn dump_indent(&self, indent: uint) {
let mut s = ~"";
for uint::range(0u, indent) |_i| {
s += ~" ";
@@ -378,7 +375,8 @@ impl<View> DebugMethods for AbstractNode<View> {
}
}

fn debug_str(&self) -> ~str {
/// Returns a string that describes this node.
pub fn debug_str(&self) -> ~str {
fmt!("%?", self.type_id())
}
}
@@ -7,7 +7,6 @@
use css::node_style::StyledNode;
use dom::node::{AbstractNode, LayoutView};
use layout::context::LayoutContext;
use layout::debug::DebugMethods;
use layout::display_list_builder::{DisplayListBuilder, ToGfxColor};
use layout::flow::FlowContext;
use layout::text;
@@ -795,15 +794,14 @@ pub impl RenderBox {
}
get_propagated_text_decoration(self.nearest_ancestor_element())
}
}

impl DebugMethods for RenderBox {
fn dump(&self) {
/// Dumps this node, for debugging.
pub fn dump(&self) {
self.dump_indent(0);
}

/// Dumps a render box for debugging, with indentation.
fn dump_indent(&self, indent: uint) {
pub fn dump_indent(&self, indent: uint) {
let mut string = ~"";
for uint::range(0u, indent) |_i| {
string += ~" ";
@@ -814,7 +812,7 @@ impl DebugMethods for RenderBox {
}

/// Returns a debugging string describing this box.
fn debug_str(&self) -> ~str {
pub fn debug_str(&self) -> ~str {
let representation = match *self {
GenericRenderBoxClass(*) => ~"GenericRenderBox",
ImageRenderBoxClass(*) => ~"ImageRenderBox",
@@ -13,7 +13,6 @@ use layout::box::{GenericRenderBoxClass, ImageRenderBox, ImageRenderBoxClass, Re
use layout::box::{RenderBoxBase, RenderBoxType, RenderBox_Generic, RenderBox_Image};
use layout::box::{RenderBox_Text, UnscannedTextRenderBox, UnscannedTextRenderBoxClass};
use layout::context::LayoutContext;
use layout::debug::{BoxedMutDebugMethods, DebugMethods};
use layout::flow::{AbsoluteFlow, BlockFlow, FloatFlow, Flow_Absolute, Flow_Block, Flow_Float};
use layout::flow::{Flow_Inline, Flow_InlineBlock, Flow_Root, Flow_Table, FlowContext};
use layout::flow::{FlowContextType, FlowData, InlineBlockFlow, InlineFlow, TableFlow};

This file was deleted.

@@ -29,7 +29,6 @@ use dom::node::{AbstractNode, LayoutView};
use layout::block::BlockFlowData;
use layout::box::RenderBox;
use layout::context::LayoutContext;
use layout::debug::DebugMethods;
use layout::display_list_builder::DisplayListBuilder;
use layout::inline::{InlineFlowData};

@@ -372,15 +371,14 @@ impl<'self> FlowContext {

true
}
}

impl DebugMethods for FlowContext {
fn dump(&self) {
/// Dumps the flow tree for debugging.
pub fn dump(&self) {
self.dump_indent(0);
}

/// Dumps the flow tree, for debugging, with indentation.
fn dump_indent(&self, indent: uint) {
pub fn dump_indent(&self, indent: uint) {
let mut s = ~"|";
for uint::range(0, indent) |_i| {
s += ~"---- ";
@@ -395,7 +393,7 @@ impl DebugMethods for FlowContext {
}
}

fn debug_str(&self) -> ~str {
pub fn debug_str(&self) -> ~str {
let repr = match *self {
InlineFlow(inline) => {
let mut s = inline.boxes.foldl(~"InlineFlow(children=", |s, box| {
@@ -8,7 +8,6 @@ use dom::node::{AbstractNode, LayoutView};
use layout::box::{CannotSplit, GenericRenderBoxClass, ImageRenderBoxClass, RenderBox};
use layout::box::{SplitDidFit, SplitDidNotFit, TextRenderBoxClass, UnscannedTextRenderBoxClass};
use layout::context::LayoutContext;
use layout::debug::{BoxedDebugMethods, BoxedMutDebugMethods, DebugMethods};
use layout::display_list_builder::DisplayListBuilder;
use layout::flow::{FlowContext, FlowData, InlineFlow};
use layout::text::{UnscannedMethods, adapt_textbox_with_range};
@@ -12,7 +12,6 @@ use dom::node::{AbstractNode, LayoutView};
use layout::aux::{LayoutData, LayoutAuxMethods};
use layout::box_builder::LayoutTreeBuilder;
use layout::context::LayoutContext;
use layout::debug::{BoxedMutDebugMethods, DebugMethods};
use layout::display_list_builder::{DisplayListBuilder, FlowDisplayListBuilderMethods};
use layout::flow::FlowContext;
use layout_interface::{AddStylesheetMsg, BuildData, BuildMsg, ContentBoxQuery, ContentBoxResponse};
@@ -107,7 +107,6 @@ pub mod layout {
pub mod box;
pub mod box_builder;
pub mod context;
pub mod debug;
pub mod display_list_builder;
pub mod flow;
pub mod layout_task;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.