Bug 1310575 - Part 1. Have a new base class for nsDisplayMaskGeometry and nsDisplayFilterGeometry. r=mstange
authorcku <cku@mozilla.com>
Wed, 26 Oct 2016 15:55:32 +0800
changeset 347240 b6138a79a5519a53081fb014aeeefc81464ca074
parent 347239 38e392b25823078e021c35bd72e65cd04622a4a2
child 347241 b687d6aefc9d70046479d1a5e949cdf2abf483fd
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1310575
milestone52.0a1
Bug 1310575 - Part 1. Have a new base class for nsDisplayMaskGeometry and nsDisplayFilterGeometry. r=mstange Use nsDisplayMaskGeometry, created by nsDisplayMask, in nsDisplaySVGEffects, which is the parent class of nsDisplayMask) is odd. So create a base class for both nsDisplayMaskGeometry and nsDisplayFilterGeometry. Use this base class in nsDisplaySVGEffects's code. MozReview-Commit-ID: G3FLybT1pQp
layout/base/nsDisplayList.cpp
layout/base/nsDisplayListInvalidation.cpp
layout/base/nsDisplayListInvalidation.h
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -6793,18 +6793,18 @@ nsDisplaySVGEffects::UserSpaceOffset() c
   return nsSVGUtils::FrameSpaceInCSSPxToUserSpaceOffset(mFrame);
 }
 
 void
 nsDisplaySVGEffects::ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
                                                const nsDisplayItemGeometry* aGeometry,
                                                nsRegion* aInvalidRegion)
 {
-  const nsDisplayMaskGeometry* geometry =
-    static_cast<const nsDisplayMaskGeometry*>(aGeometry);
+  const nsDisplaySVGEffectGeometry* geometry =
+    static_cast<const nsDisplaySVGEffectGeometry*>(aGeometry);
   bool snap;
   nsRect bounds = GetBounds(aBuilder, &snap);
   if (geometry->mFrameOffsetToReferenceFrame != ToReferenceFrame() ||
       geometry->mUserSpaceOffset != UserSpaceOffset() ||
       !geometry->mBBox.IsEqualInterior(BBoxInUserSpace())) {
     // Filter and mask output can depend on the location of the frame's user
     // space and on the frame's BBox. We need to invalidate if either of these
     // change relative to the reference frame.
--- a/layout/base/nsDisplayListInvalidation.cpp
+++ b/layout/base/nsDisplayListInvalidation.cpp
@@ -108,47 +108,41 @@ nsDisplayBoxShadowOuterGeometry::nsDispl
 
 void
 nsDisplaySolidColorRegionGeometry::MoveBy(const nsPoint& aOffset)
 {
   nsDisplayItemGeometry::MoveBy(aOffset);
   mRegion.MoveBy(aOffset);
 }
 
-nsDisplayMaskGeometry::nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder)
+nsDisplaySVGEffectGeometry::nsDisplaySVGEffectGeometry(nsDisplaySVGEffects* aItem, nsDisplayListBuilder* aBuilder)
   : nsDisplayItemGeometry(aItem, aBuilder)
-  , nsImageGeometryMixin(aItem, aBuilder)
-  , mBBox(aItem->BBoxInUserSpace())
-  , mUserSpaceOffset(aItem->UserSpaceOffset())
-  , mFrameOffsetToReferenceFrame(aItem->ToReferenceFrame())
-  , mDestRects(aItem->GetDestRects())
-{}
-
-void
-nsDisplayMaskGeometry::MoveBy(const nsPoint& aOffset)
-{
-  mBounds.MoveBy(aOffset);
-  mFrameOffsetToReferenceFrame += aOffset;
-}
-
-nsDisplayFilterGeometry::nsDisplayFilterGeometry(nsDisplayFilter* aItem, nsDisplayListBuilder* aBuilder)
-  : nsDisplayItemGeometry(aItem, aBuilder)
-  , nsImageGeometryMixin(aItem, aBuilder)
   , mBBox(aItem->BBoxInUserSpace())
   , mUserSpaceOffset(aItem->UserSpaceOffset())
   , mFrameOffsetToReferenceFrame(aItem->ToReferenceFrame())
 {}
 
 void
-nsDisplayFilterGeometry::MoveBy(const nsPoint& aOffset)
+nsDisplaySVGEffectGeometry::MoveBy(const nsPoint& aOffset)
 {
   mBounds.MoveBy(aOffset);
   mFrameOffsetToReferenceFrame += aOffset;
 }
 
+nsDisplayMaskGeometry::nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder)
+  : nsDisplaySVGEffectGeometry(aItem, aBuilder)
+  , nsImageGeometryMixin(aItem, aBuilder)
+  , mDestRects(aItem->GetDestRects())
+{}
+
+nsDisplayFilterGeometry::nsDisplayFilterGeometry(nsDisplayFilter* aItem, nsDisplayListBuilder* aBuilder)
+  : nsDisplaySVGEffectGeometry(aItem, aBuilder)
+  , nsImageGeometryMixin(aItem, aBuilder)
+{}
+
 nsCharClipGeometry::nsCharClipGeometry(nsCharClipDisplayItem* aItem, nsDisplayListBuilder* aBuilder)
   : nsDisplayItemGenericGeometry(aItem, aBuilder)
   , mVisIStartEdge(aItem->mVisIStartEdge)
   , mVisIEndEdge(aItem->mVisIEndEdge)
 {}
 
 nsDisplayTableItemGeometry::nsDisplayTableItemGeometry(nsDisplayTableItem* aItem,
                                                        nsDisplayListBuilder* aBuilder,
--- a/layout/base/nsDisplayListInvalidation.h
+++ b/layout/base/nsDisplayListInvalidation.h
@@ -14,16 +14,17 @@
 #include "gfxRect.h"
 
 class nsDisplayBackgroundImage;
 class nsCharClipDisplayItem;
 class nsDisplayItem;
 class nsDisplayListBuilder;
 class nsDisplayTableItem;
 class nsDisplayThemedBackground;
+class nsDisplaySVGEffects;
 class nsDisplayMask;
 class nsDisplayFilter;
 
 namespace mozilla {
 namespace gfx {
 struct Color;
 }
 }
@@ -261,49 +262,51 @@ public:
   { }
 
   virtual void MoveBy(const nsPoint& aOffset) override;
 
   nsRegion mRegion;
   mozilla::gfx::Color mColor;
 };
 
