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 NSSVGFOREIGNOBJECTFRAME_H__
|
|
|
|
#define NSSVGFOREIGNOBJECTFRAME_H__
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2007-06-21 16:01:10 -07:00
|
|
|
#include "nsContainerFrame.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsIPresShell.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsISVGChildFrame.h"
|
|
|
|
#include "nsRegion.h"
|
2012-03-20 05:15:55 -07:00
|
|
|
#include "nsSVGUtils.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-03-02 00:28:59 -08:00
|
|
|
class nsRenderingContext;
|
2008-09-18 02:47:21 -07:00
|
|
|
class nsSVGOuterSVGFrame;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
typedef nsContainerFrame nsSVGForeignObjectFrameBase;
|
|
|
|
|
|
|
|
class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase,
|
|
|
|
public nsISVGChildFrame
|
|
|
|
{
|
|
|
|
friend nsIFrame*
|
2009-01-19 10:31:34 -08:00
|
|
|
NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
nsSVGForeignObjectFrame(nsStyleContext* aContext);
|
2009-09-12 09:49:24 -07:00
|
|
|
|
2009-01-09 08:35:24 -08:00
|
|
|
public:
|
2009-01-12 11:20:59 -08:00
|
|
|
NS_DECL_QUERYFRAME
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2009-01-12 11:20:59 -08:00
|
|
|
|
2009-09-12 09:49:24 -07:00
|
|
|
// nsIFrame:
|
2013-03-19 18:47:48 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
2013-05-29 12:37:49 -07:00
|
|
|
int32_t aModType) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
|
2011-08-24 13:54:30 -07:00
|
|
|
return GetFirstPrincipalChild()->GetContentInsertionFrame();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2013-05-29 12:37:49 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2012-07-20 11:12:29 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* Get the "type" of the frame
|
|
|
|
*
|
|
|
|
* @see nsGkAtoms::svgForeignObjectFrame
|
|
|
|
*/
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-05-29 12:37:49 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags &
|
|
|
|
~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
|
|
|
|
}
|
|
|
|
|
2013-12-29 15:35:53 -08:00
|
|
|
virtual bool IsSVGTransformed(mozilla::gfx::Matrix *aOwnTransform,
|
|
|
|
mozilla::gfx::Matrix *aFromParentTransform) const MOZ_OVERRIDE;
|
2012-07-20 11:12:29 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
2013-05-29 12:37:49 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// nsISVGChildFrame interface:
|
2012-03-02 00:28:59 -08:00
|
|
|
NS_IMETHOD PaintSVG(nsRenderingContext *aContext,
|
2013-09-11 00:27:45 -07:00
|
|
|
const nsIntRect *aDirtyRect,
|
|
|
|
nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(nsRect) GetCoveredRegion() MOZ_OVERRIDE;
|
|
|
|
virtual void ReflowSVG() MOZ_OVERRIDE;
|
|
|
|
virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
|
2013-12-29 22:50:07 -08:00
|
|
|
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
|
2012-09-14 09:10:08 -07:00
|
|
|
uint32_t aFlags) MOZ_OVERRIDE;
|
|
|
|
NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { return true; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-09-11 00:27:45 -07:00
|
|
|
gfxMatrix GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot = nullptr);
|
2007-11-20 01:10:18 -08:00
|
|
|
|
2012-08-28 22:39:33 -07:00
|
|
|
nsRect GetInvalidRegion();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
// implementation helpers:
|
|
|
|
void DoReflow();
|
2007-05-05 04:11:07 -07:00
|
|
|
void RequestReflow(nsIPresShell::IntrinsicDirty aType);
|
2009-06-18 04:31:25 -07:00
|
|
|
|
2007-06-25 01:31:31 -07:00
|
|
|
// If width or height is less than or equal to zero we must disable rendering
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
|
2007-06-25 01:31:31 -07:00
|
|
|
|
2011-09-25 14:04:32 -07:00
|
|
|
nsAutoPtr<gfxMatrix> mCanvasTM;
|
2009-06-11 08:23:43 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mInReflow;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|