/src/mozilla-central/layout/svg/nsSVGForeignObjectFrame.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 | | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
3 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
4 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
5 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
6 | | |
7 | | #ifndef NSSVGFOREIGNOBJECTFRAME_H__ |
8 | | #define NSSVGFOREIGNOBJECTFRAME_H__ |
9 | | |
10 | | #include "mozilla/Attributes.h" |
11 | | #include "nsAutoPtr.h" |
12 | | #include "nsContainerFrame.h" |
13 | | #include "nsIPresShell.h" |
14 | | #include "nsSVGDisplayableFrame.h" |
15 | | #include "nsRegion.h" |
16 | | #include "nsSVGUtils.h" |
17 | | |
18 | | class gfxContext; |
19 | | |
20 | | class nsSVGForeignObjectFrame final : public nsContainerFrame |
21 | | , public nsSVGDisplayableFrame |
22 | | { |
23 | | friend nsContainerFrame* |
24 | | NS_NewSVGForeignObjectFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle); |
25 | | protected: |
26 | | explicit nsSVGForeignObjectFrame(ComputedStyle* aStyle); |
27 | | |
28 | | public: |
29 | | NS_DECL_QUERYFRAME |
30 | | NS_DECL_FRAMEARENA_HELPERS(nsSVGForeignObjectFrame) |
31 | | |
32 | | // nsIFrame: |
33 | | virtual void Init(nsIContent* aContent, |
34 | | nsContainerFrame* aParent, |
35 | | nsIFrame* aPrevInFlow) override; |
36 | | virtual void DestroyFrom(nsIFrame* aDestructRoot, PostDestroyData& aPostDestroyData) override; |
37 | | virtual nsresult AttributeChanged(int32_t aNameSpaceID, |
38 | | nsAtom* aAttribute, |
39 | | int32_t aModType) override; |
40 | | |
41 | 0 | virtual nsContainerFrame* GetContentInsertionFrame() override { |
42 | 0 | return PrincipalChildList().FirstChild()->GetContentInsertionFrame(); |
43 | 0 | } |
44 | | |
45 | | virtual void Reflow(nsPresContext* aPresContext, |
46 | | ReflowOutput& aDesiredSize, |
47 | | const ReflowInput& aReflowInput, |
48 | | nsReflowStatus& aStatus) override; |
49 | | |
50 | | virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
51 | | const nsDisplayListSet& aLists) override; |
52 | | |
53 | | virtual bool IsFrameOfType(uint32_t aFlags) const override |
54 | 0 | { |
55 | 0 | if (aFlags & eSupportsContainLayoutAndPaint) { |
56 | 0 | return false; |
57 | 0 | } |
58 | 0 | |
59 | 0 | return nsContainerFrame::IsFrameOfType(aFlags & |
60 | 0 | ~(nsIFrame::eSVG | nsIFrame::eSVGForeignObject)); |
61 | 0 | } |
62 | | |
63 | | virtual bool IsSVGTransformed(Matrix *aOwnTransform, |
64 | | Matrix *aFromParentTransform) const override; |
65 | | |
66 | | #ifdef DEBUG_FRAME_DUMP |
67 | | virtual nsresult GetFrameName(nsAString& aResult) const override |
68 | | { |
69 | | return MakeFrameName(NS_LITERAL_STRING("SVGForeignObject"), aResult); |
70 | | } |
71 | | #endif |
72 | | |
73 | | // nsSVGDisplayableFrame interface: |
74 | | virtual void PaintSVG(gfxContext& aContext, |
75 | | const gfxMatrix& aTransform, |
76 | | imgDrawingParams& aImgParams, |
77 | | const nsIntRect* aDirtyRect = nullptr) override; |
78 | | virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override; |
79 | | virtual void ReflowSVG() override; |
80 | | virtual void NotifySVGChanged(uint32_t aFlags) override; |
81 | | virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace, |
82 | | uint32_t aFlags) override; |
83 | 0 | virtual bool IsDisplayContainer() override { return true; } |
84 | | |
85 | | gfxMatrix GetCanvasTM(); |
86 | | |
87 | | nsRect GetInvalidRegion(); |
88 | | |
89 | | // Return our ::-moz-svg-foreign-content anonymous box. |
90 | | void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override; |
91 | | |
92 | | protected: |
93 | | // implementation helpers: |
94 | | void DoReflow(); |
95 | | void RequestReflow(nsIPresShell::IntrinsicDirty aType); |
96 | | |
97 | | // If width or height is less than or equal to zero we must disable rendering |
98 | 0 | bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; } |
99 | | |
100 | | nsAutoPtr<gfxMatrix> mCanvasTM; |
101 | | |
102 | | bool mInReflow; |
103 | | }; |
104 | | |
105 | | #endif |