michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef __NS_SVGPAINTSERVERFRAME_H__ michael@0: #define __NS_SVGPAINTSERVERFRAME_H__ michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsFrame.h" michael@0: #include "nsIFrame.h" michael@0: #include "nsQueryFrame.h" michael@0: #include "nsSVGContainerFrame.h" michael@0: #include "nsSVGUtils.h" michael@0: michael@0: class gfxContext; michael@0: class gfxPattern; michael@0: class nsStyleContext; michael@0: michael@0: struct gfxRect; michael@0: michael@0: typedef nsSVGContainerFrame nsSVGPaintServerFrameBase; michael@0: michael@0: class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase michael@0: { michael@0: protected: michael@0: nsSVGPaintServerFrame(nsStyleContext* aContext) michael@0: : nsSVGPaintServerFrameBase(aContext) michael@0: { michael@0: AddStateBits(NS_FRAME_IS_NONDISPLAY); michael@0: } michael@0: michael@0: public: michael@0: NS_DECL_FRAMEARENA_HELPERS michael@0: michael@0: /** michael@0: * Constructs a gfxPattern of the paint server rendering. michael@0: * michael@0: * @param aContextMatrix The transform matrix that is currently applied to michael@0: * the gfxContext that is being drawn to. This is needed by SVG patterns so michael@0: * that surfaces of the correct size can be created. (SVG gradients are michael@0: * vector based, so it's not used there.) michael@0: */ michael@0: virtual already_AddRefed michael@0: GetPaintServerPattern(nsIFrame *aSource, michael@0: const gfxMatrix& aContextMatrix, michael@0: nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, michael@0: float aOpacity, michael@0: const gfxRect *aOverrideBounds = nullptr) = 0; michael@0: michael@0: /** michael@0: * Configure paint server prior to rendering michael@0: * @return false to skip rendering michael@0: */ michael@0: virtual bool SetupPaintServer(gfxContext *aContext, michael@0: nsIFrame *aSource, michael@0: nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, michael@0: float aOpacity); michael@0: michael@0: // nsIFrame methods: michael@0: virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, michael@0: const nsRect& aDirtyRect, michael@0: const nsDisplayListSet& aLists) MOZ_OVERRIDE {} michael@0: michael@0: virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE michael@0: { michael@0: return nsSVGPaintServerFrameBase::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer); michael@0: } michael@0: }; michael@0: michael@0: #endif // __NS_SVGPAINTSERVERFRAME_H__