Bug 1386643 - Don't respect font smoothing background colors in pushed layers. r?jrmuizel draft
authorMarkus Stange <mstange@themasta.com>
Wed, 02 Aug 2017 17:26:02 -0400
changeset 619945 58630e38b4ae7064e3600669ec8bc124fe0858b3
parent 619863 084d8182cf6a689a6bf865bacce4cc4c40b5dc46
child 640550 5542352dea19c05a02a69a53e1812eaf6960e7f8
push id71877
push userbmo:mstange@themasta.com
push dateWed, 02 Aug 2017 21:56:46 +0000
reviewersjrmuizel
bugs1386643
milestone57.0a1
Bug 1386643 - Don't respect font smoothing background colors in pushed layers. r?jrmuizel This is an imperfect workaround. Ideally we'd want layout to determine the correct color here: If the pushed layer will end up on something mostly opaque in the outer layer, the font smoothing background color should be transparent (or even a color that approximates that opaque content), and if the pushed layer will end up on transparency in the outer layer, the appropriate font smoothing background color for the outer layer should be used when drawing text in the pushed layer. This workaround causes us to lose subpixel AA in background tabs that have the overflow mask applied to them. For those, using the font smoothing background color in the pushed layer was the right choice. MozReview-Commit-ID: FPufh04EVp3
gfx/2d/DrawTargetSkia.cpp
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -1256,17 +1256,23 @@ DrawTargetSkia::FillGlyphsWithCG(ScaledF
 
   Vector<CGGlyph,32> glyphs;
   Vector<CGPoint,32> positions;
   if (!SetupCGGlyphs(cgContext, aBuffer, glyphs, positions)) {
     ReturnCGContext(cgContext);
     return false;
   }
 
-  SetFontSmoothingBackgroundColor(cgContext, mColorSpace, aRenderingOptions);
+  if (mPushedLayers.empty()) {
+    // Respect the font smoothing background color, but only if no layer is
+    // currently pushed, because this color usually describes what's under this
+    // DrawTarget, and not what's within this DrawTarget under the currently
+    // pushed layer.
+    SetFontSmoothingBackgroundColor(cgContext, mColorSpace, aRenderingOptions);
+  }
   SetFontColor(cgContext, mColorSpace, aPattern);
 
   ScaledFontMac* macFont = static_cast<ScaledFontMac*>(aFont);
   if (ScaledFontMac::CTFontDrawGlyphsPtr != nullptr) {
     ScaledFontMac::CTFontDrawGlyphsPtr(macFont->mCTFont, glyphs.begin(),
                                        positions.begin(),
                                        aBuffer.mNumGlyphs, cgContext);
   } else {