Bug 1913515 - Add a helper to return the inner frame of nsTableCellFrame. r=layout...
[gecko.git] / layout / mathml / nsMathMLmpaddedFrame.h
blob268c45c420ff10ecdbc5cf16b9632edef9232837
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/. */
7 #ifndef nsMathMLmpaddedFrame_h___
8 #define nsMathMLmpaddedFrame_h___
10 #include "mozilla/Attributes.h"
11 #include "nsCSSValue.h"
12 #include "nsMathMLContainerFrame.h"
14 namespace mozilla {
15 class PresShell;
16 } // namespace mozilla
19 // <mpadded> -- adjust space around content
22 class nsMathMLmpaddedFrame final : public nsMathMLContainerFrame {
23 public:
24 NS_DECL_FRAMEARENA_HELPERS(nsMathMLmpaddedFrame)
26 friend nsIFrame* NS_NewMathMLmpaddedFrame(mozilla::PresShell* aPresShell,
27 ComputedStyle* aStyle);
29 NS_IMETHOD
30 InheritAutomaticData(nsIFrame* aParent) override;
32 NS_IMETHOD
33 TransmitAutomaticData() override {
34 return TransmitAutomaticDataForMrowLikeElement();
37 virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
38 const ReflowInput& aReflowInput,
39 nsReflowStatus& aStatus) override;
41 nsresult Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
42 ReflowOutput& aDesiredSize) override;
44 bool IsMrowLike() override {
45 return mFrames.FirstChild() != mFrames.LastChild() || !mFrames.FirstChild();
48 protected:
49 explicit nsMathMLmpaddedFrame(ComputedStyle* aStyle,
50 nsPresContext* aPresContext)
51 : nsMathMLContainerFrame(aStyle, aPresContext, kClassID),
52 mWidthSign(0),
53 mHeightSign(0),
54 mDepthSign(0),
55 mLeadingSpaceSign(0),
56 mVerticalOffsetSign(0),
57 mWidthPseudoUnit(0),
58 mHeightPseudoUnit(0),
59 mDepthPseudoUnit(0),
60 mLeadingSpacePseudoUnit(0),
61 mVerticalOffsetPseudoUnit(0) {}
63 virtual ~nsMathMLmpaddedFrame();
65 virtual nsresult MeasureForWidth(DrawTarget* aDrawTarget,
66 ReflowOutput& aDesiredSize) override;
68 private:
69 nsCSSValue mWidth;
70 nsCSSValue mHeight;
71 nsCSSValue mDepth;
72 nsCSSValue mLeadingSpace;
73 nsCSSValue mVerticalOffset;
75 int32_t mWidthSign;
76 int32_t mHeightSign;
77 int32_t mDepthSign;
78 int32_t mLeadingSpaceSign;
79 int32_t mVerticalOffsetSign;
81 int32_t mWidthPseudoUnit;
82 int32_t mHeightPseudoUnit;
83 int32_t mDepthPseudoUnit;
84 int32_t mLeadingSpacePseudoUnit;
85 int32_t mVerticalOffsetPseudoUnit;
87 // helpers to process the attributes
88 void ProcessAttributes();
90 bool ParseAttribute(nsString& aString, int32_t& aSign, nsCSSValue& aCSSValue,
91 int32_t& aPseudoUnit);
93 void UpdateValue(int32_t aSign, int32_t aPseudoUnit,
94 const nsCSSValue& aCSSValue,
95 const ReflowOutput& aDesiredSize, nscoord& aValueToUpdate,
96 float aFontSizeInflation) const;
99 #endif /* nsMathMLmpaddedFrame_h___ */