SVGUseFrame.h (1880B)
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 LAYOUT_SVG_SVGUSEFRAME_H_ 8 #define LAYOUT_SVG_SVGUSEFRAME_H_ 9 10 // Keep in (case-insensitive) order: 11 #include "SVGGFrame.h" 12 13 namespace mozilla { 14 class PresShell; 15 } // namespace mozilla 16 17 nsIFrame* NS_NewSVGUseFrame(mozilla::PresShell* aPresShell, 18 mozilla::ComputedStyle* aStyle); 19 20 namespace mozilla { 21 22 class SVGUseFrame final : public SVGGFrame { 23 friend nsIFrame* ::NS_NewSVGUseFrame(mozilla::PresShell* aPresShell, 24 ComputedStyle* aStyle); 25 26 protected: 27 explicit SVGUseFrame(ComputedStyle* aStyle, nsPresContext* aPresContext) 28 : SVGGFrame(aStyle, aPresContext, kClassID), mHasValidDimensions(true) {} 29 30 public: 31 NS_DECL_FRAMEARENA_HELPERS(SVGUseFrame) 32 33 // nsIFrame interface: 34 void Init(nsIContent* aContent, nsContainerFrame* aParent, 35 nsIFrame* aPrevInFlow) override; 36 37 // Called when the href attributes changed. 38 void HrefChanged(); 39 40 // Called when the width or height attributes changed. 41 void DimensionAttributeChanged(bool aHadValidDimensions, 42 bool aAttributeIsUsed); 43 44 void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override; 45 46 #ifdef DEBUG_FRAME_DUMP 47 nsresult GetFrameName(nsAString& aResult) const override { 48 return MakeFrameName(u"SVGUse"_ns, aResult); 49 } 50 #endif 51 52 // ISVGDisplayableFrame interface: 53 void ReflowSVG() override; 54 void NotifySVGChanged(ChangeFlags aFlags) override; 55 56 private: 57 bool mHasValidDimensions; 58 }; 59 60 } // namespace mozilla 61 62 #endif // LAYOUT_SVG_SVGUSEFRAME_H_