Refactor flow tree construction and actually use display property.

This commit is contained in:
Eric Atkinson 2013-06-07 22:02:44 -07:00 committed by Patrick Walton
parent ff1178f7ca
commit 0bbf2fc30a
3 changed files with 28 additions and 18 deletions

View file

@ -627,6 +627,7 @@ pub impl RenderBox {
},
GenericRenderBoxClass(_) => {
// FIXME(pcwalton): This is somewhat of an abuse of the logging system.
debug!("%?", {
// Compute the text box bounds and draw a border surrounding them.
do list.with_mut_ref |list| {

View file

@ -451,7 +451,7 @@ pub impl LayoutTreeBuilder {
let first_child = do parent_flow.with_base |parent_node| {
parent_node.first_child
};
for first_child.each |first_flow| {
for first_child.each |&first_flow| {
if first_flow.starts_inline_flow() {
// FIXME: workaround for rust#6393
let mut do_remove = false;
@ -466,7 +466,7 @@ pub impl LayoutTreeBuilder {
}
}
if (do_remove) {
(*parent_flow).remove_child(*first_flow);
(*parent_flow).remove_child(first_flow);
}
}
}
@ -474,7 +474,7 @@ pub impl LayoutTreeBuilder {
let last_child = do parent_flow.with_base |parent_node| {
parent_node.last_child
};
for last_child.each |last_flow| {
for last_child.each |&last_flow| {
if last_flow.starts_inline_flow() {
// FIXME: workaround for rust#6393
let mut do_remove = false;
@ -489,7 +489,7 @@ pub impl LayoutTreeBuilder {
}
}
if (do_remove) {
(*parent_flow).remove_child(*last_flow);
(*parent_flow).remove_child(last_flow);
}
}
}

View file

@ -15,7 +15,7 @@ use alert::{Alert, AlertMethods};
use core::libc::c_int;
use geom::point::Point2D;
use geom::size::Size2D;
use glut::glut::{ACTIVE_CTRL, DOUBLE, WindowHeight, WindowWidth};
use glut::glut::{ACTIVE_CTRL, DOUBLE, HAVE_PRECISE_MOUSE_WHEEL, WindowHeight, WindowWidth};
use glut::glut;
use glut::machack;
@ -92,10 +92,19 @@ impl WindowMethods<Application> for Window {
do glut::mouse_func |button, state, x, y| {
if button < 3 {
window.handle_mouse(button, state, x, y);
} else {
window.handle_scroll(if button == 4 { -30.0 } else { 30.0 });
}
}
do glut::mouse_wheel_func |button, direction, x, y| {
let delta = if HAVE_PRECISE_MOUSE_WHEEL {
(direction as f32) / 10000.0
} else {
(direction as f32) * 30.0
};
println(fmt!("delta is %f", delta as float));
window.handle_scroll(delta);
}
machack::perform_scroll_wheel_hack();