diff --git a/layout/svg/nsSVGIntegrationUtils.cpp b/layout/svg/nsSVGIntegrationUtils.cpp index eeb454e1a8bb..ee840d9f6e77 100644 --- a/layout/svg/nsSVGIntegrationUtils.cpp +++ b/layout/svg/nsSVGIntegrationUtils.cpp @@ -464,7 +464,16 @@ nsSVGIntegrationUtils::PaintFramesWithEffects(nsRenderingContext* aCtx, nsPoint firstFrameOffset = GetOffsetToUserSpace(firstFrame); nsPoint offset = aBuilder->ToReferenceFrame(firstFrame) - firstFrameOffset; - nsPoint offsetWithoutSVGGeomFramePos = offset; + nsPoint offsetWithoutSVGGeomFramePos; + if (firstFrame->IsFrameOfType(nsIFrame::eSVG)) { + offsetWithoutSVGGeomFramePos = offset; + } else { + /* Snap the offset if the reference frame is not a SVG frame, + * since other frames will be snapped to pixel when rendering. */ + offsetWithoutSVGGeomFramePos = nsPoint( + aFrame->PresContext()->RoundAppUnitsToNearestDevPixels(offset.x), + aFrame->PresContext()->RoundAppUnitsToNearestDevPixels(offset.y)); + } nsPoint svgGeomFramePos; if (aFrame->IsFrameOfType(nsIFrame::eSVGGeometry) || aFrame->IsSVGText()) {