Skip to content
Permalink
Browse files

WR update: layout

  • Loading branch information...
paulrouget committed Mar 7, 2019
1 parent 6fd9915 commit 47b522f0e037ecb54c2ffed989af72672219d272
Showing with 17 additions and 8 deletions.
  1. +1 −0 components/layout/display_list/builder.rs
  2. +16 −8 components/layout/display_list/webrender_helpers.rs
@@ -2012,6 +2012,7 @@ impl Fragment {
offset: LayoutVector2D::new(shadow.horizontal.px(), shadow.vertical.px()),
color: self.style.resolve_color(shadow.color).to_layout(),
blur_radius: shadow.blur.px(),
should_inflate: true,
},
},
)));
@@ -10,8 +10,10 @@
use crate::display_list::items::{ClipScrollNode, ClipScrollNodeType};
use crate::display_list::items::{DisplayItem, DisplayList, StackingContextType};
use msg::constellation_msg::PipelineId;
use webrender_api::{self, ClipId, DisplayListBuilder, RasterSpace, SpaceAndClipInfo, SpatialId};
use webrender_api::{LayoutPoint, SpecificDisplayItem};
use webrender_api::{
self, ClipId, DisplayListBuilder, RasterSpace, ReferenceFrameKind, SpaceAndClipInfo, SpatialId,
};
use webrender_api::{LayoutPoint, PropertyBinding, SpecificDisplayItem};

pub trait WebRenderDisplayListConverter {
fn convert_to_webrender(&self, pipeline_id: PipelineId) -> DisplayListBuilder;
@@ -204,17 +206,20 @@ impl WebRenderDisplayItemConverter for DisplayItem {
let mut info = webrender_api::LayoutPrimitiveInfo::new(stacking_context.bounds);
let spatial_id =
if let Some(frame_index) = stacking_context.established_reference_frame {
debug_assert!(
stacking_context.transform.is_some() ||
stacking_context.perspective.is_some()
);
let transform =
match (stacking_context.transform, stacking_context.perspective) {
(None, Some(p)) => p,
(Some(t), None) => t,
(Some(t), Some(p)) => t.pre_mul(&p),
(None, None) => unreachable!(),
};

let spatial_id = builder.push_reference_frame(
&stacking_context.bounds,
state.active_spatial_id,
stacking_context.transform_style,
stacking_context.transform.map(Into::into),
stacking_context.perspective,
PropertyBinding::Value(transform),
ReferenceFrameKind::Transform,
);
state.spatial_ids[frame_index.to_index()] = Some(spatial_id);
state.clip_ids[frame_index.to_index()] = Some(cur_clip_id);
@@ -233,7 +238,9 @@ impl WebRenderDisplayItemConverter for DisplayItem {
stacking_context.transform_style,
stacking_context.mix_blend_mode,
&stacking_context.filters,
&[],
RasterSpace::Screen,
/* cache_tiles = */ false,
);
},
DisplayItem::PopStackingContext(_) => builder.pop_stacking_context(),
@@ -273,6 +280,7 @@ impl WebRenderDisplayItemConverter for DisplayItem {
node.clip.complex.clone(),
None,
scroll_sensitivity,
webrender_api::LayoutVector2D::zero(),
);

state.clip_ids[item.node_index.to_index()] = Some(space_clip_info.clip_id);

0 comments on commit 47b522f

Please sign in to comment.
You can’t perform that action at this time.