WR update: APIs update

This commit is contained in:
Paul Rouget 2019-03-18 20:31:43 +08:00
parent ecc11826d2
commit a20455fd6b
6 changed files with 43 additions and 20 deletions

View file

@ -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,18 +206,32 @@ 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, ref_frame) =
match (stacking_context.transform, stacking_context.perspective) {
(None, Some(p)) => (
p,
ReferenceFrameKind::Perspective {
scrolling_relative_to: None,
},
),
(Some(t), None) => (t, ReferenceFrameKind::Transform),
(Some(t), Some(p)) => (
t.pre_mul(&p),
ReferenceFrameKind::Perspective {
scrolling_relative_to: None,
},
),
(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),
ref_frame,
);
state.spatial_ids[frame_index.to_index()] = Some(spatial_id);
state.clip_ids[frame_index.to_index()] = Some(cur_clip_id);
@ -233,7 +249,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 +291,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);