Bug 780963 - Make UpdateOverflow() on filter primitive frames a no-op. r=roc.
authorJonathan Watt <jwatt@jwatt.org>
Tue, 14 Aug 2012 10:04:24 +0100
changeset 102291 ad77846165e301f5cd3f028147fab7b72230f1b4
parent 102286 9e7c04aff0e6e07edb91f602a4899e2042721e52
child 102292 a2f41b9ebdba28fbc70c003e9f3b470628a6bf6b
push id23276
push userryanvm@gmail.com
push dateWed, 15 Aug 2012 00:50:06 +0000
treeherdermozilla-central@86ee4deea55b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs780963
milestone17.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 780963 - Make UpdateOverflow() on filter primitive frames a no-op. r=roc.
layout/generic/nsFrame.cpp
layout/svg/base/src/SVGFEContainerFrame.cpp
layout/svg/base/src/SVGFEImageFrame.cpp
layout/svg/base/src/SVGFELeafFrame.cpp
layout/svg/base/src/SVGFEUnstyledLeafFrame.cpp
layout/svg/base/src/nsSVGFilterFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -5053,16 +5053,20 @@ nsIFrame::GetPreEffectsVisualOverflowRec
   nsRect* r = static_cast<nsRect*>
     (Properties().Get(nsIFrame::PreEffectsBBoxProperty()));
   return r ? *r : GetVisualOverflowRectRelativeToSelf();
 }
 
 /* virtual */ bool
 nsFrame::UpdateOverflow()
 {
+  MOZ_ASSERT(!(mState & NS_FRAME_SVG_LAYOUT) ||
+             !(mState & NS_STATE_SVG_NONDISPLAY_CHILD),
+             "Non-display SVG do not maintain visual overflow rects");
+
   nsRect rect(nsPoint(0, 0), GetSize());
   nsOverflowAreas overflowAreas(rect, rect);
 
   bool isBox = IsBoxFrame() || IsBoxWrapped();
   if (!isBox || (!IsCollapsed() && !DoesClipChildren())) {
     nsLayoutUtils::UnionChildOverflow(this, overflowAreas);
   }
 
--- a/layout/svg/base/src/SVGFEContainerFrame.cpp
+++ b/layout/svg/base/src/SVGFEContainerFrame.cpp
@@ -20,17 +20,17 @@ typedef nsContainerFrame SVGFEContainerF
 class SVGFEContainerFrame : public SVGFEContainerFrameBase
 {
   friend nsIFrame*
   NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 protected:
   SVGFEContainerFrame(nsStyleContext* aContext)
     : SVGFEContainerFrameBase(aContext)
   {
-    AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
+    AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD);
   }
 
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   virtual bool IsFrameOfType(PRUint32 aFlags) const
   {
     return SVGFEContainerFrameBase::IsFrameOfType(
@@ -56,16 +56,21 @@ public:
    *
    * @see nsGkAtoms::svgFEContainerFrame
    */
   virtual nsIAtom* GetType() const;
 
   NS_IMETHOD AttributeChanged(PRInt32  aNameSpaceID,
                               nsIAtom* aAttribute,
                               PRInt32  aModType);
+
+  virtual bool UpdateOverflow() {
+    // We don't maintain a visual overflow rect
+    return false;
+  }
 };
 
 nsIFrame*
 NS_NewSVGFEContainerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) SVGFEContainerFrame(aContext);
 }
 
--- a/layout/svg/base/src/SVGFEImageFrame.cpp
+++ b/layout/svg/base/src/SVGFEImageFrame.cpp
@@ -18,17 +18,17 @@ typedef nsFrame SVGFEImageFrameBase;
 class SVGFEImageFrame : public SVGFEImageFrameBase
 {
   friend nsIFrame*
   NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 protected:
   SVGFEImageFrame(nsStyleContext* aContext)
     : SVGFEImageFrameBase(aContext)
   {
-    AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
+    AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD);
   }
 
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   NS_IMETHOD Init(nsIContent* aContent,
                   nsIFrame*   aParent,
                   nsIFrame*   aPrevInFlow);
