nsMathMLTokenFrame.h (2252B)
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 nsMathMLTokenFrame_h___ 8 #define nsMathMLTokenFrame_h___ 9 10 #include "nsMathMLContainerFrame.h" 11 12 namespace mozilla { 13 class PresShell; 14 } // namespace mozilla 15 16 // 17 // Base class to handle token elements 18 // 19 20 class nsMathMLTokenFrame : public nsMathMLContainerFrame { 21 public: 22 NS_DECL_FRAMEARENA_HELPERS(nsMathMLTokenFrame) 23 24 friend nsIFrame* NS_NewMathMLTokenFrame(mozilla::PresShell* aPresShell, 25 ComputedStyle* aStyle); 26 27 NS_IMETHOD 28 TransmitAutomaticData() override { 29 // The REC defines the following elements to be space-like: 30 // * an mtext, mspace, maligngroup, or malignmark element; 31 if (mContent->IsMathMLElement(nsGkAtoms::mtext)) { 32 mPresentationData.flags += MathMLPresentationFlag::SpaceLike; 33 } 34 return NS_OK; 35 } 36 37 NS_IMETHOD 38 InheritAutomaticData(nsIFrame* aParent) override; 39 40 MathMLFrameType GetMathMLFrameType() override; 41 42 void SetInitialChildList(ChildListID aListID, 43 nsFrameList&& aChildList) override; 44 45 void AppendFrames(ChildListID aListID, nsFrameList&& aChildList) override; 46 47 void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame, 48 const nsLineList::iterator* aPrevFrameLine, 49 nsFrameList&& aChildList) override; 50 51 void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, 52 const ReflowInput& aReflowInput, 53 nsReflowStatus& aStatus) override; 54 55 void Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags, 56 ReflowOutput& aDesiredSize) override; 57 58 protected: 59 explicit nsMathMLTokenFrame(ComputedStyle* aStyle, 60 nsPresContext* aPresContext, 61 ClassID aID = kClassID) 62 : nsMathMLContainerFrame(aStyle, aPresContext, aID) {} 63 virtual ~nsMathMLTokenFrame(); 64 65 void MarkTextFramesAsTokenMathML(); 66 }; 67 68 #endif /* nsMathMLTokentFrame_h___ */