|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef nsMathMLmpaddedFrame_h___ |
|
7 #define nsMathMLmpaddedFrame_h___ |
|
8 |
|
9 #include "mozilla/Attributes.h" |
|
10 #include "nsMathMLContainerFrame.h" |
|
11 |
|
12 // |
|
13 // <mpadded> -- adjust space around content |
|
14 // |
|
15 |
|
16 class nsMathMLmpaddedFrame : public nsMathMLContainerFrame { |
|
17 public: |
|
18 NS_DECL_FRAMEARENA_HELPERS |
|
19 |
|
20 friend nsIFrame* NS_NewMathMLmpaddedFrame(nsIPresShell* aPresShell, nsStyleContext* aContext); |
|
21 |
|
22 NS_IMETHOD |
|
23 InheritAutomaticData(nsIFrame* aParent) MOZ_OVERRIDE; |
|
24 |
|
25 NS_IMETHOD |
|
26 TransmitAutomaticData() MOZ_OVERRIDE { |
|
27 return TransmitAutomaticDataForMrowLikeElement(); |
|
28 } |
|
29 |
|
30 virtual nsresult |
|
31 Reflow(nsPresContext* aPresContext, |
|
32 nsHTMLReflowMetrics& aDesiredSize, |
|
33 const nsHTMLReflowState& aReflowState, |
|
34 nsReflowStatus& aStatus) MOZ_OVERRIDE; |
|
35 |
|
36 virtual nsresult |
|
37 Place(nsRenderingContext& aRenderingContext, |
|
38 bool aPlaceOrigin, |
|
39 nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; |
|
40 |
|
41 bool |
|
42 IsMrowLike() MOZ_OVERRIDE { |
|
43 return mFrames.FirstChild() != mFrames.LastChild() || |
|
44 !mFrames.FirstChild(); |
|
45 } |
|
46 |
|
47 protected: |
|
48 nsMathMLmpaddedFrame(nsStyleContext* aContext) : nsMathMLContainerFrame(aContext) {} |
|
49 virtual ~nsMathMLmpaddedFrame(); |
|
50 |
|
51 virtual nsresult |
|
52 MeasureForWidth(nsRenderingContext& aRenderingContext, |
|
53 nsHTMLReflowMetrics& aDesiredSize) MOZ_OVERRIDE; |
|
54 |
|
55 private: |
|
56 nsCSSValue mWidth; |
|
57 nsCSSValue mHeight; |
|
58 nsCSSValue mDepth; |
|
59 nsCSSValue mLeadingSpace; |
|
60 nsCSSValue mVerticalOffset; |
|
61 |
|
62 int32_t mWidthSign; |
|
63 int32_t mHeightSign; |
|
64 int32_t mDepthSign; |
|
65 int32_t mLeadingSpaceSign; |
|
66 int32_t mVerticalOffsetSign; |
|
67 |
|
68 int32_t mWidthPseudoUnit; |
|
69 int32_t mHeightPseudoUnit; |
|
70 int32_t mDepthPseudoUnit; |
|
71 int32_t mLeadingSpacePseudoUnit; |
|
72 int32_t mVerticalOffsetPseudoUnit; |
|
73 |
|
74 // helpers to process the attributes |
|
75 void |
|
76 ProcessAttributes(); |
|
77 |
|
78 static bool |
|
79 ParseAttribute(nsString& aString, |
|
80 int32_t& aSign, |
|
81 nsCSSValue& aCSSValue, |
|
82 int32_t& aPseudoUnit); |
|
83 |
|
84 void |
|
85 UpdateValue(int32_t aSign, |
|
86 int32_t aPseudoUnit, |
|
87 const nsCSSValue& aCSSValue, |
|
88 const nsHTMLReflowMetrics& aDesiredSize, |
|
89 nscoord& aValueToUpdate) const; |
|
90 }; |
|
91 |
|
92 #endif /* nsMathMLmpaddedFrame_h___ */ |