mirror of
https://github.com/servo/servo.git
synced 2025-06-25 09:34:32 +01:00
Refactor flow tree construction and actually use display property.
This commit is contained in:
parent
ff1178f7ca
commit
0bbf2fc30a
3 changed files with 28 additions and 18 deletions
|
@ -627,6 +627,7 @@ pub impl RenderBox {
|
||||||
},
|
},
|
||||||
|
|
||||||
GenericRenderBoxClass(_) => {
|
GenericRenderBoxClass(_) => {
|
||||||
|
// FIXME(pcwalton): This is somewhat of an abuse of the logging system.
|
||||||
debug!("%?", {
|
debug!("%?", {
|
||||||
// Compute the text box bounds and draw a border surrounding them.
|
// Compute the text box bounds and draw a border surrounding them.
|
||||||
do list.with_mut_ref |list| {
|
do list.with_mut_ref |list| {
|
||||||
|
|
|
@ -451,7 +451,7 @@ pub impl LayoutTreeBuilder {
|
||||||
let first_child = do parent_flow.with_base |parent_node| {
|
let first_child = do parent_flow.with_base |parent_node| {
|
||||||
parent_node.first_child
|
parent_node.first_child
|
||||||
};
|
};
|
||||||
for first_child.each |first_flow| {
|
for first_child.each |&first_flow| {
|
||||||
if first_flow.starts_inline_flow() {
|
if first_flow.starts_inline_flow() {
|
||||||
// FIXME: workaround for rust#6393
|
// FIXME: workaround for rust#6393
|
||||||
let mut do_remove = false;
|
let mut do_remove = false;
|
||||||
|
@ -466,7 +466,7 @@ pub impl LayoutTreeBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (do_remove) {
|
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| {
|
let last_child = do parent_flow.with_base |parent_node| {
|
||||||
parent_node.last_child
|
parent_node.last_child
|
||||||
};
|
};
|
||||||
for last_child.each |last_flow| {
|
for last_child.each |&last_flow| {
|
||||||
if last_flow.starts_inline_flow() {
|
if last_flow.starts_inline_flow() {
|
||||||
// FIXME: workaround for rust#6393
|
// FIXME: workaround for rust#6393
|
||||||
let mut do_remove = false;
|
let mut do_remove = false;
|
||||||
|
@ -489,7 +489,7 @@ pub impl LayoutTreeBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (do_remove) {
|
if (do_remove) {
|
||||||
(*parent_flow).remove_child(*last_flow);
|
(*parent_flow).remove_child(last_flow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ use alert::{Alert, AlertMethods};
|
||||||
use core::libc::c_int;
|
use core::libc::c_int;
|
||||||
use geom::point::Point2D;
|
use geom::point::Point2D;
|
||||||
use geom::size::Size2D;
|
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::glut;
|
||||||
use glut::machack;
|
use glut::machack;
|
||||||
|
|
||||||
|
@ -92,10 +92,19 @@ impl WindowMethods<Application> for Window {
|
||||||
do glut::mouse_func |button, state, x, y| {
|
do glut::mouse_func |button, state, x, y| {
|
||||||
if button < 3 {
|
if button < 3 {
|
||||||
window.handle_mouse(button, state, x, y);
|
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();
|
machack::perform_scroll_wheel_hack();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue