mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1522017 - Introduce StackingContextParams to avoid death by a thousand argument. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D17434
This commit is contained in:
parent
85743771de
commit
9d28f0c412
@ -399,12 +399,14 @@ void AsyncImagePipelineManager::ApplyAsyncImageForPipeline(
|
||||
wr::DisplayListBuilder builder(aPipelineId, contentSize);
|
||||
|
||||
float opacity = 1.0f;
|
||||
wr::StackingContextParams params;
|
||||
params.opacity = &opacity;
|
||||
params.mTransformPtr =
|
||||
aPipeline->mScTransform.IsIdentity() ? nullptr : &aPipeline->mScTransform;
|
||||
params.mix_blend_mode = aPipeline->mMixBlendMode;
|
||||
|
||||
Maybe<wr::WrSpatialId> referenceFrameId = builder.PushStackingContext(
|
||||
wr::ToRoundedLayoutRect(aPipeline->mScBounds),
|
||||
wr::WrStackingContextClip::None(), nullptr, &opacity,
|
||||
aPipeline->mScTransform.IsIdentity() ? nullptr : &aPipeline->mScTransform,
|
||||
wr::TransformStyle::Flat, wr::ReferenceFrameKind::Transform,
|
||||
aPipeline->mMixBlendMode, nsTArray<wr::FilterOp>(), true,
|
||||
params, wr::ToRoundedLayoutRect(aPipeline->mScBounds),
|
||||
// This is fine to do unconditionally because we only push images here.
|
||||
wr::RasterSpace::Screen());
|
||||
|
||||
|
@ -24,25 +24,19 @@ StackingContextHelper::StackingContextHelper()
|
||||
StackingContextHelper::StackingContextHelper(
|
||||
const StackingContextHelper& aParentSC, const ActiveScrolledRoot* aAsr,
|
||||
nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
||||
wr::DisplayListBuilder& aBuilder, const nsTArray<wr::FilterOp>& aFilters,
|
||||
const LayoutDeviceRect& aBounds, const gfx::Matrix4x4* aBoundTransform,
|
||||
const wr::WrAnimationProperty* aAnimation, const float* aOpacityPtr,
|
||||
const gfx::Matrix4x4* aTransformPtr,
|
||||
wr::ReferenceFrameKind aReferenceFrameKind,
|
||||
const gfx::CompositionOp& aMixBlendMode, bool aBackfaceVisible,
|
||||
bool aIsPreserve3D,
|
||||
const Maybe<nsDisplayTransform*>& aDeferredTransformItem,
|
||||
const wr::WrStackingContextClip& aClip, bool aAnimated)
|
||||
wr::DisplayListBuilder& aBuilder, const wr::StackingContextParams& aParams,
|
||||
const LayoutDeviceRect& aBounds)
|
||||
: mBuilder(&aBuilder),
|
||||
mScale(1.0f, 1.0f),
|
||||
mDeferredTransformItem(aDeferredTransformItem),
|
||||
mIsPreserve3D(aIsPreserve3D),
|
||||
mRasterizeLocally(aAnimated || aParentSC.mRasterizeLocally) {
|
||||
mDeferredTransformItem(aParams.mDeferredTransformItem),
|
||||
mIsPreserve3D(aParams.transform_style == wr::TransformStyle::Preserve3D),
|
||||
mRasterizeLocally(aParams.mAnimated || aParentSC.mRasterizeLocally) {
|
||||
// Compute scale for fallback rendering. We don't try to guess a scale for 3d
|
||||
// transformed items
|
||||
gfx::Matrix transform2d;
|
||||
if (aBoundTransform && aBoundTransform->CanDraw2D(&transform2d) &&
|
||||
aReferenceFrameKind != wr::ReferenceFrameKind::Perspective &&
|
||||
if (aParams.mBoundTransform &&
|
||||
aParams.mBoundTransform->CanDraw2D(&transform2d) &&
|
||||
aParams.reference_frame_kind != wr::ReferenceFrameKind::Perspective &&
|
||||
!aParentSC.mIsPreserve3D) {
|
||||
mInheritedTransform = transform2d * aParentSC.mInheritedTransform;
|
||||
|
||||
@ -52,7 +46,7 @@ StackingContextHelper::StackingContextHelper(
|
||||
1.f, 1.f, mInheritedTransform,
|
||||
/* aCanDraw2D = */ true);
|
||||
|
||||
if (aAnimated) {
|
||||
if (aParams.mAnimated) {
|
||||
mSnappingSurfaceTransform =
|
||||
gfx::Matrix::Scaling(mScale.width, mScale.height);
|
||||
} else {
|
||||
@ -70,10 +64,7 @@ StackingContextHelper::StackingContextHelper(
|
||||
: wr::RasterSpace::Screen();
|
||||
|
||||
mReferenceFrameId = mBuilder->PushStackingContext(
|
||||
wr::ToLayoutRect(aBounds), aClip, aAnimation, aOpacityPtr, aTransformPtr,
|
||||
aIsPreserve3D ? wr::TransformStyle::Preserve3D : wr::TransformStyle::Flat,
|
||||
aReferenceFrameKind, wr::ToMixBlendMode(aMixBlendMode), aFilters,
|
||||
aBackfaceVisible, rasterSpace);
|
||||
aParams, wr::ToLayoutRect(aBounds), rasterSpace);
|
||||
|
||||
if (mReferenceFrameId) {
|
||||
mSpaceAndClipChainHelper.emplace(aBuilder, mReferenceFrameId.ref());
|
||||
|
@ -31,18 +31,9 @@ class MOZ_RAII StackingContextHelper {
|
||||
const StackingContextHelper& aParentSC, const ActiveScrolledRoot* aAsr,
|
||||
nsIFrame* aContainerFrame, nsDisplayItem* aContainerItem,
|
||||
wr::DisplayListBuilder& aBuilder,
|
||||
const nsTArray<wr::FilterOp>& aFilters = nsTArray<wr::FilterOp>(),
|
||||
const LayoutDeviceRect& aBounds = LayoutDeviceRect(),
|
||||
const gfx::Matrix4x4* aBoundTransform = nullptr,
|
||||
const wr::WrAnimationProperty* aAnimation = nullptr,
|
||||
const float* aOpacityPtr = nullptr,
|
||||
const gfx::Matrix4x4* aTransformPtr = nullptr,
|
||||
const wr::ReferenceFrameKind = wr::ReferenceFrameKind::Transform,
|
||||
const gfx::CompositionOp& aMixBlendMode = gfx::CompositionOp::OP_OVER,
|
||||
bool aBackfaceVisible = true, bool aIsPreserve3D = false,
|
||||
const Maybe<nsDisplayTransform*>& aDeferredTransformItem = Nothing(),
|
||||
const wr::WrStackingContextClip& = wr::WrStackingContextClip::None(),
|
||||
bool aAnimated = false);
|
||||
const wr::StackingContextParams& aParams = wr::StackingContextParams(),
|
||||
const LayoutDeviceRect& aBounds = LayoutDeviceRect());
|
||||
|
||||
// This version of the constructor should only be used at the root level
|
||||
// of the tree, so that we have a StackingContextHelper to pass down into
|
||||
// the RenderLayer traversal, but don't actually want it to push a stacking
|
||||
|
@ -1433,7 +1433,7 @@ void WebRenderCommandBuilder::BuildWebRenderCommands(
|
||||
wr::DisplayListBuilder& aBuilder,
|
||||
wr::IpcResourceUpdateQueue& aResourceUpdates, nsDisplayList* aDisplayList,
|
||||
nsDisplayListBuilder* aDisplayListBuilder, WebRenderScrollData& aScrollData,
|
||||
wr::LayoutSize& aContentSize, const nsTArray<wr::FilterOp>& aFilters) {
|
||||
wr::LayoutSize& aContentSize, nsTArray<wr::FilterOp>&& aFilters) {
|
||||
StackingContextHelper sc;
|
||||
aScrollData = WebRenderScrollData(mManager);
|
||||
MOZ_ASSERT(mLayerScrollData.empty());
|
||||
@ -1451,9 +1451,11 @@ void WebRenderCommandBuilder::BuildWebRenderCommands(
|
||||
mZoomProp->id = AnimationHelper::GetNextCompositorAnimationsId();
|
||||
}
|
||||
|
||||
wr::StackingContextParams params;
|
||||
params.mFilters = std::move(aFilters);
|
||||
params.animation = mZoomProp.ptrOr(nullptr);
|
||||
StackingContextHelper pageRootSc(sc, nullptr, nullptr, nullptr, aBuilder,
|
||||
aFilters, LayoutDeviceRect(), nullptr,
|
||||
mZoomProp.ptrOr(nullptr));
|
||||
params);
|
||||
if (ShouldDumpDisplayList(aDisplayListBuilder)) {
|
||||
mBuilderDumpIndex =
|
||||
aBuilder.Dump(mDumpIndent + 1, Some(mBuilderDumpIndex), Nothing());
|
||||
|
@ -57,7 +57,7 @@ class WebRenderCommandBuilder {
|
||||
nsDisplayListBuilder* aDisplayListBuilder,
|
||||
WebRenderScrollData& aScrollData,
|
||||
wr::LayoutSize& aContentSize,
|
||||
const nsTArray<wr::FilterOp>& aFilters);
|
||||
nsTArray<wr::FilterOp>&& aFilters);
|
||||
|
||||
void PushOverrideForASR(const ActiveScrolledRoot* aASR,
|
||||
const wr::WrSpatialId& aSpatialId);
|
||||
|
@ -246,8 +246,7 @@ void WebRenderLayerManager::EndTransaction(DrawPaintedLayerCallback aCallback,
|
||||
|
||||
void WebRenderLayerManager::EndTransactionWithoutLayer(
|
||||
nsDisplayList* aDisplayList, nsDisplayListBuilder* aDisplayListBuilder,
|
||||
const nsTArray<wr::FilterOp>& aFilters,
|
||||
WebRenderBackgroundData* aBackground) {
|
||||
nsTArray<wr::FilterOp>&& aFilters, WebRenderBackgroundData* aBackground) {
|
||||
AUTO_PROFILER_TRACING("Paint", "RenderLayers", GRAPHICS);
|
||||
|
||||
// Since we don't do repeat transactions right now, just set the time
|
||||
@ -276,7 +275,7 @@ void WebRenderLayerManager::EndTransactionWithoutLayer(
|
||||
|
||||
mWebRenderCommandBuilder.BuildWebRenderCommands(
|
||||
builder, resourceUpdates, aDisplayList, aDisplayListBuilder,
|
||||
mScrollData, contentSize, aFilters);
|
||||
mScrollData, contentSize, std::move(aFilters));
|
||||
builderDumpIndex = mWebRenderCommandBuilder.GetBuilderDumpIndex();
|
||||
containsSVGGroup = mWebRenderCommandBuilder.GetContainsSVGGroup();
|
||||
} else {
|
||||
|
@ -79,7 +79,7 @@ class WebRenderLayerManager final : public LayerManager {
|
||||
EndTransactionFlags aFlags = END_DEFAULT) override;
|
||||
void EndTransactionWithoutLayer(
|
||||
nsDisplayList* aDisplayList, nsDisplayListBuilder* aDisplayListBuilder,
|
||||
const nsTArray<wr::FilterOp>& aFilters = nsTArray<wr::FilterOp>(),
|
||||
nsTArray<wr::FilterOp>&& aFilters = nsTArray<wr::FilterOp>(),
|
||||
WebRenderBackgroundData* aBackground = nullptr);
|
||||
virtual void EndTransaction(
|
||||
DrawPaintedLayerCallback aCallback, void* aCallbackData,
|
||||
|
@ -673,29 +673,24 @@ void DisplayListBuilder::Finalize(wr::LayoutSize& aOutContentSize,
|
||||
}
|
||||
|
||||
Maybe<wr::WrSpatialId> DisplayListBuilder::PushStackingContext(
|
||||
const wr::LayoutRect& aBounds, const wr::WrStackingContextClip& aClip,
|
||||
const WrAnimationProperty* aAnimation, const float* aOpacity,
|
||||
const gfx::Matrix4x4* aTransform, wr::TransformStyle aTransformStyle,
|
||||
const wr::ReferenceFrameKind aReferenceFrameKind,
|
||||
const wr::MixBlendMode& aMixBlendMode,
|
||||
const nsTArray<wr::FilterOp>& aFilters, bool aIsBackfaceVisible,
|
||||
const wr::StackingContextParams& aParams, const wr::LayoutRect& aBounds,
|
||||
const wr::RasterSpace& aRasterSpace) {
|
||||
MOZ_ASSERT(mClipChainLeaf.isNothing(),
|
||||
"Non-empty leaf from clip chain given, but not used with SC!");
|
||||
|
||||
wr::LayoutTransform matrix;
|
||||
if (aTransform) {
|
||||
matrix = ToLayoutTransform(*aTransform);
|
||||
const gfx::Matrix4x4* transform = aParams.mTransformPtr;
|
||||
if (transform) {
|
||||
matrix = ToLayoutTransform(*transform);
|
||||
}
|
||||
const wr::LayoutTransform* maybeTransform = aTransform ? &matrix : nullptr;
|
||||
const wr::LayoutTransform* maybeTransform = transform ? &matrix : nullptr;
|
||||
WRDL_LOG("PushStackingContext b=%s t=%s\n", mWrState,
|
||||
Stringify(aBounds).c_str(),
|
||||
aTransform ? Stringify(*aTransform).c_str() : "none");
|
||||
transform ? Stringify(*transform).c_str() : "none");
|
||||
|
||||
auto spatialId = wr_dp_push_stacking_context(
|
||||
mWrState, aBounds, mCurrentSpaceAndClipChain.space, &aClip, aAnimation,
|
||||
aOpacity, maybeTransform, aTransformStyle, aReferenceFrameKind,
|
||||
aMixBlendMode, aFilters.Elements(), aFilters.Length(), aIsBackfaceVisible,
|
||||
mWrState, aBounds, mCurrentSpaceAndClipChain.space, &aParams,
|
||||
maybeTransform, aParams.mFilters.Elements(), aParams.mFilters.Length(),
|
||||
aRasterSpace);
|
||||
|
||||
return spatialId.id != 0 ? Some(spatialId) : Nothing();
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "Units.h"
|
||||
|
||||
class nsDisplayItem;
|
||||
class nsDisplayTransform;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
@ -307,6 +308,32 @@ class MOZ_RAII AutoTransactionSender {
|
||||
TransactionBuilder* mTxn;
|
||||
};
|
||||
|
||||
/**
|
||||
* A set of optional parameters for stacking context creation.
|
||||
*/
|
||||
struct MOZ_STACK_CLASS StackingContextParams : public WrStackingContextParams {
|
||||
StackingContextParams()
|
||||
: WrStackingContextParams{WrStackingContextClip::None(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
wr::TransformStyle::Flat,
|
||||
wr::ReferenceFrameKind::Transform,
|
||||
/* is_backface_visible = */ true,
|
||||
wr::MixBlendMode::Normal} {}
|
||||
|
||||
void SetPreserve3D(bool aPreserve) {
|
||||
transform_style =
|
||||
aPreserve ? wr::TransformStyle::Preserve3D : wr::TransformStyle::Flat;
|
||||
}
|
||||
|
||||
nsTArray<wr::FilterOp> mFilters;
|
||||
wr::LayoutRect mBounds = wr::ToLayoutRect(LayoutDeviceRect());
|
||||
const gfx::Matrix4x4* mBoundTransform = nullptr;
|
||||
const gfx::Matrix4x4* mTransformPtr = nullptr;
|
||||
Maybe<nsDisplayTransform*> mDeferredTransformItem;
|
||||
bool mAnimated = false;
|
||||
};
|
||||
|
||||
/// This is a simple C++ wrapper around WrState defined in the rust bindings.
|
||||
/// We may want to turn this into a direct wrapper on top of
|
||||
/// WebRenderFrameBuilder instead, so the interface may change a bit.
|
||||
@ -329,12 +356,7 @@ class DisplayListBuilder {
|
||||
wr::BuiltDisplayList& aOutDisplayList);
|
||||
|
||||
Maybe<wr::WrSpatialId> PushStackingContext(
|
||||
// TODO: We should work with strongly typed rects
|
||||
const wr::LayoutRect& aBounds, const wr::WrStackingContextClip& aClip,
|
||||
const wr::WrAnimationProperty* aAnimation, const float* aOpacity,
|
||||
const gfx::Matrix4x4* aTransform, wr::TransformStyle aTransformStyle,
|
||||
const wr::ReferenceFrameKind, const wr::MixBlendMode& aMixBlendMode,
|
||||
const nsTArray<wr::FilterOp>& aFilters, bool aIsBackfaceVisible,
|
||||
const StackingContextParams& aParams, const wr::LayoutRect& aBounds,
|
||||
const wr::RasterSpace& aRasterSpace);
|
||||
void PopStackingContext(bool aIsReferenceFrame);
|
||||
|
||||
|
@ -1895,21 +1895,28 @@ pub extern "C" fn wr_dp_clear_save(state: &mut WrState) {
|
||||
state.frame_builder.dl_builder.clear_save();
|
||||
}
|
||||
|
||||
/// IMPORTANT: If you add fields to this struct, you need to also add initializers
|
||||
/// for those fields in WebRenderAPI.h.
|
||||
#[repr(C)]
|
||||
pub struct WrStackingContextParams {
|
||||
pub clip: WrStackingContextClip,
|
||||
pub animation: *const WrAnimationProperty,
|
||||
pub opacity: *const f32,
|
||||
pub transform_style: TransformStyle,
|
||||
pub reference_frame_kind: ReferenceFrameKind,
|
||||
pub is_backface_visible: bool,
|
||||
pub mix_blend_mode: MixBlendMode,
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_dp_push_stacking_context(
|
||||
state: &mut WrState,
|
||||
mut bounds: LayoutRect,
|
||||
spatial_id: WrSpatialId,
|
||||
clip: &WrStackingContextClip,
|
||||
animation: *const WrAnimationProperty,
|
||||
opacity: *const f32,
|
||||
params: &WrStackingContextParams,
|
||||
transform: *const LayoutTransform,
|
||||
transform_style: TransformStyle,
|
||||
reference_frame_kind: ReferenceFrameKind,
|
||||
mix_blend_mode: MixBlendMode,
|
||||
filters: *const FilterOp,
|
||||
filter_count: usize,
|
||||
is_backface_visible: bool,
|
||||
glyph_raster_space: RasterSpace,
|
||||
) -> WrSpatialId {
|
||||
debug_assert!(unsafe { !is_in_render_thread() });
|
||||
@ -1921,13 +1928,13 @@ pub extern "C" fn wr_dp_push_stacking_context(
|
||||
|
||||
let transform_ref = unsafe { transform.as_ref() };
|
||||
let mut transform_binding = match transform_ref {
|
||||
Some(transform) => Some(PropertyBinding::Value(transform.clone())),
|
||||
Some(t) => Some(PropertyBinding::Value(t.clone())),
|
||||
None => None,
|
||||
};
|
||||
|
||||
let opacity_ref = unsafe { opacity.as_ref() };
|
||||
let opacity_ref = unsafe { params.opacity.as_ref() };
|
||||
let mut has_opacity_animation = false;
|
||||
let anim = unsafe { animation.as_ref() };
|
||||
let anim = unsafe { params.animation.as_ref() };
|
||||
if let Some(anim) = anim {
|
||||
debug_assert!(anim.id > 0);
|
||||
match anim.effect_type {
|
||||
@ -1957,7 +1964,7 @@ pub extern "C" fn wr_dp_push_stacking_context(
|
||||
}
|
||||
|
||||
let mut wr_spatial_id = spatial_id.to_webrender(state.pipeline_id);
|
||||
let wr_clip_id = clip.to_webrender(state.pipeline_id);
|
||||
let wr_clip_id = params.clip.to_webrender(state.pipeline_id);
|
||||
|
||||
// Note: 0 has special meaning in WR land, standing for ROOT_REFERENCE_FRAME.
|
||||
// However, it is never returned by `push_reference_frame`, and we need to return
|
||||
@ -1968,9 +1975,9 @@ pub extern "C" fn wr_dp_push_stacking_context(
|
||||
wr_spatial_id = state.frame_builder.dl_builder.push_reference_frame(
|
||||
&bounds,
|
||||
wr_spatial_id,
|
||||
transform_style,
|
||||
params.transform_style,
|
||||
transform_binding,
|
||||
reference_frame_kind,
|
||||
params.reference_frame_kind,
|
||||
);
|
||||
|
||||
bounds.origin = LayoutPoint::zero();
|
||||
@ -1979,7 +1986,7 @@ pub extern "C" fn wr_dp_push_stacking_context(
|
||||
}
|
||||
|
||||
let prim_info = LayoutPrimitiveInfo {
|
||||
is_backface_visible,
|
||||
is_backface_visible: params.is_backface_visible,
|
||||
tag: state.current_tag,
|
||||
.. LayoutPrimitiveInfo::new(bounds)
|
||||
};
|
||||
@ -1989,8 +1996,8 @@ pub extern "C" fn wr_dp_push_stacking_context(
|
||||
.push_stacking_context(&prim_info,
|
||||
wr_spatial_id,
|
||||
wr_clip_id,
|
||||
transform_style,
|
||||
mix_blend_mode,
|
||||
params.transform_style,
|
||||
params.mix_blend_mode,
|
||||
&filters,
|
||||
glyph_raster_space);
|
||||
|
||||
|
@ -6100,7 +6100,7 @@ void PresShell::Paint(nsView* aViewToPaint, const nsRegion& aDirtyRegion,
|
||||
|
||||
MaybeSetupTransactionIdAllocator(layerManager, presContext);
|
||||
layerManager->AsWebRenderLayerManager()->EndTransactionWithoutLayer(
|
||||
nullptr, nullptr, wrFilters, &data);
|
||||
nullptr, nullptr, std::move(wrFilters), &data);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2628,7 +2628,8 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(
|
||||
wr::FilterOp::ColorMatrix(colorMatrix->components));
|
||||
}
|
||||
|
||||
wrManager->EndTransactionWithoutLayer(this, aBuilder, wrFilters);
|
||||
wrManager->EndTransactionWithoutLayer(this, aBuilder,
|
||||
std::move(wrFilters));
|
||||
}
|
||||
|
||||
// For layers-free mode, we check the invalidation state bits in the
|
||||
@ -6076,10 +6077,11 @@ bool nsDisplayOpacity::CreateWebRenderCommands(
|
||||
animationsId,
|
||||
};
|
||||
|
||||
nsTArray<mozilla::wr::FilterOp> filters;
|
||||
wr::StackingContextParams params;
|
||||
params.animation = animationsId ? &prop : nullptr;
|
||||
params.opacity = opacityForSC;
|
||||
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
|
||||
filters, LayoutDeviceRect(), nullptr,
|
||||
animationsId ? &prop : nullptr, opacityForSC);
|
||||
params);
|
||||
|
||||
aManager->CommandBuilder().CreateWebRenderCommandsFromDisplayList(
|
||||
&mList, this, aDisplayListBuilder, sc, aBuilder, aResources);
|
||||
@ -6115,11 +6117,11 @@ bool nsDisplayBlendMode::CreateWebRenderCommands(
|
||||
const StackingContextHelper& aSc,
|
||||
mozilla::layers::RenderRootStateManager* aManager,
|
||||
nsDisplayListBuilder* aDisplayListBuilder) {
|
||||
nsTArray<mozilla::wr::FilterOp> filters;
|
||||
wr::StackingContextParams params;
|
||||
params.mix_blend_mode =
|
||||
wr::ToMixBlendMode(nsCSSRendering::GetGFXBlendMode(mBlendMode));
|
||||
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
|
||||
filters, LayoutDeviceRect(), nullptr, nullptr,
|
||||
nullptr, nullptr, wr::ReferenceFrameKind::Transform,
|
||||
nsCSSRendering::GetGFXBlendMode(mBlendMode));
|
||||
params);
|
||||
|
||||
return nsDisplayWrapList::CreateWebRenderCommands(
|
||||
aBuilder, aResources, sc, aManager, aDisplayListBuilder);
|
||||
@ -6346,9 +6348,11 @@ bool nsDisplayOwnLayer::CreateWebRenderCommands(
|
||||
prop.id = mWrAnimationId;
|
||||
prop.effect_type = wr::WrAnimationType::Transform;
|
||||
|
||||
wr::StackingContextParams params;
|
||||
params.animation = ∝
|
||||
|
||||
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
|
||||
nsTArray<wr::FilterOp>(), LayoutDeviceRect(),
|
||||
nullptr, &prop);
|
||||
params);
|
||||
|
||||
nsDisplayWrapList::CreateWebRenderCommands(aBuilder, aResources, sc, aManager,
|
||||
aDisplayListBuilder);
|
||||
@ -7878,7 +7882,6 @@ bool nsDisplayTransform::CreateWebRenderCommands(
|
||||
animationsId,
|
||||
};
|
||||
|
||||
nsTArray<mozilla::wr::FilterOp> filters;
|
||||
Maybe<nsDisplayTransform*> deferredTransformItem;
|
||||
if (!mFrame->ChildrenHavePerspective()) {
|
||||
// If it has perspective, we create a new scroll data via the
|
||||
@ -7894,15 +7897,18 @@ bool nsDisplayTransform::CreateWebRenderCommands(
|
||||
bool animated =
|
||||
ActiveLayerTracker::IsStyleMaybeAnimated(Frame(), eCSSProperty_transform);
|
||||
|
||||
bool preserve3D = mFrame->Extend3DContext() && !mIsTransformSeparator;
|
||||
wr::StackingContextParams params;
|
||||
params.mBoundTransform = &newTransformMatrix;
|
||||
params.animation = animationsId ? &prop : nullptr;
|
||||
params.mTransformPtr = transformForSC;
|
||||
params.is_backface_visible = !BackfaceIsHidden();
|
||||
params.mDeferredTransformItem = deferredTransformItem;
|
||||
params.mAnimated = animated;
|
||||
params.SetPreserve3D(mFrame->Extend3DContext() && !mIsTransformSeparator);
|
||||
|
||||
StackingContextHelper sc(
|
||||
aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder, filters,
|
||||
LayoutDeviceRect(position, LayoutDeviceSize()), &newTransformMatrix,
|
||||
animationsId ? &prop : nullptr, nullptr, transformForSC,
|
||||
wr::ReferenceFrameKind::Transform, gfx::CompositionOp::OP_OVER,
|
||||
!BackfaceIsHidden(), preserve3D, deferredTransformItem,
|
||||
wr::WrStackingContextClip::None(), animated);
|
||||
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
|
||||
params,
|
||||
LayoutDeviceRect(position, LayoutDeviceSize()));
|
||||
|
||||
return mStoredList.CreateWebRenderCommands(aBuilder, aResources, sc, aManager,
|
||||
aDisplayListBuilder);
|
||||
@ -8501,12 +8507,14 @@ bool nsDisplayPerspective::CreateWebRenderCommands(
|
||||
bool preserve3D =
|
||||
mFrame->Extend3DContext() || perspectiveFrame->Extend3DContext();
|
||||
|
||||
nsTArray<mozilla::wr::FilterOp> filters;
|
||||
StackingContextHelper sc(
|
||||
aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder, filters,
|
||||
LayoutDeviceRect(), nullptr, nullptr, nullptr, &perspectiveMatrix,
|
||||
wr::ReferenceFrameKind::Perspective, gfx::CompositionOp::OP_OVER,
|
||||
!BackfaceIsHidden(), preserve3D);
|
||||
wr::StackingContextParams params;
|
||||
params.mTransformPtr = &perspectiveMatrix;
|
||||
params.reference_frame_kind = wr::ReferenceFrameKind::Perspective;
|
||||
params.is_backface_visible = !BackfaceIsHidden();
|
||||
params.SetPreserve3D(preserve3D);
|
||||
|
||||
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
|
||||
params);
|
||||
|
||||
return mList.CreateWebRenderCommands(aBuilder, aResources, sc, aManager,
|
||||
aDisplayListBuilder);
|
||||
@ -9097,19 +9105,11 @@ bool nsDisplayMasksAndClipPaths::CreateWebRenderCommands(
|
||||
? Some(mFrame->StyleEffects()->mOpacity)
|
||||
: Nothing();
|
||||
|
||||
layer.emplace(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
|
||||
/*aFilters: */ nsTArray<wr::FilterOp>(),
|
||||
/*aBounds: */ bounds,
|
||||
/*aBoundTransform: */ nullptr,
|
||||
/*aAnimation: */ nullptr,
|
||||
/*aOpacity: */ opacity.ptrOr(nullptr),
|
||||
/*aTransform: */ nullptr,
|
||||
/*aReferenceFrameKind: */ wr::ReferenceFrameKind::Transform,
|
||||
/*aMixBlendMode: */ gfx::CompositionOp::OP_OVER,
|
||||
/*aBackfaceVisible: */ true,
|
||||
/*aIsPreserve3D: */ false,
|
||||
/*aTransformForScrollData: */ Nothing(),
|
||||
/*aClip: */ wr::WrStackingContextClip::ClipId(clipId));
|
||||
wr::StackingContextParams params;
|
||||
params.clip = wr::WrStackingContextClip::ClipId(clipId);
|
||||
params.opacity = opacity.ptrOr(nullptr);
|
||||
layer.emplace(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder, params,
|
||||
bounds);
|
||||
sc = layer.ptr();
|
||||
}
|
||||
|
||||
@ -9413,12 +9413,12 @@ bool nsDisplayFilters::CreateWebRenderCommands(
|
||||
}
|
||||
|
||||
float opacity = mFrame->StyleEffects()->mOpacity;
|
||||
StackingContextHelper sc(
|
||||
aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder, wrFilters,
|
||||
LayoutDeviceRect(), nullptr, nullptr,
|
||||
opacity != 1.0f && mHandleOpacity ? &opacity : nullptr, nullptr,
|
||||
wr::ReferenceFrameKind::Transform, gfx::CompositionOp::OP_OVER, true,
|
||||
false, Nothing(), clip);
|
||||
wr::StackingContextParams params;
|
||||
params.mFilters = std::move(wrFilters);
|
||||
params.opacity = opacity != 1.0f && mHandleOpacity ? &opacity : nullptr;
|
||||
params.clip = clip;
|
||||
StackingContextHelper sc(aSc, GetActiveScrolledRoot(), mFrame, this, aBuilder,
|
||||
params);
|
||||
|
||||
nsDisplayEffectsBase::CreateWebRenderCommands(aBuilder, aResources, sc,
|
||||
aManager, aDisplayListBuilder);
|
||||
|
Loading…
Reference in New Issue
Block a user