nsMathMLmspaceFrame.h (1994B)
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 nsMathMLmspaceFrame_h___ 8 #define nsMathMLmspaceFrame_h___ 9 10 #include "nsCSSValue.h" 11 #include "nsMathMLContainerFrame.h" 12 13 namespace mozilla { 14 class PresShell; 15 } // namespace mozilla 16 17 // 18 // <mspace> -- space 19 // 20 21 class nsMathMLmspaceFrame final : public nsMathMLContainerFrame { 22 public: 23 NS_DECL_FRAMEARENA_HELPERS(nsMathMLmspaceFrame) 24 25 friend nsIFrame* NS_NewMathMLmspaceFrame(mozilla::PresShell* aPresShell, 26 ComputedStyle* aStyle); 27 28 NS_IMETHOD 29 TransmitAutomaticData() override { 30 // The REC defines the following elements to be space-like: 31 // * an mtext, mspace, maligngroup, or malignmark element; 32 mPresentationData.flags += MathMLPresentationFlag::SpaceLike; 33 return NS_OK; 34 } 35 36 protected: 37 explicit nsMathMLmspaceFrame(ComputedStyle* aStyle, 38 nsPresContext* aPresContext) 39 : nsMathMLContainerFrame(aStyle, aPresContext, kClassID) {} 40 virtual ~nsMathMLmspaceFrame(); 41 42 private: 43 struct Attribute { 44 nsCSSValue mValue; 45 enum class ParsingState : uint8_t { 46 Valid, 47 Invalid, 48 Dirty, 49 }; 50 ParsingState mState = ParsingState::Dirty; 51 }; 52 Attribute mWidth; 53 Attribute mHeight; 54 Attribute mDepth; 55 56 nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute, 57 AttrModType aModType) final; 58 nscoord CalculateAttributeValue(nsAtom* aAtom, Attribute& aAttribute, 59 uint32_t aFlags, float aFontSizeInflation); 60 void Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags, 61 ReflowOutput& aDesiredSize) final; 62 }; 63 64 #endif /* nsMathMLmspaceFrame_h___ */