Bug 1418893 - Check opacity changes when computing mask's invalidation region. r=mattwoodrow
authorEthan Lin <ethlin@mozilla.com>
Wed, 20 Dec 2017 14:23:06 +0800
changeset 397389 015cc4e8a9b870a49766e834d2410f77c424079c
parent 397388 08b5850633de2e06ebd617308f85dca8c3f88c6f
child 397390 454cdbd6316f22b85f5a3732246a2bcb6047e77f
push id33137
push usertoros@mozilla.com
push dateSat, 23 Dec 2017 22:16:12 +0000
treeherdermozilla-central@3a23cb98f441 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1418893
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1418893 - Check opacity changes when computing mask's invalidation region. r=mattwoodrow MozReview-Commit-ID: 54XDjoh67Mb
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
layout/painting/nsDisplayListInvalidation.cpp
layout/painting/nsDisplayListInvalidation.h
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -9559,16 +9559,21 @@ nsDisplayMask::ComputeInvalidationRegion
   nsDisplaySVGEffects::ComputeInvalidationRegion(aBuilder, aGeometry,
                                                  aInvalidRegion);
 
   const nsDisplayMaskGeometry* geometry =
     static_cast<const nsDisplayMaskGeometry*>(aGeometry);
   bool snap;
   nsRect bounds = GetBounds(aBuilder, &snap);
 
+  if (mFrame->StyleEffects()->mOpacity != geometry->mOpacity ||
+      mHandleOpacity != geometry->mHandleOpacity) {
+    aInvalidRegion->Or(*aInvalidRegion, bounds);
+  }
+
   if (mDestRects.Length() != geometry->mDestRects.Length()) {
     aInvalidRegion->Or(bounds, geometry->mBounds);
   } else {
     for (size_t i = 0; i < mDestRects.Length(); i++) {
       if (!mDestRects[i].IsEqualInterior(geometry->mDestRects[i])) {
         aInvalidRegion->Or(bounds, geometry->mBounds);
         break;
       }
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -5691,16 +5691,20 @@ public:
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState,
                        nsTArray<nsIFrame*> *aOutFrames) override;
 
   virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override {
     return false;
   }
 
+  bool ShouldHandleOpacity() {
+    return mHandleOpacity;
+  }
+
   gfxRect BBoxInUserSpace() const;
   gfxPoint UserSpaceOffset() const;
 
   virtual void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
                                          const nsDisplayItemGeometry* aGeometry,
                                          nsRegion* aInvalidRegion) const override;
 protected:
   bool ValidateSVGFrame();
--- a/layout/painting/nsDisplayListInvalidation.cpp
+++ b/layout/painting/nsDisplayListInvalidation.cpp
@@ -119,16 +119,18 @@ nsDisplaySVGEffectGeometry::MoveBy(const
   mBounds.MoveBy(aOffset);
   mFrameOffsetToReferenceFrame += aOffset;
 }
 
 nsDisplayMaskGeometry::nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder)
   : nsDisplaySVGEffectGeometry(aItem, aBuilder)
   , nsImageGeometryMixin(aItem, aBuilder)
   , mDestRects(aItem->GetDestRects())
+  , mOpacity(aItem->Frame()->StyleEffects()->mOpacity)
+  , mHandleOpacity(aItem->ShouldHandleOpacity())
 {}
 
 nsDisplayFilterGeometry::nsDisplayFilterGeometry(nsDisplayFilter* aItem, nsDisplayListBuilder* aBuilder)
   : nsDisplaySVGEffectGeometry(aItem, aBuilder)
   , nsImageGeometryMixin(aItem, aBuilder)
 {}
 
 nsCharClipGeometry::nsCharClipGeometry(nsCharClipDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
--- a/layout/painting/nsDisplayListInvalidation.h
+++ b/layout/painting/nsDisplayListInvalidation.h
@@ -304,16 +304,18 @@ public:
   nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder);
 
   virtual bool InvalidateForSyncDecodeImages() const override
   {
     return ShouldInvalidateToSyncDecodeImages();
   }
 
   nsTArray<nsRect> mDestRects;
+  float mOpacity;
+  bool mHandleOpacity;
 };
 
 class nsDisplayFilterGeometry : public nsDisplaySVGEffectGeometry
   , public nsImageGeometryMixin<nsDisplayFilterGeometry>
 {
 public:
   nsDisplayFilterGeometry(nsDisplayFilter* aItem,
                           nsDisplayListBuilder* aBuilder);