Bug 1304011 - Part 1. Do not merge nsDisplayMask with css mask. draft
authorcku <cku@mozilla.com>
Sun, 18 Sep 2016 18:47:02 +0800
changeset 417384 82b6d7b0cc2eead5abba173c6c1d377c00862b1c
parent 417383 29beaebdfaccbdaeb4c1ee5a43a9795ab015ef49
child 417385 aa7406149f860297f5fcd72f31969597c2decb7f
push id30391
push userbmo:cku@mozilla.com
push dateSat, 24 Sep 2016 17:46:41 +0000
bugs1304011
milestone52.0a1
Bug 1304011 - Part 1. Do not merge nsDisplayMask with css mask. MozReview-Commit-ID: 9Y8ccNieOF4
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -6833,20 +6833,28 @@ bool nsDisplayMask::TryMerge(nsDisplayIt
   // compositing group
   // aItem->GetUnderlyingFrame() returns non-null because it's nsDisplaySVGEffects
   if (aItem->Frame()->GetContent() != mFrame->GetContent())
     return false;
   if (aItem->GetClip() != GetClip())
     return false;
   if (aItem->ScrollClip() != ScrollClip())
     return false;
+
+  // Do not merge if mFrame has mask. Continuation frames should apply mask
+  // independently(just like nsDisplayBackgroundImage).
+  const nsStyleSVGReset *style = mFrame->StyleSVGReset();
+  if (style->mMask.HasLayerWithImage())
+    return false;
+
   nsDisplayMask* other = static_cast<nsDisplayMask*>(aItem);
   MergeFromTrackingMergedFrames(other);
   mEffectsBounds.UnionRect(mEffectsBounds,
     other->mEffectsBounds + other->mFrame->GetOffsetTo(mFrame));
+
   return true;
 }
 
 already_AddRefed<Layer>
 nsDisplayMask::BuildLayer(nsDisplayListBuilder* aBuilder,
                           LayerManager* aManager,
                           const ContainerLayerParameters& aContainerParameters)
 {