Pass SharedLayoutContext to DisplayListBuildState::new.

This commit is contained in:
Ms2ger 2016-08-23 18:04:33 +02:00
parent 938569e3c7
commit 05e9a9ac86
2 changed files with 7 additions and 7 deletions

View file

@ -14,7 +14,7 @@ use app_units::{Au, AU_PER_PX};
use azure::azure_hl::Color; use azure::azure_hl::Color;
use block::{BlockFlow, BlockStackingContextType}; use block::{BlockFlow, BlockStackingContextType};
use canvas_traits::{CanvasMsg, CanvasData, FromLayoutMsg}; use canvas_traits::{CanvasMsg, CanvasData, FromLayoutMsg};
use context::LayoutContext; use context::SharedLayoutContext;
use euclid::{Matrix4D, Point2D, Point3D, Radians, Rect, SideOffsets2D, Size2D}; use euclid::{Matrix4D, Point2D, Point3D, Radians, Rect, SideOffsets2D, Size2D};
use flex::FlexFlow; use flex::FlexFlow;
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED}; use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
@ -65,16 +65,17 @@ fn get_cyclic<T>(arr: &[T], index: usize) -> &T {
} }
pub struct DisplayListBuildState<'a> { pub struct DisplayListBuildState<'a> {
pub layout_context: &'a LayoutContext<'a>, pub shared_layout_context: &'a SharedLayoutContext,
pub items: Vec<DisplayItem>, pub items: Vec<DisplayItem>,
pub stacking_context_id_stack: Vec<StackingContextId>, pub stacking_context_id_stack: Vec<StackingContextId>,
} }
impl<'a> DisplayListBuildState<'a> { impl<'a> DisplayListBuildState<'a> {
pub fn new(layout_context: &'a LayoutContext, stacking_context_id: StackingContextId) pub fn new(shared_layout_context: &'a SharedLayoutContext,
stacking_context_id: StackingContextId)
-> DisplayListBuildState<'a> { -> DisplayListBuildState<'a> {
DisplayListBuildState { DisplayListBuildState {
layout_context: layout_context, shared_layout_context: shared_layout_context,
items: Vec::new(), items: Vec::new(),
stacking_context_id_stack: vec!(stacking_context_id), stacking_context_id_stack: vec!(stacking_context_id),
} }
@ -491,8 +492,7 @@ impl FragmentDisplayListBuilding for Fragment {
index: usize) { index: usize) {
let background = style.get_background(); let background = style.get_background();
let fetch_image_data_as_well = !opts::get().use_webrender; let fetch_image_data_as_well = !opts::get().use_webrender;
let webrender_image = state.layout_context let webrender_image = state.shared_layout_context
.shared
.get_webrender_image_for_url(image_url, .get_webrender_image_for_url(image_url,
UsePlaceholder::No, UsePlaceholder::No,
fetch_image_data_as_well); fetch_image_data_as_well);

View file

@ -89,7 +89,7 @@ pub fn build_display_list_for_subtree(root: &mut FlowRef,
&mut children); &mut children);
root_stacking_context.add_children(children); root_stacking_context.add_children(children);
let mut build_display_list = BuildDisplayList { let mut build_display_list = BuildDisplayList {
state: DisplayListBuildState::new(&layout_context, state: DisplayListBuildState::new(&layout_context.shared,
flow::base(&*flow_root).stacking_context_id), flow::base(&*flow_root).stacking_context_id),
}; };
build_display_list.traverse(&mut *flow_root); build_display_list.traverse(&mut *flow_root);