2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04: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/. */
|
2004-10-15 03:02:53 +04:00
|
|
|
|
2006-05-16 19:55:01 +04:00
|
|
|
#ifndef __NS_SVGPAINTSERVERFRAME_H__
|
|
|
|
#define __NS_SVGPAINTSERVERFRAME_H__
|
2004-10-15 03:02:53 +04:00
|
|
|
|
2017-07-05 18:22:00 +03:00
|
|
|
#include "gfxRect.h"
|
2013-05-29 23:37:49 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsFrame.h"
|
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsQueryFrame.h"
|
2006-06-01 19:31:15 +04:00
|
|
|
#include "nsSVGContainerFrame.h"
|
2012-03-18 14:32:02 +04:00
|
|
|
#include "nsSVGUtils.h"
|
2006-05-02 19:05:25 +04:00
|
|
|
|
2014-09-29 17:15:19 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|
2014-09-29 17:15:19 +04:00
|
|
|
|
2006-11-27 20:30:57 +03:00
|
|
|
class gfxContext;
|
2012-03-20 16:15:55 +04:00
|
|
|
class gfxPattern;
|
|
|
|
class nsStyleContext;
|
2004-10-15 03:02:53 +04:00
|
|
|
|
2017-03-24 21:07:26 +03:00
|
|
|
/**
|
|
|
|
* RAII class used to temporarily set and remove the
|
|
|
|
* NS_FRAME_DRAWING_AS_PAINTSERVER frame state bit while a frame is being
|
|
|
|
* drawn as a paint server.
|
|
|
|
*/
|
|
|
|
class MOZ_RAII AutoSetRestorePaintServerState
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
explicit AutoSetRestorePaintServerState(
|
|
|
|
nsIFrame* aFrame
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
|
|
|
|
mFrame(aFrame)
|
|
|
|
{
|
|
|
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
|
|
|
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
|
|
|
}
|
|
|
|
~AutoSetRestorePaintServerState()
|
|
|
|
{
|
|
|
|
mFrame->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
|
|
|
};
|
|
|
|
|
2016-04-18 10:36:49 +03:00
|
|
|
class nsSVGPaintServerFrame : public nsSVGContainerFrame
|
2006-05-16 19:55:01 +04:00
|
|
|
{
|
2007-09-07 13:30:51 +04:00
|
|
|
protected:
|
2014-09-29 17:15:19 +04:00
|
|
|
typedef mozilla::gfx::DrawTarget DrawTarget;
|
|
|
|
|
2017-05-26 13:11:11 +03:00
|
|
|
nsSVGPaintServerFrame(nsStyleContext* aContext, ClassID aID)
|
|
|
|
: nsSVGContainerFrame(aContext, aID)
|
2012-03-10 23:28:06 +04:00
|
|
|
{
|
2013-07-12 11:13:07 +04:00
|
|
|
AddStateBits(NS_FRAME_IS_NONDISPLAY);
|
2012-03-10 23:28:06 +04:00
|
|
|
}
|
2005-03-09 22:24:18 +03:00
|
|
|
|
2007-09-07 13:30:51 +04:00
|
|
|
public:
|
2017-05-18 23:03:41 +03:00
|
|
|
typedef mozilla::image::imgDrawingParams imgDrawingParams;
|
|
|
|
|
2015-11-04 12:57:35 +03:00
|
|
|
NS_DECL_ABSTRACT_FRAME(nsSVGPaintServerFrame)
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2010-07-01 20:40:30 +04:00
|
|
|
/**
|
|
|
|
* Constructs a gfxPattern of the paint server rendering.
|
2012-07-14 03:18:38 +04:00
|
|
|
*
|
|
|
|
* @param aContextMatrix The transform matrix that is currently applied to
|
|
|
|
* the gfxContext that is being drawn to. This is needed by SVG patterns so
|
|
|
|
* that surfaces of the correct size can be created. (SVG gradients are
|
|
|
|
* vector based, so it's not used there.)
|
2010-07-01 20:40:30 +04:00
|
|
|
*/
|
2017-05-18 23:03:50 +03:00
|
|
|
virtual already_AddRefed<gfxPattern>
|
2010-07-01 20:40:30 +04:00
|
|
|
GetPaintServerPattern(nsIFrame *aSource,
|
2014-09-29 17:15:19 +04:00
|
|
|
const DrawTarget* aDrawTarget,
|
2012-07-14 03:18:38 +04:00
|
|
|
const gfxMatrix& aContextMatrix,
|
2012-05-18 12:34:25 +04:00
|
|
|
nsStyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
2010-07-01 20:40:30 +04:00
|
|
|
float aOpacity,
|
2017-05-18 23:03:50 +03:00
|
|
|
imgDrawingParams& aImgParams,
|
|
|
|
const gfxRect* aOverrideBounds = nullptr) = 0;
|
2010-07-01 20:40:30 +04:00
|
|
|
|
2012-07-20 20:41:29 +04:00
|
|
|
// nsIFrame methods:
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override {}
|
2012-07-20 20:41:29 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override
|
2010-07-01 20:40:19 +04:00
|
|
|
{
|
2016-04-18 10:36:49 +03:00
|
|
|
return nsSVGContainerFrame::IsFrameOfType(aFlags & ~nsIFrame::eSVGPaintServer);
|
2010-07-01 20:40:19 +04:00
|
|
|
}
|
2006-05-16 19:55:01 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __NS_SVGPAINTSERVERFRAME_H__
|