Bug 786254 - SVG effects rendering doesn't pixel snap, causing faint vertical lines appear on some tabs. r=roc
authorXidorn Quan <quanxunzhen@gmail.com>
Wed, 24 Jul 2013 09:03:11 -0400
changeset 152113 517eaa8ba87e6a4823e7c2f6bb420c75500932a1
parent 152112 b4402b6dba21bd5e1e0d7a684e97223a56576d18
child 152114 62cea72bee19c13246f67724672a64c44af7480c
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs786254
milestone25.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
Bug 786254 - SVG effects rendering doesn't pixel snap, causing faint vertical lines appear on some tabs. r=roc
layout/svg/nsSVGIntegrationUtils.cpp
--- a/layout/svg/nsSVGIntegrationUtils.cpp
+++ b/layout/svg/nsSVGIntegrationUtils.cpp
@@ -459,17 +459,26 @@ nsSVGIntegrationUtils::PaintFramesWithEf
 
   bool isTrivialClip = clipPathFrame ? clipPathFrame->IsTrivial() : true;
 
   gfxContext* gfx = aCtx->ThebesContext();
   gfxContextMatrixAutoSaveRestore matrixAutoSaveRestore(gfx);
 
   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()) {
     // SVG leaf frames apply their offset themselves, we need to unapply it at
     // various points below to prevent it being double counted.
     svgGeomFramePos = aFrame->GetPosition();
     offsetWithoutSVGGeomFramePos -= svgGeomFramePos;
   }