1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/layout/svg/nsSVGPaintServerFrame.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,72 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef __NS_SVGPAINTSERVERFRAME_H__ 1.10 +#define __NS_SVGPAINTSERVERFRAME_H__ 1.11 + 1.12 +#include "mozilla/Attributes.h" 1.13 +#include "nsCOMPtr.h" 1.14 +#include "nsFrame.h" 1.15 +#include "nsIFrame.h" 1.16 +#include "nsQueryFrame.h" 1.17 +#include "nsSVGContainerFrame.h" 1.18 +#include "nsSVGUtils.h" 1.19 + 1.20 +class gfxContext; 1.21 +class gfxPattern; 1.22 +class nsStyleContext; 1.23 + 1.24 +struct gfxRect; 1.25 + 1.26 +typedef nsSVGContainerFrame nsSVGPaintServerFrameBase; 1.27 + 1.28 +class nsSVGPaintServerFrame : public nsSVGPaintServerFrameBase 1.29 +{ 1.30 +protected: 1.31 + nsSVGPaintServerFrame(nsStyleContext* aContext) 1.32 + : nsSVGPaintServerFrameBase(aContext) 1.33 + { 1.34 + AddStateBits(NS_FRAME_IS_NONDISPLAY); 1.35 + } 1.36 + 1.37 +public: 1.38 + NS_DECL_FRAMEARENA_HELPERS 1.39 + 1.40 + /** 1.41 + * Constructs a gfxPattern of the paint server rendering. 1.42 + * 1.43 + * @param aContextMatrix The transform matrix that is currently applied to 1.44 + * the gfxContext that is being drawn to. This is needed by SVG patterns so 1.45 + * that surfaces of the correct size can be created. (SVG gradients are 1.46 + * vector based, so it's not used there.) 1.47 + */ 1.48 + virtual already_AddRefed<gfxPattern> 1.49 + GetPaintServerPattern(nsIFrame *aSource, 1.50 + const gfxMatrix& aContextMatrix, 1.51 + nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, 1.52 + float aOpacity, 1.53 + const gfxRect *aOverrideBounds = nullptr) = 0; 1.54 + 1.55 + /** 1.56 + * Configure paint server prior to rendering 1.57 + * @return false to skip rendering 1.58 + */ 1.59 + virtual bool SetupPaintServer(gfxContext *aContext, 1.60 + nsIFrame *aSource, 1.61 + nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, 1.62 + float aOpacity); 1.63 + 1.64 + // nsIFrame methods: 1.65 + virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, 1.66 + const nsRect& aDirtyRect, 1.67 + const nsDisplayListSet& aLists) MOZ_OVERRIDE {} 1.68 + 1.69 + virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE 1.70 + { 1.71 + return nsSVGPaintServerFrameBase::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer); 1.72 + } 1.73 +}; 1.74 + 1.75 +#endif // __NS_SVGPAINTSERVERFRAME_H__