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 nsMathMLmunderoverFrame_h___
8 #define nsMathMLmunderoverFrame_h___
10 #include "mozilla/Attributes.h"
11 #include "nsIReflowCallback.h"
12 #include "nsMathMLContainerFrame.h"
16 } // namespace mozilla
19 // <munderover> -- attach an underscript-overscript pair to a base
22 class nsMathMLmunderoverFrame final
: public nsMathMLContainerFrame
,
23 public nsIReflowCallback
{
25 NS_DECL_FRAMEARENA_HELPERS(nsMathMLmunderoverFrame
)
27 friend nsIFrame
* NS_NewMathMLmunderoverFrame(mozilla::PresShell
* aPresShell
,
28 ComputedStyle
* aStyle
);
30 nsresult
Place(DrawTarget
* aDrawTarget
, const PlaceFlags
& aFlags
,
31 ReflowOutput
& aDesiredSize
) override
;
33 NS_IMETHOD
InheritAutomaticData(nsIFrame
* aParent
) override
;
35 NS_IMETHOD
TransmitAutomaticData() override
;
37 NS_IMETHOD
UpdatePresentationData(uint32_t aFlagsValues
,
38 uint32_t aFlagsToUpdate
) override
;
40 void Destroy(DestroyContext
&) override
;
42 nsresult
AttributeChanged(int32_t aNameSpaceID
, nsAtom
* aAttribute
,
43 int32_t aModType
) override
;
45 uint8_t ScriptIncrement(nsIFrame
* aFrame
) override
;
48 bool ReflowFinished() override
;
49 void ReflowCallbackCanceled() override
;
52 explicit nsMathMLmunderoverFrame(ComputedStyle
* aStyle
,
53 nsPresContext
* aPresContext
)
54 : nsMathMLContainerFrame(aStyle
, aPresContext
, kClassID
),
55 mIncrementUnder(false),
56 mIncrementOver(false) {}
58 virtual ~nsMathMLmunderoverFrame();
61 bool IsMathContentBoxHorizontallyCentered() const final
;
63 // Helper to set the "increment script level" flag on the element belonging
64 // to a child frame given by aChildIndex.
66 // When this flag is set, the style system will increment the scriptlevel for
67 // the child element. This is needed for situations where the style system
68 // cannot itself determine the scriptlevel (mfrac, munder, mover, munderover).
70 // This should be called during reflow.
72 // We set the flag and if it changed, we request appropriate restyling and
73 // also queue a post-reflow callback to ensure that restyle and reflow happens
74 // immediately after the current reflow.
75 void SetIncrementScriptLevel(uint32_t aChildIndex
, bool aIncrement
);
76 void SetPendingPostReflowIncrementScriptLevel();
81 struct SetIncrementScriptLevelCommand
{
86 nsTArray
<SetIncrementScriptLevelCommand
>
87 mPostReflowIncrementScriptLevelCommands
;
90 #endif /* nsMathMLmunderoverFrame_h___ */