layout/svg/nsSVGForeignObjectFrame.h

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:db81723f933e
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/. */
5
6 #ifndef NSSVGFOREIGNOBJECTFRAME_H__
7 #define NSSVGFOREIGNOBJECTFRAME_H__
8
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"
15
16 class nsRenderingContext;
17 class nsSVGOuterSVGFrame;
18
19 typedef nsContainerFrame nsSVGForeignObjectFrameBase;
20
21 class nsSVGForeignObjectFrame : public nsSVGForeignObjectFrameBase,
22 public nsISVGChildFrame
23 {
24 friend nsIFrame*
25 NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
26 protected:
27 nsSVGForeignObjectFrame(nsStyleContext* aContext);
28
29 public:
30 NS_DECL_QUERYFRAME
31 NS_DECL_FRAMEARENA_HELPERS
32
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 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
39 nsIAtom* aAttribute,
40 int32_t aModType) MOZ_OVERRIDE;
41
42 virtual nsIFrame* GetContentInsertionFrame() MOZ_OVERRIDE {
43 return GetFirstPrincipalChild()->GetContentInsertionFrame();
44 }
45
46 virtual nsresult Reflow(nsPresContext* aPresContext,
47 nsHTMLReflowMetrics& aDesiredSize,
48 const nsHTMLReflowState& aReflowState,
49 nsReflowStatus& aStatus) MOZ_OVERRIDE;
50
51 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
52 const nsRect& aDirtyRect,
53 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
54
55 /**
56 * Get the "type" of the frame
57 *
58 * @see nsGkAtoms::svgForeignObjectFrame
59 */
60 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
61
62 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE
63 {
64 return nsSVGForeignObjectFrameBase::IsFrameOfType(aFlags &
65 ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject));
66 }
67
68 virtual bool IsSVGTransformed(Matrix *aOwnTransform,
69 Matrix *aFromParentTransform) const MOZ_OVERRIDE;
70
71 #ifdef DEBUG_FRAME_DUMP
72 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE
73 {
74 return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult);
75 }
76 #endif
77
78 // nsISVGChildFrame interface:
79 virtual nsresult PaintSVG(nsRenderingContext *aContext,
80 const nsIntRect *aDirtyRect,
81 nsIFrame* aTransformRoot = nullptr) MOZ_OVERRIDE;
82 virtual nsIFrame* GetFrameForPoint(const nsPoint &aPoint) MOZ_OVERRIDE;
83 virtual nsRect GetCoveredRegion() MOZ_OVERRIDE;
84 virtual void ReflowSVG() MOZ_OVERRIDE;
85 virtual void NotifySVGChanged(uint32_t aFlags) MOZ_OVERRIDE;
86 virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,
87 uint32_t aFlags) MOZ_OVERRIDE;
88 virtual bool IsDisplayContainer() MOZ_OVERRIDE { return true; }
89
90 gfxMatrix GetCanvasTM(uint32_t aFor, nsIFrame* aTransformRoot = nullptr);
91
92 nsRect GetInvalidRegion();
93
94 protected:
95 // implementation helpers:
96 void DoReflow();
97 void RequestReflow(nsIPresShell::IntrinsicDirty aType);
98
99 // If width or height is less than or equal to zero we must disable rendering
100 bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
101
102 nsAutoPtr<gfxMatrix> mCanvasTM;
103
104 bool mInReflow;
105 };
106
107 #endif

mercurial