no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / layout / svg / SVGForeignObjectFrame.h
blobd2efa184bb683e43af9de53d0f42fe4f5909b8a7
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/. */
7 #ifndef LAYOUT_SVG_SVGFOREIGNOBJECTFRAME_H_
8 #define LAYOUT_SVG_SVGFOREIGNOBJECTFRAME_H_
10 #include "mozilla/Attributes.h"
11 #include "mozilla/ISVGDisplayableFrame.h"
12 #include "mozilla/PresShellForwards.h"
13 #include "mozilla/UniquePtr.h"
14 #include "nsContainerFrame.h"
16 class gfxContext;
18 nsContainerFrame* NS_NewSVGForeignObjectFrame(mozilla::PresShell* aPresShell,
19 mozilla::ComputedStyle* aStyle);
21 namespace mozilla {
23 class SVGForeignObjectFrame final : public nsContainerFrame,
24 public ISVGDisplayableFrame {
25 friend nsContainerFrame* ::NS_NewSVGForeignObjectFrame(
26 mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
28 protected:
29 explicit SVGForeignObjectFrame(ComputedStyle* aStyle,
30 nsPresContext* aPresContext);
32 public:
33 NS_DECL_QUERYFRAME
34 NS_DECL_FRAMEARENA_HELPERS(SVGForeignObjectFrame)
36 // nsIFrame:
37 void Init(nsIContent* aContent, nsContainerFrame* aParent,
38 nsIFrame* aPrevInFlow) override;
39 nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
40 int32_t aModType) override;
42 nsContainerFrame* GetContentInsertionFrame() override {
43 return PrincipalChildList().FirstChild()->GetContentInsertionFrame();
46 void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
47 const ReflowInput& aReflowInput,
48 nsReflowStatus& aStatus) override;
50 void BuildDisplayList(nsDisplayListBuilder* aBuilder,
51 const nsDisplayListSet& aLists) override;
53 bool IsSVGTransformed(Matrix* aOwnTransform,
54 Matrix* aFromParentTransform) const override;
56 #ifdef DEBUG_FRAME_DUMP
57 nsresult GetFrameName(nsAString& aResult) const override {
58 return MakeFrameName(u"SVGForeignObject"_ns, aResult);
60 #endif
62 // ISVGDisplayableFrame interface:
63 void PaintSVG(gfxContext& aContext, const gfxMatrix& aTransform,
64 imgDrawingParams& aImgParams) override;
65 nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
66 void ReflowSVG() override;
67 void NotifySVGChanged(uint32_t aFlags) override;
68 SVGBBox GetBBoxContribution(const Matrix& aToBBoxUserspace,
69 uint32_t aFlags) override;
70 bool IsDisplayContainer() override { return true; }
72 gfxMatrix GetCanvasTM();
74 // Return our ::-moz-svg-foreign-content anonymous box.
75 void AppendDirectlyOwnedAnonBoxes(nsTArray<OwnedAnonBox>& aResult) override;
77 void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
79 protected:
80 // implementation helpers:
81 void DoReflow();
82 void RequestReflow(IntrinsicDirty aType);
84 // If width or height is less than or equal to zero we must disable rendering
85 bool IsDisabled() const { return mRect.width <= 0 || mRect.height <= 0; }
87 UniquePtr<gfxMatrix> mCanvasTM;
90 } // namespace mozilla
92 #endif // LAYOUT_SVG_SVGFOREIGNOBJECTFRAME_H_