Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsMathMLmoFrame_h___ |
michael@0 | 7 | #define nsMathMLmoFrame_h___ |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/Attributes.h" |
michael@0 | 10 | #include "nsMathMLTokenFrame.h" |
michael@0 | 11 | #include "nsMathMLChar.h" |
michael@0 | 12 | |
michael@0 | 13 | // |
michael@0 | 14 | // <mo> -- operator, fence, or separator |
michael@0 | 15 | // |
michael@0 | 16 | |
michael@0 | 17 | class nsMathMLmoFrame : public nsMathMLTokenFrame { |
michael@0 | 18 | public: |
michael@0 | 19 | NS_DECL_FRAMEARENA_HELPERS |
michael@0 | 20 | |
michael@0 | 21 | friend nsIFrame* NS_NewMathMLmoFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
michael@0 | 22 | |
michael@0 | 23 | virtual eMathMLFrameType GetMathMLFrameType() MOZ_OVERRIDE; |
michael@0 | 24 | |
michael@0 | 25 | virtual void |
michael@0 | 26 | SetAdditionalStyleContext(int32_t aIndex, |
michael@0 | 27 | nsStyleContext* aStyleContext) MOZ_OVERRIDE; |
michael@0 | 28 | virtual nsStyleContext* |
michael@0 | 29 | GetAdditionalStyleContext(int32_t aIndex) const MOZ_OVERRIDE; |
michael@0 | 30 | |
michael@0 | 31 | virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
michael@0 | 32 | const nsRect& aDirtyRect, |
michael@0 | 33 | const nsDisplayListSet& aLists) MOZ_OVERRIDE; |
michael@0 | 34 | |
michael@0 | 35 | NS_IMETHOD |
michael@0 | 36 | InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE; |
michael@0 | 37 | |
michael@0 | 38 | NS_IMETHOD |
michael@0 | 39 | TransmitAutomaticData() MOZ_OVERRIDE; |
michael@0 | 40 | |
michael@0 | 41 | virtual nsresult |
michael@0 | 42 | SetInitialChildList(ChildListID aListID, |
michael@0 | 43 | nsFrameList& aChildList) MOZ_OVERRIDE; |
michael@0 | 44 | |
michael@0 | 45 | virtual nsresult |
michael@0 | 46 | Reflow(nsPresContext* aPresContext, |
michael@0 | 47 | nsHTMLReflowMetrics& aDesiredSize, |
michael@0 | 48 | const nsHTMLReflowState& aReflowState, |
michael@0 | 49 | nsReflowStatus& aStatus) MOZ_OVERRIDE; |
michael@0 | 50 | |
michael@0 | 51 | virtual void MarkIntrinsicWidthsDirty() MOZ_OVERRIDE; |
michael@0 | 52 | |
michael@0 | 53 | virtual void |
michael@0 | 54 | GetIntrinsicWidthMetrics(nsRenderingContext* aRenderingContext, |
michael@0 | 55 | nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; |
michael@0 | 56 | |
michael@0 | 57 | virtual nsresult |
michael@0 | 58 | AttributeChanged(int32_t aNameSpaceID, |
michael@0 | 59 | nsIAtom* aAttribute, |
michael@0 | 60 | int32_t aModType) MOZ_OVERRIDE; |
michael@0 | 61 | |
michael@0 | 62 | // This method is called by the parent frame to ask <mo> |
michael@0 | 63 | // to stretch itself. |
michael@0 | 64 | NS_IMETHOD |
michael@0 | 65 | Stretch(nsRenderingContext& aRenderingContext, |
michael@0 | 66 | nsStretchDirection aStretchDirection, |
michael@0 | 67 | nsBoundingMetrics& aContainerSize, |
michael@0 | 68 | nsHTMLReflowMetrics& aDesiredStretchSize) MOZ_OVERRIDE; |
michael@0 | 69 | |
michael@0 | 70 | virtual nsresult |
michael@0 | 71 | ChildListChanged(int32_t aModType) MOZ_OVERRIDE |
michael@0 | 72 | { |
michael@0 | 73 | ProcessTextData(); |
michael@0 | 74 | return nsMathMLContainerFrame::ChildListChanged(aModType); |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | protected: |
michael@0 | 78 | nsMathMLmoFrame(nsStyleContext* aContext) : nsMathMLTokenFrame(aContext) {} |
michael@0 | 79 | virtual ~nsMathMLmoFrame(); |
michael@0 | 80 | |
michael@0 | 81 | nsMathMLChar mMathMLChar; // Here is the MathMLChar that will deal with the operator. |
michael@0 | 82 | nsOperatorFlags mFlags; |
michael@0 | 83 | float mMinSize; |
michael@0 | 84 | float mMaxSize; |
michael@0 | 85 | |
michael@0 | 86 | bool UseMathMLChar(); |
michael@0 | 87 | |
michael@0 | 88 | // overload the base method so that we can setup our nsMathMLChar |
michael@0 | 89 | void ProcessTextData(); |
michael@0 | 90 | |
michael@0 | 91 | // helper to get our 'form' and lookup in the Operator Dictionary to fetch |
michael@0 | 92 | // our default data that may come from there, and to complete the setup |
michael@0 | 93 | // using attributes that we may have |
michael@0 | 94 | void |
michael@0 | 95 | ProcessOperatorData(); |
michael@0 | 96 | |
michael@0 | 97 | // helper to double check thar our char should be rendered as a selected char |
michael@0 | 98 | bool |
michael@0 | 99 | IsFrameInSelection(nsIFrame* aFrame); |
michael@0 | 100 | }; |
michael@0 | 101 | |
michael@0 | 102 | #endif /* nsMathMLmoFrame_h___ */ |