Bug 886842 - Add clang trunk builds for ASan. r=froydnj
[gecko.git] / layout / svg / nsSVGForeignObjectFrame.h
blob148367f266442dd07ab1ba8a291ef2e6de210e22
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef NSSVGFOREIGNOBJECTFRAME_H__
7 #define NSSVGFOREIGNOBJECTFRAME_H__
9 #include "mozilla/Attributes.h"
10 #include "nsContainerFrame.h"
11 #include "nsIPresShell.h"
12 #include "nsISVGChildFrame.h"
13 #include "nsRegion.h"
14 #include "nsSVGUtils.h"
16 class nsRenderingContext;
17 class nsSVGOuterSVGFrame;
19 typedef nsContainerFrame nsSVGForeignObjectFrameBase;
21 class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase,
22 public nsISVGChildFrame
24 friend nsIFrame*
25 NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
26 protected:
27 nsSVGForeignObjectFrame(nsStyleContext* aContext);
29 public:
30 NS_DECL_QUERYFRAME
31 NS_DECL_FRAMEARENA_HELPERS
33 // nsIFrame:
34 virtual void Init(nsIContent* aContent,
35 nsIFrame* aParent,
36 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
37 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
38 NS_IMETHOD AttributeChanged(int32_t aNameSpaceID,
39 nsIAtom* aAttribute,
40 int32_t aModType) MOZ_OVERRIDE;
42 virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
43 return GetFirstPrincipalChild()->GetContentInsertionFrame();
46 NS_IMETHOD Reflow(nsPresContext* aPresContext,
47 nsHTMLReflowMetrics& aDesiredSize,
48 const nsHTMLReflowState& aReflowState,
49 nsReflowStatus& aStatus) MOZ_OVERRIDE;
51 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
52 const nsRect& aDirtyRect,
53 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
55 /**
56 * Get the "type" of the frame
58 * @see nsGkAtoms::svgForeignObjectFrame
60 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
62 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
64 return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags &
65 ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
68 virtual bool IsSVGTransformed(gfxMatrix *aOwnTransform,
69 gfxMatrix *aFromParentTransform) const MOZ_OVERRIDE;
71 #ifdef DEBUG
72 NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
74 return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult);
76 #endif
78 // nsISVGChildFrame interface:
79 NS_IMETHOD PaintSVG(nsRenderingContext *aContext,
80 const nsIntRect *aDirtyRect) MOZ_OVERRIDE;
81 NS_IMETHOD_(nsIFrame*) GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
82 NS_IMETHOD_(nsRect) GetCoveredRegion() MOZ_OVERRIDE;
83 virtual void ReflowSVG() MOZ_OVERRIDE;
84 virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
85 virtual SVGBBox GetBBoxContribution(const gfxMatrix &aToBBoxUserspace,
86 uint32_t aFlags) MOZ_OVERRIDE;
87 NS_IMETHOD_(bool) IsDisplayContainer() MOZ_OVERRIDE { return true; }
89 gfxMatrix GetCanvasTM(uint32_t aFor);
91 nsRect GetInvalidRegion();
93 protected:
94 // implementation helpers:
95 void DoReflow();
96 void RequestReflow(nsIPresShell::IntrinsicDirty aType);
98 // If width or height is less than or equal to zero we must disable rendering
99 bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
101 nsAutoPtr<gfxMatrix> mCanvasTM;
103 bool mInReflow;
106 #endif