-class nsDisplayMaskGeometry : public nsDisplayItemGeometry
-  , public nsImageGeometryMixin<nsDisplayMaskGeometry>
+class nsDisplaySVGEffectGeometry : public nsDisplayItemGeometry
 {
 public:
-  nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder);
-
-  virtual void MoveBy(const nsPoint& aOffset) override;
-
-  gfxRect mBBox;
-  gfxPoint mUserSpaceOffset;
-  nsPoint mFrameOffsetToReferenceFrame;
-
-  nsTArray<nsRect> mDestRects;
-};
-
-class nsDisplayFilterGeometry : public nsDisplayItemGeometry
-  , public nsImageGeometryMixin<nsDisplayMaskGeometry>
-{
-public:
-  nsDisplayFilterGeometry(nsDisplayFilter* aItem,
-                          nsDisplayListBuilder* aBuilder);
+  nsDisplaySVGEffectGeometry(nsDisplaySVGEffects* aItem,
+                             nsDisplayListBuilder* aBuilder);
 
   virtual void MoveBy(const nsPoint& aOffset) override;
 
   gfxRect mBBox;
   gfxPoint mUserSpaceOffset;
   nsPoint mFrameOffsetToReferenceFrame;
 };
 
+class nsDisplayMaskGeometry : public nsDisplaySVGEffectGeometry
+  , public nsImageGeometryMixin<nsDisplayMaskGeometry>
+{
+public:
+  nsDisplayMaskGeometry(nsDisplayMask* aItem, nsDisplayListBuilder* aBuilder);
+
+  nsTArray<nsRect> mDestRects;
+};
+
+class nsDisplayFilterGeometry : public nsDisplaySVGEffectGeometry
+  , public nsImageGeometryMixin<nsDisplayFilterGeometry>
+{
+public:
+  nsDisplayFilterGeometry(nsDisplayFilter* aItem,
+                          nsDisplayListBuilder* aBuilder);
+};
+
 class nsCharClipGeometry : public nsDisplayItemGenericGeometry
 {
 public:
-  nsCharClipGeometry(nsCharClipDisplayItem* aItem, nsDisplayListBuilder* aBuilder);
+  nsCharClipGeometry(nsCharClipDisplayItem* aItem,
+                     nsDisplayListBuilder* aBuilder);
 
   nscoord mVisIStartEdge;
   nscoord mVisIEndEdge;
 };
 
 class nsDisplayTableItemGeometry
   : public nsDisplayItemGenericGeometry
   , public nsImageGeometryMixin<nsDisplayTableItemGeometry>