nsMathMLmoFrame.h (3164B)
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 nsMathMLmoFrame_h___ 8 #define nsMathMLmoFrame_h___ 9 10 #include "nsMathMLChar.h" 11 #include "nsMathMLTokenFrame.h" 12 13 namespace mozilla { 14 class PresShell; 15 } // namespace mozilla 16 17 // 18 // <mo> -- operator, fence, or separator 19 // 20 21 class nsMathMLmoFrame final : public nsMathMLTokenFrame { 22 public: 23 NS_DECL_FRAMEARENA_HELPERS(nsMathMLmoFrame) 24 25 friend nsIFrame* NS_NewMathMLmoFrame(mozilla::PresShell* aPresShell, 26 ComputedStyle* aStyle); 27 28 MathMLFrameType GetMathMLFrameType() override; 29 30 void DidSetComputedStyle(ComputedStyle* aOldStyle) override; 31 32 void BuildDisplayList(nsDisplayListBuilder* aBuilder, 33 const nsDisplayListSet& aLists) override; 34 35 NS_IMETHOD 36 InheritAutomaticData(nsIFrame* aParent) override; 37 38 NS_IMETHOD 39 TransmitAutomaticData() override; 40 41 void SetInitialChildList(ChildListID aListID, 42 nsFrameList&& aChildList) override; 43 44 void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, 45 const ReflowInput& aReflowInput, 46 nsReflowStatus& aStatus) override; 47 48 void Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags, 49 ReflowOutput& aDesiredSize) override; 50 51 void MarkIntrinsicISizesDirty() override; 52 53 void GetIntrinsicISizeMetrics(gfxContext* aRenderingContext, 54 ReflowOutput& aDesiredSize) override; 55 56 nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute, 57 AttrModType aModType) override; 58 59 // This method is called by the parent frame to ask <mo> 60 // to stretch itself. 61 NS_IMETHOD 62 Stretch(DrawTarget* aDrawTarget, nsStretchDirection aStretchDirection, 63 nsBoundingMetrics& aContainerSize, 64 ReflowOutput& aDesiredStretchSize) override; 65 66 nsresult ChildListChanged() override { 67 ProcessTextData(); 68 return nsMathMLContainerFrame::ChildListChanged(); 69 } 70 71 protected: 72 explicit nsMathMLmoFrame(ComputedStyle* aStyle, nsPresContext* aPresContext) 73 : nsMathMLTokenFrame(aStyle, aPresContext, kClassID), 74 mFlags(0), 75 mMinSize(0), 76 mMaxSize(0) {} 77 virtual ~nsMathMLmoFrame(); 78 79 nsMathMLChar 80 mMathMLChar; // Here is the MathMLChar that will deal with the operator. 81 nsOperatorFlags mFlags; 82 float mMinSize; 83 float mMaxSize; 84 85 bool UseMathMLChar(); 86 87 // overload the base method so that we can setup our nsMathMLChar 88 void ProcessTextData(); 89 90 // helper to get our 'form' and lookup in the Operator Dictionary to fetch 91 // our default data that may come from there, and to complete the setup 92 // using attributes that we may have 93 void ProcessOperatorData(); 94 95 // helper to double check thar our char should be rendered as a selected char 96 bool IsFrameInSelection(nsIFrame* aFrame); 97 }; 98 99 #endif /* nsMathMLmoFrame_h___ */