Bug 1317862 - Part 4: Remove unnecessary clip. r=mstange
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 24 Nov 2016 18:11:29 +1300
changeset 324156 6888e7fc8a9cd2ddd78788d7b792f70a58691fcf
parent 324155 92e343bcb231b8974beefcdcd123e7d7470b73e1
child 324157 c92c581e9de36dcaa7d8a818e5cd6b4b30c6bfb8
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersmstange
bugs1317862
milestone53.0a1
Bug 1317862 - Part 4: Remove unnecessary clip. r=mstange
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -4818,17 +4818,17 @@ public:
   virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
                                          const nsDisplayItemGeometry* aGeometry,
                                          nsRegion *aInvalidRegion) override;
 
   virtual void DisableComponentAlpha() override {
     mDisableSubpixelAA = true;
   }
 
-  void RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder);
+  void RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder, bool aIsRecording = false);
 
   bool CanApplyOpacity() const override
   {
     nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
     if (f->IsSelected()) {
       return false;
     }
 
@@ -4990,17 +4990,17 @@ nsDisplayText::nsDisplayText(nsDisplayLi
   mBounds.Inflate(mFrame->PresContext()->AppUnitsPerDevPixel());
 
   if (gfxPrefs::LayersAllowTextLayers()) {
     RefPtr<DrawTargetCapture> capture =
       gfxPlatform::GetPlatform()->ScreenReferenceDrawTarget()->CreateCaptureDT(IntSize());
     RefPtr<gfxContext> captureCtx = gfxContext::CreateOrNull(capture);
 
     // TODO: Paint() checks mDisableSubpixelAA, we should too.
-    RenderToContext(captureCtx, aBuilder);
+    RenderToContext(captureCtx, aBuilder, true);
 
     // TODO: Ideally we'd re-use captureCtx in Paint() if we couldn't build
     // a layer here. We have to deal with the problem that the ScreenReferenceDrawTarget
     // might not be compatible with the DT used for layer rendering.
 
     GlyphArray* g = mGlyphs.AppendElement();
     std::vector<Glyph> glyphs;
     Color color;
@@ -5063,17 +5063,17 @@ nsDisplayText::BuildLayer(nsDisplayListB
   layer->SetBounds(IntRect(destBounds.x, destBounds.y, destBounds.width, destBounds.height));
 
   layer->SetBaseTransform(gfx::Matrix4x4::Translation(aContainerParameters.mOffset.x,
                                                       aContainerParameters.mOffset.y, 0));
   return layer.forget();
 }
 
 void
-nsDisplayText::RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder)
+nsDisplayText::RenderToContext(gfxContext* aCtx, nsDisplayListBuilder* aBuilder, bool aIsRecording)
 {
   nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
 
   // Add 1 pixel of dirty area around mVisibleRect to allow us to paint
   // antialiased pixels beyond the measured text extents.
   // This is temporary until we do this in the actual calculation of text extents.
   auto A2D = mFrame->PresContext()->AppUnitsPerDevPixel();
   LayoutDeviceRect extraVisible =
@@ -5083,17 +5083,18 @@ nsDisplayText::RenderToContext(gfxContex
   gfxContextAutoSaveRestore save(aCtx);
 
   gfxRect pixelVisible(extraVisible.x, extraVisible.y,
                        extraVisible.width, extraVisible.height);
   pixelVisible.Inflate(2);
   pixelVisible.RoundOut();
 
   if (!aBuilder->IsForGenerateGlyphMask() &&
-      !aBuilder->IsForPaintingSelectionBG()) {
+      !aBuilder->IsForPaintingSelectionBG() &&
+      !aIsRecording) {
     aCtx->NewPath();
     aCtx->Rectangle(pixelVisible);
     aCtx->Clip();
   }
 
   NS_ASSERTION(mVisIStartEdge >= 0, "illegal start edge");
   NS_ASSERTION(mVisIEndEdge >= 0, "illegal end edge");