Bug 1424673 - Fix the clip region for text draw target. r=kats draft
authorEthan Lin <ethlin@mozilla.com>
Mon, 08 Jan 2018 10:59:01 +0800
changeset 718421 6d72277853fbff52171486dc70c1b3b9392d9a4b
parent 718290 e4de69553e3faf8136eb9bb7f2f741e1b7e6f866
child 718422 2288976b1c13d2088a2fdd0b6a816737c62bb982
child 718885 ace5496beeb63b1a17e5505496583bf6fe230125
child 718886 d6190f0fa5f2e7c0b1f3eac72b1dd803fc3d571c
push id94925
push userbmo:ethlin@mozilla.com
push dateWed, 10 Jan 2018 10:18:12 +0000
reviewerskats
bugs1424673
milestone59.0a1
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