--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -9660,16 +9660,20 @@ nsDisplayMask::CreateWebRenderCommands(m
if (mask) {
auto layoutBounds = wr::ToRoundedLayoutRect(bounds);
wr::WrClipId clipId = aBuilder.DefineClip(Nothing(), Nothing(),
layoutBounds, nullptr, mask.ptr());
// Create a new stacking context to attach the mask to, ensuring the mask is
// applied to the aggregate, and not the individual elements.
+ // The stacking context shouldn't have any offset.
+ layoutBounds.origin.x = 0;
+ layoutBounds.origin.y = 0;
+
aBuilder.PushStackingContext(/*aBounds: */ layoutBounds,
/*aClipNodeId: */ &clipId,
/*aAnimation: */ nullptr,
/*aOpacity: */ nullptr,
/*aTransform: */ nullptr,
/*aTransformStyle: */ wr::TransformStyle::Flat,
/*aPerspective: */ nullptr,
/*aMixBlendMode: */ wr::MixBlendMode::Normal,