2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef __NS_SVGFILTERFRAME_H__
|
|
|
|
#define __NS_SVGFILTERFRAME_H__
|
|
|
|
|
2013-05-29 12:37:49 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsQueryFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsRect.h"
|
2007-03-29 01:54:53 -07:00
|
|
|
#include "nsSVGContainerFrame.h"
|
2012-03-18 03:32:02 -07:00
|
|
|
#include "nsSVGUtils.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-20 05:15:55 -07:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsIPresShell;
|
2012-03-02 00:28:59 -08:00
|
|
|
class nsRenderingContext;
|
2012-03-20 05:15:55 -07:00
|
|
|
class nsStyleContext;
|
2008-09-10 17:24:16 -07:00
|
|
|
class nsSVGFilterPaintCallback;
|
2012-03-28 04:31:47 -07:00
|
|
|
class nsSVGIntegerPair;
|
|
|
|
class nsSVGLength2;
|
2008-02-17 18:04:26 -08:00
|
|
|
|
2013-02-17 15:28:47 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class SVGFilterElement;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-02-17 23:29:00 -08:00
|
|
|
typedef nsSVGContainerFrame nsSVGFilterFrameBase;
|
2012-03-20 05:15:55 -07:00
|
|
|
|
2007-03-29 01:54:53 -07:00
|
|
|
class nsSVGFilterFrame : public nsSVGFilterFrameBase
|
|
|
|
{
|
|
|
|
friend nsIFrame*
|
2009-01-19 10:31:34 -08:00
|
|
|
NS_NewSVGFilterFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2007-09-07 02:30:51 -07:00
|
|
|
protected:
|
2012-03-10 11:28:06 -08:00
|
|
|
nsSVGFilterFrame(nsStyleContext* aContext)
|
2012-03-28 04:31:47 -07:00
|
|
|
: nsSVGFilterFrameBase(aContext),
|
|
|
|
mLoopFlag(false),
|
|
|
|
mNoHRefURI(false)
|
2012-03-10 11:28:06 -08:00
|
|
|
{
|
2013-07-12 00:13:07 -07:00
|
|
|
AddStateBits(NS_FRAME_IS_NONDISPLAY);
|
2012-03-10 11:28:06 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-09-10 17:24:16 -07:00
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2012-07-20 09:41:29 -07:00
|
|
|
// nsIFrame methods:
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE {}
|
2012-07-20 09:41:29 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2011-10-09 10:17:29 -07:00
|
|
|
nsIAtom* aAttribute,
|
2013-05-29 12:37:49 -07:00
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2011-10-09 10:17:29 -07:00
|
|
|
|
2012-06-26 03:49:23 -07:00
|
|
|
/**
|
|
|
|
* Paint the given filtered frame.
|
|
|
|
* @param aDirtyArea The area than needs to be painted, in aFilteredFrame's
|
|
|
|
* frame space (i.e. relative to its origin, the top-left corner of its
|
|
|
|
* border box).
|
|
|
|
*/
|
2012-06-16 13:23:48 -07:00
|
|
|
nsresult PaintFilteredFrame(nsRenderingContext *aContext,
|
|
|
|
nsIFrame *aFilteredFrame,
|
|
|
|
nsSVGFilterPaintCallback *aPaintCallback,
|
2012-06-26 03:49:23 -07:00
|
|
|
const nsRect* aDirtyArea);
|
2007-12-03 20:40:52 -08:00
|
|
|
|
2008-09-10 17:24:16 -07:00
|
|
|
/**
|
2012-06-16 13:23:48 -07:00
|
|
|
* Returns the post-filter area that could be dirtied when the given
|
2012-06-26 03:49:23 -07:00
|
|
|
* pre-filter area of aFilteredFrame changes.
|
|
|
|
* @param aPreFilterDirtyRect The pre-filter area of aFilteredFrame that has
|
|
|
|
* changed, relative to aFilteredFrame, in app units.
|
2008-09-10 17:24:16 -07:00
|
|
|
*/
|
2012-06-26 03:49:23 -07:00
|
|
|
nsRect GetPostFilterDirtyArea(nsIFrame *aFilteredFrame,
|
|
|
|
const nsRect& aPreFilterDirtyRect);
|
2008-09-10 17:24:16 -07:00
|
|
|
|
|
|
|
/**
|
2012-06-16 13:23:48 -07:00
|
|
|
* Returns the pre-filter area that is needed from aFilteredFrame when the
|
2012-06-26 03:49:23 -07:00
|
|
|
* given post-filter area needs to be repainted.
|
|
|
|
* @param aPostFilterDirtyRect The post-filter area that is dirty, relative
|
|
|
|
* to aFilteredFrame, in app units.
|
2008-09-10 17:24:16 -07:00
|
|
|
*/
|
2012-06-26 03:49:23 -07:00
|
|
|
nsRect GetPreFilterNeededArea(nsIFrame *aFilteredFrame,
|
|
|
|
const nsRect& aPostFilterDirtyRect);
|
2008-09-10 17:24:16 -07:00
|
|
|
|
|
|
|
/**
|
2012-06-26 03:49:23 -07:00
|
|
|
* Returns the post-filter visual overflow rect (paint bounds) of
|
|
|
|
* aFilteredFrame.
|
|
|
|
* @param aOverrideBBox A user space rect, in user units, that should be used
|
|
|
|
* as aFilteredFrame's bbox ('bbox' is a specific SVG term), if non-null.
|
2012-06-22 20:01:36 -07:00
|
|
|
* @param aPreFilterBounds The pre-filter visual overflow rect of
|
2012-06-26 03:49:23 -07:00
|
|
|
* aFilteredFrame, if non-null.
|
2008-09-10 17:24:16 -07:00
|
|
|
*/
|
2012-06-26 03:49:23 -07:00
|
|
|
nsRect GetPostFilterBounds(nsIFrame *aFilteredFrame,
|
2012-07-30 07:20:58 -07:00
|
|
|
const gfxRect *aOverrideBBox = nullptr,
|
|
|
|
const nsRect *aPreFilterBounds = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-01-19 10:31:34 -08:00
|
|
|
#ifdef DEBUG
|
2013-03-19 18:47:48 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2009-01-19 10:31:34 -08:00
|
|
|
#endif
|
|
|
|
|
2007-03-29 01:54:53 -07:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgFilterFrame
|
|
|
|
*/
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2012-03-28 04:31:47 -07:00
|
|
|
|
|
|
|
private:
|
|
|
|
// Parse our xlink:href and set up our nsSVGPaintingProperty if we
|
|
|
|
// reference another filter and we don't have a property. Return
|
|
|
|
// the referenced filter's frame if available, null otherwise.
|
|
|
|
class AutoFilterReferencer;
|
|
|
|
friend class nsAutoFilterInstance;
|
|
|
|
nsSVGFilterFrame* GetReferencedFilter();
|
|
|
|
nsSVGFilterFrame* GetReferencedFilterIfNotInUse();
|
|
|
|
|
|
|
|
// Accessors to lookup filter attributes
|
2012-08-22 08:56:38 -07:00
|
|
|
uint16_t GetEnumValue(uint32_t aIndex, nsIContent *aDefault);
|
|
|
|
uint16_t GetEnumValue(uint32_t aIndex)
|
2012-03-28 04:31:47 -07:00
|
|
|
{
|
|
|
|
return GetEnumValue(aIndex, mContent);
|
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
const nsSVGIntegerPair *GetIntegerPairValue(uint32_t aIndex, nsIContent *aDefault);
|
|
|
|
const nsSVGIntegerPair *GetIntegerPairValue(uint32_t aIndex)
|
2012-03-28 04:31:47 -07:00
|
|
|
{
|
|
|
|
return GetIntegerPairValue(aIndex, mContent);
|
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
const nsSVGLength2 *GetLengthValue(uint32_t aIndex, nsIContent *aDefault);
|
|
|
|
const nsSVGLength2 *GetLengthValue(uint32_t aIndex)
|
2012-03-28 04:31:47 -07:00
|
|
|
{
|
|
|
|
return GetLengthValue(aIndex, mContent);
|
|
|
|
}
|
2013-02-17 15:28:47 -08:00
|
|
|
const mozilla::dom::SVGFilterElement *GetFilterContent(nsIContent *aDefault);
|
|
|
|
const mozilla::dom::SVGFilterElement *GetFilterContent()
|
2012-03-28 04:31:47 -07:00
|
|
|
{
|
|
|
|
return GetFilterContent(mContent);
|
|
|
|
}
|
|
|
|
|
|
|
|
// This flag is used to detect loops in xlink:href processing
|
|
|
|
bool mLoopFlag;
|
|
|
|
bool mNoHRefURI;
|
2007-03-29 01:54:53 -07:00
|
|
|
};
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#endif
|