Bug 1421888 - Don't apply highlight-painted-layers or paint-flashing fills when drawing mask surfaces. r?ethlin draft
authorMarkus Stange <mstange@themasta.com>
Wed, 29 Nov 2017 23:28:54 -0500
changeset 705463 977b9b0f80e01c7103cacadec2a53b838fb9f6f6
parent 703863 a1b2a5126c4321319863028aa15cf75618ff720c
child 742362 5bbff4115bade54004853ff0031788a0ae1180cb
push id91476
push userbmo:mstange@themasta.com
push dateThu, 30 Nov 2017 04:29:20 +0000
reviewersethlin
bugs1421888
milestone59.0a1
Bug 1421888 - Don't apply highlight-painted-layers or paint-flashing fills when drawing mask surfaces. r?ethlin MozReview-Commit-ID: GfRkuBDly6f
gfx/layers/wr/WebRenderCommandBuilder.cpp
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -441,26 +441,31 @@ PaintItemByDrawTarget(nsDisplayItem* aIt
 
   default:
     context->SetMatrix(context->CurrentMatrix().PreScale(aScale.width, aScale.height).PreTranslate(-aOffset.x, -aOffset.y));
     aItem->Paint(aDisplayListBuilder, context);
     isInvalidated = true;
     break;
   }
 
-  if (aHighlight) {
-    aDT->SetTransform(gfx::Matrix());
-    aDT->FillRect(gfx::Rect(0, 0, aImageRect.Width(), aImageRect.Height()), gfx::ColorPattern(aHighlight.value()));
-  }
-  if (aItem->Frame()->PresContext()->GetPaintFlashing() && isInvalidated) {
-    aDT->SetTransform(gfx::Matrix());
-    float r = float(rand()) / RAND_MAX;
-    float g = float(rand()) / RAND_MAX;
-    float b = float(rand()) / RAND_MAX;
-    aDT->FillRect(gfx::Rect(0, 0, aImageRect.Width(), aImageRect.Height()), gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
+  if (aItem->GetType() != DisplayItemType::TYPE_MASK) {
+    // Apply highlight fills, if the appropriate prefs are set.
+    // We don't do this for masks because we'd be filling the A8 mask surface,
+    // which isn't very useful.
+    if (aHighlight) {
+      aDT->SetTransform(gfx::Matrix());
+      aDT->FillRect(gfx::Rect(0, 0, aImageRect.Width(), aImageRect.Height()), gfx::ColorPattern(aHighlight.value()));
+    }
+    if (aItem->Frame()->PresContext()->GetPaintFlashing() && isInvalidated) {
+      aDT->SetTransform(gfx::Matrix());
+      float r = float(rand()) / RAND_MAX;
+      float g = float(rand()) / RAND_MAX;
+      float b = float(rand()) / RAND_MAX;
+      aDT->FillRect(gfx::Rect(0, 0, aImageRect.Width(), aImageRect.Height()), gfx::ColorPattern(gfx::Color(r, g, b, 0.5)));
+    }
   }
 
   return isInvalidated;
 }
 
 already_AddRefed<WebRenderFallbackData>
 WebRenderCommandBuilder::GenerateFallbackData(nsDisplayItem* aItem,
                                               wr::DisplayListBuilder& aBuilder,