layout: Don't delete non-text boxes from the list of input boxes when

flushing text clumps. Fixes this page:

    http://en.wikipedia.org/wiki/Yellow_River

This is not the most efficient thing to do; a FIXME has been added
noting what is most correct.
This commit is contained in:
Patrick Walton 2013-12-11 14:35:13 -08:00
parent c9c9984d47
commit dcacab8149
4 changed files with 22 additions and 12 deletions

View file

@ -280,6 +280,9 @@ impl<'self> FlowConstructor<'self> {
// Flush any inline boxes that we were gathering up. This allows us to handle
// {ib} splits.
debug!("flushing {} inline box(es) to flow A",
opt_boxes_for_inline_flow.as_ref()
.map_default(0, |boxes| boxes.len()));
self.flush_inline_boxes_to_flow_if_necessary(&mut opt_boxes_for_inline_flow,
flow,
node);
@ -312,6 +315,10 @@ impl<'self> FlowConstructor<'self> {
}
// Flush any inline boxes that we were gathering up.
debug!("flushing {} inline box(es) to flow A",
opt_boxes_for_inline_flow.as_ref()
.map_default(0,
|boxes| boxes.len()));
self.flush_inline_boxes_to_flow_if_necessary(
&mut opt_boxes_for_inline_flow,
flow,
@ -473,6 +480,8 @@ impl<'self> PostorderNodeMutTraversal for FlowConstructor<'self> {
DocumentNodeTypeId(_) => (display::none, float::none),
};
debug!("building flow for node: {:?} {:?}", display, float);
// Switch on display and floatedness.
match (display, float) {
// `display: none` contributes no flow construction result. Nuke the flow construction
@ -573,6 +582,7 @@ fn strip_ignorable_whitespace_from_start(opt_boxes: &mut Option<~[Box]>) {
let mut result = ~[];
for box in boxes.move_iter() {
if !found_nonwhitespace && box.is_whitespace_only() {
debug!("stripping ignorable whitespace from start");
continue
}
@ -591,6 +601,7 @@ fn strip_ignorable_whitespace_from_end(opt_boxes: &mut Option<~[Box]>) {
None => {}
Some(ref mut boxes) => {
while boxes.len() > 0 && boxes.last().is_whitespace_only() {
debug!("stripping ignorable whitespace from end");
let _ = boxes.pop();
}
}