aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Atkinson <eatkinson@mozilla.com>2013-06-07 22:02:44 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-06-12 11:02:51 -0700
commit0bbf2fc30a872df42bfbd65c51df5b7f36860f81 (patch)
tree3df239d9b9d6e48eb7992c16c7e300210cc9b803 /src
parentff1178f7ca6cf6ec89b79b38f0dc3bb226462841 (diff)
downloadservo-0bbf2fc30a872df42bfbd65c51df5b7f36860f81.tar.gz
servo-0bbf2fc30a872df42bfbd65c51df5b7f36860f81.zip
Refactor flow tree construction and actually use display property.
Diffstat (limited to 'src')
-rw-r--r--src/components/main/layout/box.rs23
-rw-r--r--src/components/main/layout/box_builder.rs8
-rw-r--r--src/components/main/platform/common/glut_windowing.rs15
3 files changed, 28 insertions, 18 deletions
diff --git a/src/components/main/layout/box.rs b/src/components/main/layout/box.rs
index 78934a937b4..48b5ede54c8 100644
--- a/src/components/main/layout/box.rs
+++ b/src/components/main/layout/box.rs
@@ -627,19 +627,20 @@ 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| {
- let border_display_item = ~BorderDisplayItem {
- base: BaseDisplayItem {
- bounds: absolute_box_bounds,
- extra: ExtraDisplayListData::new(*self),
- },
- width: Au::from_px(1),
- color: rgb(0, 0, 0).to_gfx_color(),
- };
+ // Compute the text box bounds and draw a border surrounding them.
+ do list.with_mut_ref |list| {
+ let border_display_item = ~BorderDisplayItem {
+ base: BaseDisplayItem {
+ bounds: absolute_box_bounds,
+ extra: ExtraDisplayListData::new(*self),
+ },
+ width: Au::from_px(1),
+ color: rgb(0, 0, 0).to_gfx_color(),
+ };
list.append_item(BorderDisplayItemClass(border_display_item))
- }
+ }
});
}
diff --git a/src/components/main/layout/box_builder.rs b/src/components/main/layout/box_builder.rs
index 99153d51ee4..b446f8a7172 100644
--- a/src/components/main/layout/box_builder.rs
+++ b/src/components/main/layout/box_builder.rs
@@ -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);
}
}
}
diff --git a/src/components/main/platform/common/glut_windowing.rs b/src/components/main/platform/common/glut_windowing.rs
index d301dca365d..b50698c5674 100644
--- a/src/components/main/platform/common/glut_windowing.rs
+++ b/src/components/main/platform/common/glut_windowing.rs
@@ -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();