author | Morris Tseng <mtseng@mozilla.com> |
Thu, 21 Sep 2017 14:41:38 +0800 | |
changeset 382161 | 525ab770ca31eaae484bbbd733d6d8524bbec718 |
parent 382160 | 757ae5e740f21d0c703233173422efd4fce7b501 |
child 382162 | 28bb2483daae9c4c7f422a34a8daaecb5f510408 |
push id | 32547 |
push user | archaeopteryx@coole-files.de |
push date | Thu, 21 Sep 2017 13:24:03 +0000 |
treeherder | mozilla-central@f7e9777221a3 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | kats |
bugs | 1392200 |
milestone | 57.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/gfx/webrender_bindings/WebRenderAPI.cpp +++ b/gfx/webrender_bindings/WebRenderAPI.cpp @@ -658,33 +658,34 @@ DisplayListBuilder::Finalize(wr::LayoutS void DisplayListBuilder::PushStackingContext(const wr::LayoutRect& aBounds, const uint64_t& aAnimationId, const float* aOpacity, const gfx::Matrix4x4* aTransform, wr::TransformStyle aTransformStyle, const gfx::Matrix4x4* aPerspective, const wr::MixBlendMode& aMixBlendMode, - const nsTArray<wr::WrFilterOp>& aFilters) + const nsTArray<wr::WrFilterOp>& aFilters, + bool aIsBackfaceVisible) { wr::LayoutTransform matrix; if (aTransform) { matrix = ToLayoutTransform(*aTransform); } const wr::LayoutTransform* maybeTransform = aTransform ? &matrix : nullptr; wr::LayoutTransform perspective; if (aPerspective) { perspective = ToLayoutTransform(*aPerspective); } const wr::LayoutTransform* maybePerspective = aPerspective ? &perspective : nullptr; WRDL_LOG("PushStackingContext b=%s t=%s\n", mWrState, Stringify(aBounds).c_str(), aTransform ? Stringify(*aTransform).c_str() : "none"); wr_dp_push_stacking_context(mWrState, aBounds, aAnimationId, aOpacity, maybeTransform, aTransformStyle, maybePerspective, - aMixBlendMode, aFilters.Elements(), aFilters.Length()); + aMixBlendMode, aFilters.Elements(), aFilters.Length(), aIsBackfaceVisible); } void DisplayListBuilder::PopStackingContext() { WRDL_LOG("PopStackingContext\n", mWrState); wr_dp_pop_stacking_context(mWrState); } @@ -795,228 +796,246 @@ DisplayListBuilder::PopClipAndScrollInfo WRDL_LOG("PopClipAndScroll\n", mWrState); mScrollIdStack.pop_back(); wr_dp_pop_clip_and_scroll_info(mWrState); } void DisplayListBuilder::PushRect(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::ColorF& aColor) { WRDL_LOG("PushRect b=%s cl=%s c=%s\n", mWrState, Stringify(aBounds).c_str(), Stringify(aClip).c_str(), Stringify(aColor).c_str()); - wr_dp_push_rect(mWrState, aBounds, aClip, aColor); + wr_dp_push_rect(mWrState, aBounds, aClip, aIsBackfaceVisible, aColor); } void DisplayListBuilder::PushLinearGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutPoint& aStartPoint, const wr::LayoutPoint& aEndPoint, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::LayoutSize aTileSize, const wr::LayoutSize aTileSpacing) { wr_dp_push_linear_gradient(mWrState, - aBounds, aClip, + aBounds, aClip, aIsBackfaceVisible, aStartPoint, aEndPoint, aStops.Elements(), aStops.Length(), aExtendMode, aTileSize, aTileSpacing); } void DisplayListBuilder::PushRadialGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutPoint& aCenter, const wr::LayoutSize& aRadius, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::LayoutSize aTileSize, const wr::LayoutSize aTileSpacing) { wr_dp_push_radial_gradient(mWrState, - aBounds, aClip, + aBounds, aClip, aIsBackfaceVisible, aCenter, aRadius, aStops.Elements(), aStops.Length(), aExtendMode, aTileSize, aTileSpacing); } void DisplayListBuilder::PushImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageRendering aFilter, wr::ImageKey aImage) { wr::LayoutSize size; size.width = aBounds.size.width; size.height = aBounds.size.height; - PushImage(aBounds, aClip, size, size, aFilter, aImage); + PushImage(aBounds, aClip, aIsBackfaceVisible, size, size, aFilter, aImage); } void DisplayListBuilder::PushImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutSize& aStretchSize, const wr::LayoutSize& aTileSpacing, wr::ImageRendering aFilter, wr::ImageKey aImage) { WRDL_LOG("PushImage b=%s cl=%s s=%s t=%s\n", mWrState, Stringify(aBounds).c_str(), Stringify(aClip).c_str(), Stringify(aStretchSize).c_str(), Stringify(aTileSpacing).c_str()); - wr_dp_push_image(mWrState, aBounds, aClip, aStretchSize, aTileSpacing, aFilter, aImage); + wr_dp_push_image(mWrState, aBounds, aClip, aIsBackfaceVisible, aStretchSize, aTileSpacing, aFilter, aImage); } void DisplayListBuilder::PushYCbCrPlanarImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageKey aImageChannel0, wr::ImageKey aImageChannel1, wr::ImageKey aImageChannel2, wr::WrYuvColorSpace aColorSpace, wr::ImageRendering aRendering) { wr_dp_push_yuv_planar_image(mWrState, aBounds, aClip, + aIsBackfaceVisible, aImageChannel0, aImageChannel1, aImageChannel2, aColorSpace, aRendering); } void DisplayListBuilder::PushNV12Image(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageKey aImageChannel0, wr::ImageKey aImageChannel1, wr::WrYuvColorSpace aColorSpace, wr::ImageRendering aRendering) { wr_dp_push_yuv_NV12_image(mWrState, aBounds, aClip, + aIsBackfaceVisible, aImageChannel0, aImageChannel1, aColorSpace, aRendering); } void DisplayListBuilder::PushYCbCrInterleavedImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageKey aImageChannel0, wr::WrYuvColorSpace aColorSpace, wr::ImageRendering aRendering) { wr_dp_push_yuv_interleaved_image(mWrState, aBounds, aClip, + aIsBackfaceVisible, aImageChannel0, aColorSpace, aRendering); } void DisplayListBuilder::PushIFrame(const wr::LayoutRect& aBounds, + bool aIsBackfaceVisible, PipelineId aPipeline) { - wr_dp_push_iframe(mWrState, aBounds, aPipeline); + wr_dp_push_iframe(mWrState, aBounds, aIsBackfaceVisible, aPipeline); } void DisplayListBuilder::PushBorder(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, const Range<const wr::BorderSide>& aSides, const wr::BorderRadius& aRadius) { MOZ_ASSERT(aSides.length() == 4); if (aSides.length() != 4) { return; } - wr_dp_push_border(mWrState, aBounds, aClip, + wr_dp_push_border(mWrState, aBounds, aClip, aIsBackfaceVisible, aWidths, aSides[0], aSides[1], aSides[2], aSides[3], aRadius); } void DisplayListBuilder::PushBorderImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, wr::ImageKey aImage, const wr::NinePatchDescriptor& aPatch, const wr::SideOffsets2D_f32& aOutset, const wr::RepeatMode& aRepeatHorizontal, const wr::RepeatMode& aRepeatVertical) { - wr_dp_push_border_image(mWrState, aBounds, aClip, + wr_dp_push_border_image(mWrState, aBounds, aClip, aIsBackfaceVisible, aWidths, aImage, aPatch, aOutset, aRepeatHorizontal, aRepeatVertical); } void DisplayListBuilder::PushBorderGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, const wr::LayoutPoint& aStartPoint, const wr::LayoutPoint& aEndPoint, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::SideOffsets2D_f32& aOutset) { - wr_dp_push_border_gradient(mWrState, aBounds, aClip, + wr_dp_push_border_gradient(mWrState, aBounds, aClip, aIsBackfaceVisible, aWidths, aStartPoint, aEndPoint, aStops.Elements(), aStops.Length(), aExtendMode, aOutset); } void DisplayListBuilder::PushBorderRadialGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, const wr::LayoutPoint& aCenter, const wr::LayoutSize& aRadius, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::SideOffsets2D_f32& aOutset) { wr_dp_push_border_radial_gradient( - mWrState, aBounds, aClip, aWidths, aCenter, + mWrState, aBounds, aClip, aIsBackfaceVisible, aWidths, aCenter, aRadius, aStops.Elements(), aStops.Length(), aExtendMode, aOutset); } void DisplayListBuilder::PushText(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const gfx::Color& aColor, wr::FontInstanceKey aFontKey, Range<const wr::GlyphInstance> aGlyphBuffer, const wr::GlyphOptions* aGlyphOptions) { - wr_dp_push_text(mWrState, aBounds, aClip, + wr_dp_push_text(mWrState, aBounds, aClip, aIsBackfaceVisible, ToColorF(aColor), aFontKey, &aGlyphBuffer[0], aGlyphBuffer.length(), aGlyphOptions); } void DisplayListBuilder::PushLine(const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::Line& aLine) { - wr_dp_push_line(mWrState, aClip, aLine.baseline, aLine.start, aLine.end, + wr_dp_push_line(mWrState, aClip, aIsBackfaceVisible, aLine.baseline, aLine.start, aLine.end, aLine.orientation, aLine.width, aLine.color, aLine.style); /* TODO(Gankro): remove this LayoutRect rect; if (aLine.orientation == wr::LineOrientation::Horizontal) { rect.origin.x = aLine.start; rect.origin.y = aLine.baseline; rect.size.width = aLine.end - aLine.start; @@ -1030,39 +1049,41 @@ DisplayListBuilder::PushLine(const wr::L PushRect(rect, aClip, aLine.color); */ } void DisplayListBuilder::PushTextShadow(const wr::LayoutRect& aRect, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::TextShadow& aShadow) { - wr_dp_push_text_shadow(mWrState, aRect, aClip, aShadow); + wr_dp_push_text_shadow(mWrState, aRect, aClip, aIsBackfaceVisible, aShadow); } void DisplayListBuilder::PopTextShadow() { wr_dp_pop_text_shadow(mWrState); } void DisplayListBuilder::PushBoxShadow(const wr::LayoutRect& aRect, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutRect& aBoxBounds, const wr::LayoutVector2D& aOffset, const wr::ColorF& aColor, const float& aBlurRadius, const float& aSpreadRadius, const float& aBorderRadius, const wr::BoxShadowClipMode& aClipMode) { - wr_dp_push_box_shadow(mWrState, aRect, aClip, + wr_dp_push_box_shadow(mWrState, aRect, aClip, aIsBackfaceVisible, aBoxBounds, aOffset, aColor, aBlurRadius, aSpreadRadius, aBorderRadius, aClipMode); } Maybe<wr::WrClipId> DisplayListBuilder::TopmostClipId() {
--- a/gfx/webrender_bindings/WebRenderAPI.h +++ b/gfx/webrender_bindings/WebRenderAPI.h @@ -214,17 +214,18 @@ public: void PushStackingContext(const wr::LayoutRect& aBounds, // TODO: We should work with strongly typed rects const uint64_t& aAnimationId, const float* aOpacity, const gfx::Matrix4x4* aTransform, wr::TransformStyle aTransformStyle, const gfx::Matrix4x4* aPerspective, const wr::MixBlendMode& aMixBlendMode, - const nsTArray<wr::WrFilterOp>& aFilters); + const nsTArray<wr::WrFilterOp>& aFilters, + bool aIsBackfaceVisible); void PopStackingContext(); wr::WrClipId DefineClip(const wr::LayoutRect& aClipRect, const nsTArray<wr::WrComplexClipRegion>* aComplex = nullptr, const wr::WrImageMask* aMask = nullptr); void PushClip(const wr::WrClipId& aClipId, bool aRecordInStack = true); void PopClip(bool aRecordInStack = true); @@ -238,127 +239,144 @@ public: void PopScrollLayer(); void PushClipAndScrollInfo(const layers::FrameMetrics::ViewID& aScrollId, const wr::WrClipId* aClipId); void PopClipAndScrollInfo(); void PushRect(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::ColorF& aColor); void PushLinearGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutPoint& aStartPoint, const wr::LayoutPoint& aEndPoint, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::LayoutSize aTileSize, const wr::LayoutSize aTileSpacing); void PushRadialGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutPoint& aCenter, const wr::LayoutSize& aRadius, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::LayoutSize aTileSize, const wr::LayoutSize aTileSpacing); void PushImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageRendering aFilter, wr::ImageKey aImage); void PushImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutSize& aStretchSize, const wr::LayoutSize& aTileSpacing, wr::ImageRendering aFilter, wr::ImageKey aImage); void PushYCbCrPlanarImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageKey aImageChannel0, wr::ImageKey aImageChannel1, wr::ImageKey aImageChannel2, wr::WrYuvColorSpace aColorSpace, wr::ImageRendering aFilter); void PushNV12Image(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageKey aImageChannel0, wr::ImageKey aImageChannel1, wr::WrYuvColorSpace aColorSpace, wr::ImageRendering aFilter); void PushYCbCrInterleavedImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, wr::ImageKey aImageChannel0, wr::WrYuvColorSpace aColorSpace, wr::ImageRendering aFilter); void PushIFrame(const wr::LayoutRect& aBounds, + bool aIsBackfaceVisible, wr::PipelineId aPipeline); // XXX WrBorderSides are passed with Range. // It is just to bypass compiler bug. See Bug 1357734. void PushBorder(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, const Range<const wr::BorderSide>& aSides, const wr::BorderRadius& aRadius); void PushBorderImage(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, wr::ImageKey aImage, const wr::NinePatchDescriptor& aPatch, const wr::SideOffsets2D_f32& aOutset, const wr::RepeatMode& aRepeatHorizontal, const wr::RepeatMode& aRepeatVertical); void PushBorderGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, const wr::LayoutPoint& aStartPoint, const wr::LayoutPoint& aEndPoint, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::SideOffsets2D_f32& aOutset); void PushBorderRadialGradient(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::BorderWidths& aWidths, const wr::LayoutPoint& aCenter, const wr::LayoutSize& aRadius, const nsTArray<wr::GradientStop>& aStops, wr::ExtendMode aExtendMode, const wr::SideOffsets2D_f32& aOutset); void PushText(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const gfx::Color& aColor, wr::FontInstanceKey aFontKey, Range<const wr::GlyphInstance> aGlyphBuffer, const wr::GlyphOptions* aGlyphOptions = nullptr); void PushLine(const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::Line& aLine); void PushTextShadow(const wr::LayoutRect& aBounds, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::TextShadow& aShadow); void PopTextShadow(); void PushBoxShadow(const wr::LayoutRect& aRect, const wr::LayoutRect& aClip, + bool aIsBackfaceVisible, const wr::LayoutRect& aBoxBounds, const wr::LayoutVector2D& aOffset, const wr::ColorF& aColor, const float& aBlurRadius, const float& aSpreadRadius, const float& aBorderRadius, const wr::BoxShadowClipMode& aClipMode);
--- a/gfx/webrender_bindings/src/bindings.rs +++ b/gfx/webrender_bindings/src/bindings.rs @@ -1109,17 +1109,18 @@ pub extern "C" fn wr_dp_push_stacking_co bounds: LayoutRect, animation_id: u64, opacity: *const f32, transform: *const LayoutTransform, transform_style: TransformStyle, perspective: *const LayoutTransform, mix_blend_mode: MixBlendMode, filters: *const WrFilterOp, - filter_count: usize) { + filter_count: usize, + is_backface_visible: bool) { debug_assert!(unsafe { !is_in_render_thread() }); let c_filters = make_slice(filters, filter_count); let mut filters : Vec<FilterOp> = c_filters.iter().map(|c_filter| { match c_filter.filter_type { WrFilterOpType::Blur => FilterOp::Blur(c_filter.argument), WrFilterOpType::Brightness => FilterOp::Brightness(c_filter.argument), WrFilterOpType::Contrast => FilterOp::Contrast(c_filter.argument), @@ -1151,17 +1152,19 @@ pub extern "C" fn wr_dp_push_stacking_co }; let perspective_ref = unsafe { perspective.as_ref() }; let perspective = match perspective_ref { Some(perspective) => Some(perspective.clone()), None => None, }; - let prim_info = LayoutPrimitiveInfo::new(bounds); + let mut prim_info = LayoutPrimitiveInfo::new(bounds); + prim_info.is_backface_visible = is_backface_visible; + state.frame_builder .dl_builder .push_stacking_context(&prim_info, webrender_api::ScrollPolicy::Scrollable, transform_binding, transform_style, perspective, mix_blend_mode, @@ -1267,169 +1270,187 @@ pub extern "C" fn wr_dp_push_clip_and_sc pub extern "C" fn wr_dp_pop_clip_and_scroll_info(state: &mut WrState) { debug_assert!(unsafe { is_in_main_thread() }); state.frame_builder.dl_builder.pop_clip_id(); } #[no_mangle] pub extern "C" fn wr_dp_push_iframe(state: &mut WrState, rect: LayoutRect, + is_backface_visible: bool, pipeline_id: WrPipelineId) { debug_assert!(unsafe { is_in_main_thread() }); - let prim_info = LayoutPrimitiveInfo::new(rect); + let mut prim_info = LayoutPrimitiveInfo::new(rect); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder.dl_builder.push_iframe(&prim_info, pipeline_id); } #[no_mangle] pub extern "C" fn wr_dp_push_rect(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, color: ColorF) { debug_assert!(unsafe { !is_in_render_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder.dl_builder.push_rect(&prim_info, color); } #[no_mangle] pub extern "C" fn wr_dp_push_image(state: &mut WrState, bounds: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, stretch_size: LayoutSize, tile_spacing: LayoutSize, image_rendering: ImageRendering, key: WrImageKey) { debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_image(&prim_info, stretch_size, tile_spacing, image_rendering, key); } /// Push a 3 planar yuv image. #[no_mangle] pub extern "C" fn wr_dp_push_yuv_planar_image(state: &mut WrState, bounds: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, image_key_0: WrImageKey, image_key_1: WrImageKey, image_key_2: WrImageKey, color_space: WrYuvColorSpace, image_rendering: ImageRendering) { debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_yuv_image(&prim_info, YuvData::PlanarYCbCr(image_key_0, image_key_1, image_key_2), color_space, image_rendering); } /// Push a 2 planar NV12 image. #[no_mangle] pub extern "C" fn wr_dp_push_yuv_NV12_image(state: &mut WrState, bounds: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, image_key_0: WrImageKey, image_key_1: WrImageKey, color_space: WrYuvColorSpace, image_rendering: ImageRendering) { debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_yuv_image(&prim_info, YuvData::NV12(image_key_0, image_key_1), color_space, image_rendering); } /// Push a yuv interleaved image. #[no_mangle] pub extern "C" fn wr_dp_push_yuv_interleaved_image(state: &mut WrState, bounds: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, image_key_0: WrImageKey, color_space: WrYuvColorSpace, image_rendering: ImageRendering) { debug_assert!(unsafe { is_in_main_thread() || is_in_compositor_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_yuv_image(&prim_info, YuvData::InterleavedYCbCr(image_key_0), color_space, image_rendering); } #[no_mangle] pub extern "C" fn wr_dp_push_text(state: &mut WrState, bounds: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, color: ColorF, font_key: WrFontInstanceKey, glyphs: *const GlyphInstance, glyph_count: u32, glyph_options: *const GlyphOptions) { debug_assert!(unsafe { is_in_main_thread() }); let glyph_slice = make_slice(glyphs, glyph_count as usize); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_text(&prim_info, &glyph_slice, font_key, color, unsafe { glyph_options.as_ref().cloned() }); } #[no_mangle] pub extern "C" fn wr_dp_push_text_shadow(state: &mut WrState, bounds: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, shadow: TextShadow) { debug_assert!(unsafe { is_in_main_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(bounds, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder.dl_builder.push_text_shadow(&prim_info, shadow.into()); } #[no_mangle] pub extern "C" fn wr_dp_pop_text_shadow(state: &mut WrState) { debug_assert!(unsafe { is_in_main_thread() }); state.frame_builder.dl_builder.pop_text_shadow(); } #[no_mangle] pub extern "C" fn wr_dp_push_line(state: &mut WrState, clip: LayoutRect, + is_backface_visible: bool, baseline: f32, start: f32, end: f32, orientation: LineOrientation, width: f32, color: ColorF, style: LineStyle) { debug_assert!(unsafe { is_in_main_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(LayoutRect::zero(), clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(LayoutRect::zero(), clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_line(&prim_info, baseline, start, end, orientation, width, @@ -1437,71 +1458,76 @@ pub extern "C" fn wr_dp_push_line(state: style); } #[no_mangle] pub extern "C" fn wr_dp_push_border(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, widths: BorderWidths, top: BorderSide, right: BorderSide, bottom: BorderSide, left: BorderSide, radius: BorderRadius) { debug_assert!(unsafe { is_in_main_thread() }); let border_details = BorderDetails::Normal(NormalBorder { left: left.into(), right: right.into(), top: top.into(), bottom: bottom.into(), radius: radius.into(), }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_border(&prim_info, widths, border_details); } #[no_mangle] pub extern "C" fn wr_dp_push_border_image(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, widths: BorderWidths, image: WrImageKey, patch: NinePatchDescriptor, outset: SideOffsets2D<f32>, repeat_horizontal: RepeatMode, repeat_vertical: RepeatMode) { debug_assert!(unsafe { is_in_main_thread() }); let border_details = BorderDetails::Image(ImageBorder { image_key: image, patch: patch.into(), fill: false, outset: outset.into(), repeat_horizontal: repeat_horizontal.into(), repeat_vertical: repeat_vertical.into(), }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_border(&prim_info, widths.into(), border_details); } #[no_mangle] pub extern "C" fn wr_dp_push_border_gradient(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, widths: BorderWidths, start_point: LayoutPoint, end_point: LayoutPoint, stops: *const GradientStop, stops_count: usize, extend_mode: ExtendMode, outset: SideOffsets2D<f32>) { debug_assert!(unsafe { is_in_main_thread() }); @@ -1514,28 +1540,30 @@ pub extern "C" fn wr_dp_push_border_grad state.frame_builder .dl_builder .create_gradient(start_point.into(), end_point.into(), stops_vector, extend_mode.into()), outset: outset.into(), }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_border(&prim_info, widths.into(), border_details); } #[no_mangle] pub extern "C" fn wr_dp_push_border_radial_gradient(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, widths: BorderWidths, center: LayoutPoint, radius: LayoutSize, stops: *const GradientStop, stops_count: usize, extend_mode: ExtendMode, outset: SideOffsets2D<f32>) { debug_assert!(unsafe { is_in_main_thread() }); @@ -1549,28 +1577,30 @@ pub extern "C" fn wr_dp_push_border_radi state.frame_builder .dl_builder .create_radial_gradient(center.into(), radius.into(), stops_vector, extend_mode.into()), outset: outset.into(), }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_border(&prim_info, widths.into(), border_details); } #[no_mangle] pub extern "C" fn wr_dp_push_linear_gradient(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, start_point: LayoutPoint, end_point: LayoutPoint, stops: *const GradientStop, stops_count: usize, extend_mode: ExtendMode, tile_size: LayoutSize, tile_spacing: LayoutSize) { debug_assert!(unsafe { is_in_main_thread() }); @@ -1579,29 +1609,31 @@ pub extern "C" fn wr_dp_push_linear_grad let stops_vector = stops_slice.to_owned(); let gradient = state.frame_builder .dl_builder .create_gradient(start_point.into(), end_point.into(), stops_vector, extend_mode.into()); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_gradient(&prim_info, gradient, tile_size.into(), tile_spacing.into()); } #[no_mangle] pub extern "C" fn wr_dp_push_radial_gradient(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, center: LayoutPoint, radius: LayoutSize, stops: *const GradientStop, stops_count: usize, extend_mode: ExtendMode, tile_size: LayoutSize, tile_spacing: LayoutSize) { debug_assert!(unsafe { is_in_main_thread() }); @@ -1610,39 +1642,42 @@ pub extern "C" fn wr_dp_push_radial_grad let stops_vector = stops_slice.to_owned(); let gradient = state.frame_builder .dl_builder .create_radial_gradient(center.into(), radius.into(), stops_vector, extend_mode.into()); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_radial_gradient(&prim_info, gradient, tile_size, tile_spacing); } #[no_mangle] pub extern "C" fn wr_dp_push_box_shadow(state: &mut WrState, rect: LayoutRect, clip: LayoutRect, + is_backface_visible: bool, box_bounds: LayoutRect, offset: LayoutVector2D, color: ColorF, blur_radius: f32, spread_radius: f32, border_radius: f32, clip_mode: BoxShadowClipMode) { debug_assert!(unsafe { is_in_main_thread() }); - let prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + let mut prim_info = LayoutPrimitiveInfo::with_clip_rect(rect, clip.into()); + prim_info.is_backface_visible = is_backface_visible; state.frame_builder .dl_builder .push_box_shadow(&prim_info, box_bounds, offset, color, blur_radius, spread_radius,
--- a/gfx/webrender_bindings/webrender_ffi_generated.h +++ b/gfx/webrender_bindings/webrender_ffi_generated.h @@ -881,66 +881,71 @@ WR_FUNC; WR_INLINE void wr_dp_pop_text_shadow(WrState *aState) WR_FUNC; WR_INLINE void wr_dp_push_border(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, BorderWidths aWidths, BorderSide aTop, BorderSide aRight, BorderSide aBottom, BorderSide aLeft, BorderRadius aRadius) WR_FUNC; WR_INLINE void wr_dp_push_border_gradient(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, BorderWidths aWidths, LayoutPoint aStartPoint, LayoutPoint aEndPoint, const GradientStop *aStops, size_t aStopsCount, ExtendMode aExtendMode, SideOffsets2D_f32 aOutset) WR_FUNC; WR_INLINE void wr_dp_push_border_image(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, BorderWidths aWidths, WrImageKey aImage, NinePatchDescriptor aPatch, SideOffsets2D_f32 aOutset, RepeatMode aRepeatHorizontal, RepeatMode aRepeatVertical) WR_FUNC; WR_INLINE void wr_dp_push_border_radial_gradient(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, BorderWidths aWidths, LayoutPoint aCenter, LayoutSize aRadius, const GradientStop *aStops, size_t aStopsCount, ExtendMode aExtendMode, SideOffsets2D_f32 aOutset) WR_FUNC; WR_INLINE void wr_dp_push_box_shadow(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, LayoutRect aBoxBounds, LayoutVector2D aOffset, ColorF aColor, float aBlurRadius, float aSpreadRadius, float aBorderRadius, BoxShadowClipMode aClipMode) WR_FUNC; @@ -960,71 +965,77 @@ WR_INLINE void wr_dp_push_clip_and_scroll_info(WrState *aState, uint64_t aScrollId, const uint64_t *aClipId) WR_FUNC; WR_INLINE void wr_dp_push_iframe(WrState *aState, LayoutRect aRect, + bool aIsBackfaceVisible, WrPipelineId aPipelineId) WR_FUNC; WR_INLINE void wr_dp_push_image(WrState *aState, LayoutRect aBounds, LayoutRect aClip, + bool aIsBackfaceVisible, LayoutSize aStretchSize, LayoutSize aTileSpacing, ImageRendering aImageRendering, WrImageKey aKey) WR_FUNC; WR_INLINE void wr_dp_push_line(WrState *aState, LayoutRect aClip, + bool aIsBackfaceVisible, float aBaseline, float aStart, float aEnd, LineOrientation aOrientation, float aWidth, ColorF aColor, LineStyle aStyle) WR_FUNC; WR_INLINE void wr_dp_push_linear_gradient(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, LayoutPoint aStartPoint, LayoutPoint aEndPoint, const GradientStop *aStops, size_t aStopsCount, ExtendMode aExtendMode, LayoutSize aTileSize, LayoutSize aTileSpacing) WR_FUNC; WR_INLINE void wr_dp_push_radial_gradient(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, LayoutPoint aCenter, LayoutSize aRadius, const GradientStop *aStops, size_t aStopsCount, ExtendMode aExtendMode, LayoutSize aTileSize, LayoutSize aTileSpacing) WR_FUNC; WR_INLINE void wr_dp_push_rect(WrState *aState, LayoutRect aRect, LayoutRect aClip, + bool aIsBackfaceVisible, ColorF aColor) WR_FUNC; WR_INLINE void wr_dp_push_scroll_layer(WrState *aState, uint64_t aScrollId) WR_FUNC; @@ -1033,63 +1044,69 @@ void wr_dp_push_stacking_context(WrState LayoutRect aBounds, uint64_t aAnimationId, const float *aOpacity, const LayoutTransform *aTransform, TransformStyle aTransformStyle, const LayoutTransform *aPerspective, MixBlendMode aMixBlendMode, const WrFilterOp *aFilters, - size_t aFilterCount) + size_t aFilterCount, + bool aIsBackfaceVisible) WR_FUNC; WR_INLINE void wr_dp_push_text(WrState *aState, LayoutRect aBounds, LayoutRect aClip, + bool aIsBackfaceVisible, ColorF aColor, WrFontInstanceKey aFontKey, const GlyphInstance *aGlyphs, uint32_t aGlyphCount, const GlyphOptions *aGlyphOptions) WR_FUNC; WR_INLINE void wr_dp_push_text_shadow(WrState *aState, LayoutRect aBounds, LayoutRect aClip, + bool aIsBackfaceVisible, TextShadow aShadow) WR_FUNC; // Push a 2 planar NV12 image. WR_INLINE void wr_dp_push_yuv_NV12_image(WrState *aState, LayoutRect aBounds, LayoutRect aClip, + bool aIsBackfaceVisible, WrImageKey aImageKey0, WrImageKey aImageKey1, WrYuvColorSpace aColorSpace, ImageRendering aImageRendering) WR_FUNC; // Push a yuv interleaved image. WR_INLINE void wr_dp_push_yuv_interleaved_image(WrState *aState, LayoutRect aBounds, LayoutRect aClip, + bool aIsBackfaceVisible, WrImageKey aImageKey0, WrYuvColorSpace aColorSpace, ImageRendering aImageRendering) WR_FUNC; // Push a 3 planar yuv image. WR_INLINE void wr_dp_push_yuv_planar_image(WrState *aState, LayoutRect aBounds, LayoutRect aClip, + bool aIsBackfaceVisible, WrImageKey aImageKey0, WrImageKey aImageKey1, WrImageKey aImageKey2, WrYuvColorSpace aColorSpace, ImageRendering aImageRendering) WR_FUNC; extern bool wr_moz2d_render_cb(ByteSlice aBlob,