Don't clip layers to the screen area

This commit is contained in:
Patrick Walton 2013-05-29 14:29:25 -07:00
parent 0af3bbf953
commit 2d1a00c3cf
2 changed files with 16 additions and 11 deletions

View file

@ -10,12 +10,12 @@ use layout::display_list_builder::{DisplayListBuilder, FlowDisplayListBuilderMet
use layout::flow::{BlockFlow, FlowContext, FlowData, InlineBlockFlow}; use layout::flow::{BlockFlow, FlowContext, FlowData, InlineBlockFlow};
use layout::inline::InlineLayout; use layout::inline::InlineLayout;
use au = gfx::geometry;
use core::cell::Cell; use core::cell::Cell;
use geom::point::Point2D; use geom::point::Point2D;
use geom::rect::Rect; use geom::rect::Rect;
use gfx::display_list::DisplayList; use gfx::display_list::DisplayList;
use gfx::geometry::Au; use gfx::geometry::Au;
use gfx::geometry;
use servo_util::tree::{TreeNodeRef, TreeUtils}; use servo_util::tree::{TreeNodeRef, TreeUtils};
pub struct BlockFlowData { pub struct BlockFlowData {
@ -95,8 +95,8 @@ impl BlockFlowData {
assert!(child_ctx.starts_block_flow() || child_ctx.starts_inline_flow()); assert!(child_ctx.starts_block_flow() || child_ctx.starts_inline_flow());
do child_ctx.with_base |child_node| { do child_ctx.with_base |child_node| {
min_width = au::max(min_width, child_node.min_width); min_width = geometry::max(min_width, child_node.min_width);
pref_width = au::max(pref_width, child_node.pref_width); pref_width = geometry::max(pref_width, child_node.pref_width);
} }
} }
@ -155,8 +155,11 @@ impl BlockFlowData {
} }
} }
let height = if self.is_root { Au::max(ctx.screen_size.size.height, cur_y) } let height = if self.is_root {
else { cur_y }; Au::max(ctx.screen_size.size.height, cur_y)
} else {
cur_y
};
self.common.position.size.height = height; self.common.position.size.height = height;

View file

@ -13,10 +13,6 @@ use layout::context::LayoutContext;
use layout::display_list_builder::{DisplayListBuilder, FlowDisplayListBuilderMethods}; use layout::display_list_builder::{DisplayListBuilder, FlowDisplayListBuilderMethods};
use layout::flow::FlowContext; use layout::flow::FlowContext;
use util::task::spawn_listener; use util::task::spawn_listener;
use servo_util::time;
use servo_util::time::time;
use servo_util::time::profile;
use servo_util::time::ProfilerChan;
use core::cast::transmute; use core::cast::transmute;
use core::cell::Cell; use core::cell::Cell;
@ -42,7 +38,9 @@ use script::layout_interface::{MatchSelectorsDamage, Msg, NoDamage, QueryMsg, Re
use script::script_task::{ScriptMsg, SendEventMsg}; use script::script_task::{ScriptMsg, SendEventMsg};
use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg}; use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg};
use servo_net::local_image_cache::LocalImageCache; use servo_net::local_image_cache::LocalImageCache;
use servo_util::tree::TreeUtils; use servo_util::tree::{TreeNodeRef, TreeUtils};
use servo_util::time::{ProfilerChan, profile, time};
use servo_util::time;
pub fn create_layout_task(render_task: RenderTask, pub fn create_layout_task(render_task: RenderTask,
img_cache_task: ImageCacheTask, img_cache_task: ImageCacheTask,
@ -222,9 +220,13 @@ impl Layout {
// TODO: Be smarter about what needs painting. // TODO: Be smarter about what needs painting.
layout_root.build_display_list(&builder, &layout_root.position(), display_list); layout_root.build_display_list(&builder, &layout_root.position(), display_list);
let root_size = do layout_root.with_base |base| {
base.position.size
};
let render_layer = RenderLayer { let render_layer = RenderLayer {
display_list: display_list.take(), display_list: display_list.take(),
size: Size2D(screen_size.width.to_px() as uint, screen_size.height.to_px() as uint) size: Size2D(root_size.width.to_px() as uint, root_size.height.to_px() as uint)
}; };
self.render_task.channel.send(RenderMsg(render_layer)); self.render_task.channel.send(RenderMsg(render_layer));