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
|
|
|
|
2020-07-15 02:40:05 +03:00
|
|
|
#ifndef LAYOUT_SVG_SVGPAINTSERVERFRAME_H_
|
|
|
|
#define LAYOUT_SVG_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"
|
2020-07-09 04:33:33 +03:00
|
|
|
#include "mozilla/SVGContainerFrame.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2020-07-07 01:38:11 +03:00
|
|
|
#include "nsIFrame.h"
|
2012-03-20 16:15:55 +04:00
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsQueryFrame.h"
|
2006-05-02 19:05:25 +04:00
|
|
|
|
2020-07-07 16:49:30 +03:00
|
|
|
class gfxContext;
|
|
|
|
class gfxPattern;
|
|
|
|
|
2014-09-29 17:15:19 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
class DrawTarget;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
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:
|
2020-07-30 17:22:38 +03:00
|
|
|
explicit AutoSetRestorePaintServerState(nsIFrame* aFrame) : mFrame(aFrame) {
|
2017-03-24 21:07:26 +03:00
|
|
|
mFrame->AddStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
|
|
|
}
|
|
|
|
~AutoSetRestorePaintServerState() {
|
|
|
|
mFrame->RemoveStateBits(NS_FRAME_DRAWING_AS_PAINTSERVER);
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsIFrame* mFrame;
|
|
|
|
};
|
|
|
|
|
2020-07-09 04:33:33 +03:00
|
|
|
class SVGPaintServerFrame : public SVGContainerFrame {
|
2007-09-07 13:30:51 +04:00
|
|
|
protected:
|
2020-07-15 13:37:55 +03:00
|
|
|
using DrawTarget = gfx::DrawTarget;
|
2014-09-29 17:15:19 +04:00
|
|
|
|
2020-07-07 16:49:30 +03:00
|
|
|
SVGPaintServerFrame(ComputedStyle* aStyle, nsPresContext* aPresContext,
|
|
|
|
ClassID aID)
|
2020-07-09 04:33:33 +03:00
|
|
|
: SVGContainerFrame(aStyle, aPresContext, aID) {
|
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:
|
2020-07-15 13:37:55 +03:00
|
|
|
using imgDrawingParams = image::imgDrawingParams;
|
2017-05-18 23:03:41 +03:00
|
|
|
|
2020-07-07 16:49:30 +03:00
|
|
|
NS_DECL_ABSTRACT_FRAME(SVGPaintServerFrame)
|
2020-07-20 21:02:25 +03:00
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
NS_DECL_QUERYFRAME_TARGET(SVGPaintServerFrame)
|
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> GetPaintServerPattern(
|
2014-09-29 17:15:19 +04:00
|
|
|
nsIFrame* aSource, const DrawTarget* aDrawTarget,
|
2020-07-07 16:49:30 +03:00
|
|
|
const gfxMatrix& aContextMatrix, StyleSVGPaint nsStyleSVG::*aFillOrStroke,
|
|
|
|
float aOpacity, imgDrawingParams& aImgParams,
|
2017-05-18 23:03:50 +03:00
|
|
|
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 {}
|
2006-05-16 19:55:01 +04:00
|
|
|
};
|
|
|
|
|
2020-07-07 16:49:30 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2020-07-15 02:40:05 +03:00
|
|
|
#endif // LAYOUT_SVG_SVGPAINTSERVERFRAME_H_
|