Auto merge of #13012 - servo:shared-layout-context, r=nox

Stop creating a LayoutContext in build_display_list_for_subtree.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13012)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-08-24 09:38:31 -05:00 committed by GitHub
commit 6191748907
18 changed files with 66 additions and 60 deletions

View file

@ -8,7 +8,7 @@
use app_units::Au;
use canvas_traits::CanvasMsg;
use context::LayoutContext;
use context::{LayoutContext, SharedLayoutContext};
use euclid::{Point2D, Rect, Size2D};
use floats::ClearType;
use flow::{self, ImmutableFlowUtils};
@ -42,6 +42,7 @@ use style::computed_values::content::ContentItem;
use style::computed_values::{border_collapse, box_sizing, clear, color, display, mix_blend_mode};
use style::computed_values::{overflow_wrap, overflow_x, position, text_decoration};
use style::computed_values::{transform_style, vertical_align, white_space, word_break, z_index};
use style::context::SharedStyleContext;
use style::dom::TRestyleDamage;
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
use style::properties::ServoComputedValues;
@ -323,7 +324,10 @@ pub struct CanvasFragmentInfo {
}
impl CanvasFragmentInfo {
pub fn new<N: ThreadSafeLayoutNode>(node: &N, data: HTMLCanvasData, ctx: &LayoutContext) -> CanvasFragmentInfo {
pub fn new<N: ThreadSafeLayoutNode>(node: &N,
data: HTMLCanvasData,
ctx: &SharedStyleContext)
-> CanvasFragmentInfo {
CanvasFragmentInfo {
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, ctx),
ipc_renderer: data.ipc_renderer
@ -368,9 +372,10 @@ impl ImageFragmentInfo {
/// FIXME(pcwalton): The fact that image fragments store the cache in the fragment makes little
/// sense to me.
pub fn new<N: ThreadSafeLayoutNode>(node: &N, url: Option<Url>,
layout_context: &LayoutContext) -> ImageFragmentInfo {
shared_layout_context: &SharedLayoutContext)
-> ImageFragmentInfo {
let image_or_metadata = url.and_then(|url| {
layout_context.get_or_request_image_or_meta(url, UsePlaceholder::Yes)
shared_layout_context.get_or_request_image_or_meta(url, UsePlaceholder::Yes)
});
let (image, metadata) = match image_or_metadata {
@ -386,7 +391,7 @@ impl ImageFragmentInfo {
};
ImageFragmentInfo {
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, layout_context),
replaced_image_fragment_info: ReplacedImageFragmentInfo::new(node, &shared_layout_context.style_context),
image: image,
metadata: metadata,
}
@ -445,9 +450,9 @@ pub struct ReplacedImageFragmentInfo {
}
impl ReplacedImageFragmentInfo {
pub fn new<N>(node: &N, ctx: &LayoutContext) -> ReplacedImageFragmentInfo
pub fn new<N>(node: &N, ctx: &SharedStyleContext) -> ReplacedImageFragmentInfo
where N: ThreadSafeLayoutNode {
let is_vertical = node.style(ctx.style_context()).writing_mode.is_vertical();
let is_vertical = node.style(ctx).writing_mode.is_vertical();
ReplacedImageFragmentInfo {
computed_inline_size: None,
computed_block_size: None,