Skip to content

Commit

Permalink
Create text runs during box building
Browse files Browse the repository at this point in the history
  • Loading branch information
sethfowler committed Jun 27, 2013
1 parent bc520e0 commit 4b172a3
Show file tree
Hide file tree
Showing 5 changed files with 382 additions and 363 deletions.
17 changes: 15 additions & 2 deletions src/components/main/layout/box_builder.rs
Expand Up @@ -15,6 +15,7 @@ use layout::flow::{AbsoluteFlow, BlockFlow, FloatFlow, Flow_Absolute, Flow_Block
use layout::flow::{Flow_Inline, Flow_InlineBlock, Flow_Root, Flow_Table, FlowContext};
use layout::flow::{FlowContextType, FlowData, InlineBlockFlow, InlineFlow, TableFlow};
use layout::inline::{InlineFlowData, InlineLayout};
use layout::text::TextRunScanner;
use css::node_style::StyledNode;

use newcss::values::{CSSDisplay, CSSDisplayBlock, CSSDisplayInline, CSSDisplayInlineBlock};
Expand Down Expand Up @@ -467,7 +468,7 @@ impl LayoutTreeBuilder {
///
/// The latter can only be done immediately adjacent to, or at the beginning or end of a block
/// flow. Otherwise, the whitespace might affect whitespace collapsing with adjacent text.
pub fn simplify_children_of_flow(&self, _: &LayoutContext, parent_flow: &mut FlowContext) {
pub fn simplify_children_of_flow(&self, ctx: &LayoutContext, parent_flow: &mut FlowContext) {
match *parent_flow {
InlineFlow(*) => {
let mut found_child_inline = false;
Expand All @@ -486,7 +487,7 @@ impl LayoutTreeBuilder {
self.fixup_split_inline(*parent_flow)
}
},
BlockFlow(*) => {
BlockFlow(*) | FloatFlow(*) => {
// FIXME: this will create refcounted cycles between the removed flow and any
// of its RenderBox or FlowContext children, and possibly keep alive other junk

Expand Down Expand Up @@ -536,6 +537,18 @@ impl LayoutTreeBuilder {
}
}
}

// Issue 543: We only need to do this if there are inline child
// flows, but there's not a quick way to check at the moment.
for (*parent_flow).each_child |child_flow: FlowContext| {
match child_flow {
InlineFlow(*) | InlineBlockFlow(*) => {
let mut scanner = TextRunScanner::new();
scanner.scan_for_runs(ctx, child_flow);
}
_ => {}
}
}
},
_ => {}
}
Expand Down

5 comments on commit 4b172a3

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at sethfowler@4b172a3

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging sfowler/servo/create-textruns-in-box-builder = 4b172a3 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sfowler/servo/create-textruns-in-box-builder = 4b172a3 merged ok, testing candidate = a066ce6

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = a066ce6

Please sign in to comment.