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