diff --git a/gfx/layers/wr/WebRenderUserData.cpp b/gfx/layers/wr/WebRenderUserData.cpp index 878e3d39e6c4..5209ee9a7f40 100644 --- a/gfx/layers/wr/WebRenderUserData.cpp +++ b/gfx/layers/wr/WebRenderUserData.cpp @@ -266,7 +266,7 @@ void WebRenderImageData::CreateAsyncImageWebRenderCommands( // where it will be done when we build the display list for the iframe. // That happens in AsyncImagePipelineManager. wr::LayoutRect r = wr::ToLayoutRect(aBounds); - aBuilder.PushIFrame(r, mPipelineId.ref(), + aBuilder.PushIFrame(r, aIsBackfaceVisible, mPipelineId.ref(), /*ignoreMissingPipelines*/ false); WrBridge()->AddWebRenderParentCommand( diff --git a/gfx/webrender_bindings/WebRenderAPI.cpp b/gfx/webrender_bindings/WebRenderAPI.cpp index 20f25149a23a..6f1a5ced5172 100644 --- a/gfx/webrender_bindings/WebRenderAPI.cpp +++ b/gfx/webrender_bindings/WebRenderAPI.cpp @@ -1315,11 +1315,12 @@ void DisplayListBuilder::PushYCbCrInterleavedImage( } void DisplayListBuilder::PushIFrame(const wr::LayoutRect& aBounds, + bool aIsBackfaceVisible, PipelineId aPipeline, bool aIgnoreMissingPipeline) { mRemotePipelineIds.AppendElement(aPipeline); wr_dp_push_iframe(mWrState, aBounds, MergeClipLeaf(aBounds), - mCurrentSpaceAndClipChain.space, aPipeline, + aIsBackfaceVisible, &mCurrentSpaceAndClipChain, aPipeline, aIgnoreMissingPipeline); } diff --git a/gfx/webrender_bindings/WebRenderAPI.h b/gfx/webrender_bindings/WebRenderAPI.h index 9aa62993d90b..b5d8b13ffa10 100644 --- a/gfx/webrender_bindings/WebRenderAPI.h +++ b/gfx/webrender_bindings/WebRenderAPI.h @@ -541,8 +541,8 @@ class DisplayListBuilder final { wr::WrColorRange aColorRange, wr::ImageRendering aFilter, bool aPreferCompositorSurface = false); - void PushIFrame(const wr::LayoutRect& aBounds, wr::PipelineId aPipeline, - bool aIgnoreMissingPipeline); + void PushIFrame(const wr::LayoutRect& aBounds, bool aIsBackfaceVisible, + wr::PipelineId aPipeline, bool aIgnoreMissingPipeline); // XXX WrBorderSides are passed with Range. // It is just to bypass compiler bug. See Bug 1357734. diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs index 2d4d5e80ef0e..5b122d2633ef 100644 --- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -2546,7 +2546,8 @@ pub extern "C" fn wr_dp_push_iframe( state: &mut WrState, rect: LayoutRect, clip: LayoutRect, - spatial_id: WrSpatialId, + _is_backface_visible: bool, + parent: &WrSpaceAndClipChain, pipeline_id: WrPipelineId, ignore_missing_pipeline: bool, ) { @@ -2555,7 +2556,7 @@ pub extern "C" fn wr_dp_push_iframe( state.frame_builder.dl_builder.push_iframe( rect, clip, - spatial_id.to_webrender(state.pipeline_id), + &parent.to_webrender(state.pipeline_id), pipeline_id, ignore_missing_pipeline, ); diff --git a/gfx/wr/examples/iframe.rs b/gfx/wr/examples/iframe.rs index ba6f18cd1ebd..aa1bec956eb6 100644 --- a/gfx/wr/examples/iframe.rs +++ b/gfx/wr/examples/iframe.rs @@ -83,13 +83,7 @@ impl Example for App { sub_bounds, ColorF::new(1.0, 0.0, 0.0, 1.0) ); - builder.push_iframe( - sub_bounds, - sub_bounds, - space_and_clip.spatial_id, - sub_pipeline_id, - false, - ); + builder.push_iframe(sub_bounds, sub_bounds, &space_and_clip, sub_pipeline_id, false); builder.pop_stacking_context(); builder.pop_reference_frame(); } diff --git a/gfx/wr/webrender/src/scene_building.rs b/gfx/wr/webrender/src/scene_building.rs index 40eff95181bb..af1a59d67aa9 100644 --- a/gfx/wr/webrender/src/scene_building.rs +++ b/gfx/wr/webrender/src/scene_building.rs @@ -952,16 +952,14 @@ impl<'a> SceneBuilder<'a> { }, }; - let space_and_clip = SpaceAndClipInfo { - spatial_id: info.spatial_id, - clip_id: ClipId::root(self.scene.root_pipeline_id.unwrap()), - }; - let current_offset = self.current_offset(spatial_node_index); - let clip_chain_index = self.add_rect_clip_node( + let clip_chain_index = self.add_clip_node( ClipId::root(iframe_pipeline_id), - &space_and_clip, - &info.clip_rect.translate(current_offset), + &info.space_and_clip, + ClipRegion::create_for_clip_node_with_local_clip( + &info.clip_rect, + ¤t_offset, + ), ); self.pipeline_clip_chain_stack.push(clip_chain_index); @@ -1378,7 +1376,7 @@ impl<'a> SceneBuilder<'a> { ); } DisplayItem::Iframe(ref info) => { - let space = self.get_space(&info.spatial_id); + let space = self.get_space(&info.space_and_clip.spatial_id); self.build_iframe( info, space, diff --git a/gfx/wr/webrender_api/src/display_item.rs b/gfx/wr/webrender_api/src/display_item.rs index b36743af89a2..b296d1d672d8 100644 --- a/gfx/wr/webrender_api/src/display_item.rs +++ b/gfx/wr/webrender_api/src/display_item.rs @@ -1136,7 +1136,7 @@ impl FilterData { pub struct IframeDisplayItem { pub bounds: LayoutRect, pub clip_rect: LayoutRect, - pub spatial_id: SpatialId, + pub space_and_clip: SpaceAndClipInfo, pub pipeline_id: PipelineId, pub ignore_missing_pipeline: bool, } diff --git a/gfx/wr/webrender_api/src/display_list.rs b/gfx/wr/webrender_api/src/display_list.rs index 3c0976416382..7f2f2d7ca407 100644 --- a/gfx/wr/webrender_api/src/display_list.rs +++ b/gfx/wr/webrender_api/src/display_list.rs @@ -1836,14 +1836,14 @@ impl DisplayListBuilder { &mut self, bounds: LayoutRect, clip_rect: LayoutRect, - spatial_id: di::SpatialId, + space_and_clip: &di::SpaceAndClipInfo, pipeline_id: PipelineId, ignore_missing_pipeline: bool ) { let item = di::DisplayItem::Iframe(di::IframeDisplayItem { bounds, clip_rect, - spatial_id, + space_and_clip: *space_and_clip, pipeline_id, ignore_missing_pipeline, }); diff --git a/gfx/wr/wrench/src/yaml_frame_reader.rs b/gfx/wr/wrench/src/yaml_frame_reader.rs index e8e2777195b0..501f57a35360 100644 --- a/gfx/wr/wrench/src/yaml_frame_reader.rs +++ b/gfx/wr/wrench/src/yaml_frame_reader.rs @@ -1624,7 +1624,10 @@ impl YamlFrameReader { dl.push_iframe( bounds, info.clip_rect, - info.spatial_id, + &SpaceAndClipInfo { + spatial_id: info.spatial_id, + clip_id: info.clip_id + }, pipeline_id, ignore ); diff --git a/layout/generic/nsHTMLCanvasFrame.cpp b/layout/generic/nsHTMLCanvasFrame.cpp index 159914866d4a..b966763acf90 100644 --- a/layout/generic/nsHTMLCanvasFrame.cpp +++ b/layout/generic/nsHTMLCanvasFrame.cpp @@ -162,7 +162,7 @@ class nsDisplayCanvas final : public nsPaintedDisplayItem { // the iframe. That happens in WebRenderCompositableHolder. wr::LayoutRect r = wr::ToLayoutRect(bounds); - aBuilder.PushIFrame(r, data->GetPipelineId().ref(), + aBuilder.PushIFrame(r, !BackfaceIsHidden(), data->GetPipelineId().ref(), /*ignoreMissingPipelines*/ false); gfx::Matrix4x4 scTransform; diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 74fa28d9d5b4..125afa657690 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -1445,7 +1445,7 @@ bool nsDisplayRemote::CreateWebRenderCommands( contentRect, mFrame->PresContext()->AppUnitsPerDevPixel()); rect += mOffset; - aBuilder.PushIFrame(mozilla::wr::ToLayoutRect(rect), + aBuilder.PushIFrame(mozilla::wr::ToLayoutRect(rect), !BackfaceIsHidden(), mozilla::wr::AsPipelineId(mLayersId), /*ignoreMissingPipelines*/ true);