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;
|
2012-07-17 10:03:51 -07:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aModType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-12-17 01:09:19 -08:00
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual nsIFrame* GetContentInsertionFrame() {
|
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,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags &
|
|
|
|
~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
|
|
|
|
}
|
|
|
|
|
2012-07-20 11:12:29 -07:00
|
|
|
virtual bool IsSVGTransformed(gfxMatrix *aOwnTransform,
|
|
|
|
gfxMatrix *aFromParentTransform) const;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// nsISVGChildFrame interface:
|
2012-03-02 00:28:59 -08:00
|
|
|
NS_IMETHOD PaintSVG(nsRenderingContext *aContext,
|
2008-10-20 01:42:03 -07:00
|
|
|
const nsIntRect *aDirtyRect);
|
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;
|
2012-04-16 01:23:48 -07:00
|
|
|
virtual SVGBBox GetBBoxContribution(const gfxMatrix &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
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
gfxMatrix GetCanvasTM(uint32_t aFor);
|
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
|