Bug 1424673 - Fix the clip region for text draw target. r=kats
authorEthan Lin <ethlin@mozilla.com>
Mon, 08 Jan 2018 10:59:01 +0800
changeset 398677 baa4d5ed8cfd97483e3d53e734883d1333b27589
parent 398676 78533a254124a2686d70f6fd39323f954a1f06bf
child 398678 2ae7cff03727dde1a944ba6556ac049d1ba7d66f
push id57874
push userethlin@mozilla.com
push dateThu, 11 Jan 2018 09:04:35 +0000
treeherderautoland@2ae7cff03727 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1424673
milestone59.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 1424673 - Fix the clip region for text draw target. r=kats For draw target, the initial clip region should be the draw target's size. MozReview-Commit-ID: 2z2EobkYFs2
layout/generic/TextDrawTarget.h
--- a/layout/generic/TextDrawTarget.h
+++ b/layout/generic/TextDrawTarget.h
@@ -58,24 +58,21 @@ public:
   {
     SetPermitSubpixelAA(!aItem->IsSubpixelAADisabled());
 
     // Compute clip/bounds
     auto appUnitsPerDevPixel = aItem->Frame()->PresContext()->AppUnitsPerDevPixel();
     LayoutDeviceRect layoutBoundsRect = LayoutDeviceRect::FromAppUnits(
         aBounds, appUnitsPerDevPixel);
     LayoutDeviceRect layoutClipRect = layoutBoundsRect;
+    mBoundsRect = aSc.ToRelativeLayoutRect(layoutBoundsRect);
 
-    auto clip = aItem->GetClip();
-    if (clip.HasClip()) {
-      layoutClipRect = LayoutDeviceRect::FromAppUnits(
-                  clip.GetClipRect(), appUnitsPerDevPixel);
-    }
-
-    mBoundsRect = aSc.ToRelativeLayoutRect(layoutBoundsRect);
+    // Add 1 pixel of dirty area around clip rect to allow us to paint
+    // antialiased pixels beyond the measured text extents.
+    layoutClipRect.Inflate(1);
     mClipRect = aSc.ToRelativeLayoutRect(layoutClipRect);
 
     mBackfaceVisible = !aItem->BackfaceIsHidden();
 
     mBuilder.Save();
   }
 
   // Prevent this from being copied