@@ -53,16 +53,21 @@ public:
    *
    * @see nsGkAtoms::svgFEImageFrame
    */
   virtual nsIAtom* GetType() const;
 
   NS_IMETHOD AttributeChanged(PRInt32  aNameSpaceID,
                               nsIAtom* aAttribute,
                               PRInt32  aModType);
+
+  virtual bool UpdateOverflow() {
+    // We don't maintain a visual overflow rect
+    return false;
+  }
 };
 
 nsIFrame*
 NS_NewSVGFEImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) SVGFEImageFrame(aContext);
 }
 
--- a/layout/svg/base/src/SVGFELeafFrame.cpp
+++ b/layout/svg/base/src/SVGFELeafFrame.cpp
@@ -18,17 +18,17 @@ typedef nsFrame SVGFELeafFrameBase;
 class SVGFELeafFrame : public SVGFELeafFrameBase
 {
   friend nsIFrame*
   NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 protected:
   SVGFELeafFrame(nsStyleContext* aContext)
     : SVGFELeafFrameBase(aContext)
   {
-    AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
+    AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD);
   }
 
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
 #ifdef DEBUG
   NS_IMETHOD Init(nsIContent* aContent,
                   nsIFrame*   aParent,
@@ -54,16 +54,21 @@ public:
    *
    * @see nsGkAtoms::svgFELeafFrame
    */
   virtual nsIAtom* GetType() const;
 
   NS_IMETHOD AttributeChanged(PRInt32  aNameSpaceID,
                               nsIAtom* aAttribute,
                               PRInt32  aModType);
+
+  virtual bool UpdateOverflow() {
+    // We don't maintain a visual overflow rect
+    return false;
+  }
 };
 
 nsIFrame*
 NS_NewSVGFELeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) SVGFELeafFrame(aContext);
 }
 
--- a/layout/svg/base/src/SVGFEUnstyledLeafFrame.cpp
+++ b/layout/svg/base/src/SVGFEUnstyledLeafFrame.cpp
@@ -14,17 +14,17 @@ typedef nsFrame SVGFEUnstyledLeafFrameBa
 class SVGFEUnstyledLeafFrame : public SVGFEUnstyledLeafFrameBase
 {
   friend nsIFrame*
   NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 protected:
   SVGFEUnstyledLeafFrame(nsStyleContext* aContext)
     : SVGFEUnstyledLeafFrameBase(aContext)
   {
-    AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
+    AddStateBits(NS_FRAME_SVG_LAYOUT | NS_STATE_SVG_NONDISPLAY_CHILD);
   }
 
 public:
   NS_DECL_FRAMEARENA_HELPERS
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists) {
@@ -48,16 +48,21 @@ public:
    *
    * @see nsGkAtoms::svgFEUnstyledLeafFrame
    */
   virtual nsIAtom* GetType() const;
 
   NS_IMETHOD AttributeChanged(PRInt32  aNameSpaceID,
                               nsIAtom* aAttribute,
                               PRInt32  aModType);
+
+  virtual bool UpdateOverflow() {
+    // We don't maintain a visual overflow rect
+    return false;
+  }
 };
 
 nsIFrame*
 NS_NewSVGFEUnstyledLeafFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) SVGFEUnstyledLeafFrame(aContext);
 }
 
--- a/layout/svg/base/src/nsSVGFilterFrame.cpp
+++ b/layout/svg/base/src/nsSVGFilterFrame.cpp
@@ -498,16 +498,20 @@ nsSVGFilterFrame::GetPreFilterNeededArea
   return nsRect();
 }
 
 nsRect
 nsSVGFilterFrame::GetPostFilterBounds(nsIFrame *aFilteredFrame,
                                       const gfxRect *aOverrideBBox,
                                       const nsRect *aPreFilterBounds)
 {
+  MOZ_ASSERT(!(aFilteredFrame->GetStateBits() & NS_FRAME_SVG_LAYOUT) ||
+             !(aFilteredFrame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
+             "Non-display SVG do not maintain visual overflow rects");
+
   nsAutoFilterInstance instance(aFilteredFrame, this, nullptr, nullptr,
                                 aPreFilterBounds, aPreFilterBounds,
                                 aOverrideBBox);
   if (!instance.get()) {
     return nsRect();
   }
   // We've passed in the source's bounding box so the instance knows about
   // it. Now we can ask the instance to compute the bounding box of