Line data Source code
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 nsMathMLmunderoverFrame_h___
7 : #define nsMathMLmunderoverFrame_h___
8 :
9 : #include "mozilla/Attributes.h"
10 : #include "nsIReflowCallback.h"
11 : #include "nsMathMLContainerFrame.h"
12 :
13 : //
14 : // <munderover> -- attach an underscript-overscript pair to a base
15 : //
16 :
17 : class nsMathMLmunderoverFrame final
18 : : public nsMathMLContainerFrame
19 : , public nsIReflowCallback
20 : {
21 :
22 : public:
23 0 : NS_DECL_FRAMEARENA_HELPERS(nsMathMLmunderoverFrame)
24 :
25 : friend nsIFrame* NS_NewMathMLmunderoverFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
26 :
27 : nsresult Place(DrawTarget* aDrawTarget,
28 : bool aPlaceOrigin,
29 : ReflowOutput& aDesiredSize) override;
30 :
31 : NS_IMETHOD InheritAutomaticData(nsIFrame* aParent) override;
32 :
33 : NS_IMETHOD TransmitAutomaticData() override;
34 :
35 : NS_IMETHOD UpdatePresentationData(uint32_t aFlagsValues,
36 : uint32_t aFlagsToUpdate) override;
37 :
38 : void DestroyFrom(nsIFrame* aRoot) override;
39 :
40 : nsresult AttributeChanged(int32_t aNameSpaceID,
41 : nsIAtom* aAttribute,
42 : int32_t aModType) override;
43 :
44 : uint8_t ScriptIncrement(nsIFrame* aFrame) override;
45 :
46 : // nsIReflowCallback.
47 : bool ReflowFinished() override;
48 : void ReflowCallbackCanceled() override;
49 :
50 : protected:
51 0 : explicit nsMathMLmunderoverFrame(nsStyleContext* aContext)
52 0 : : nsMathMLContainerFrame(aContext, kClassID)
53 : , mIncrementUnder(false)
54 0 : , mIncrementOver(false)
55 0 : {}
56 :
57 : virtual ~nsMathMLmunderoverFrame();
58 :
59 : private:
60 : // Helper to set the "increment script level" flag on the element belonging
61 : // to a child frame given by aChildIndex.
62 : //
63 : // When this flag is set, the style system will increment the scriptlevel for
64 : // the child element. This is needed for situations where the style system
65 : // cannot itself determine the scriptlevel (mfrac, munder, mover, munderover).
66 : //
67 : // This should be called during reflow.
68 : //
69 : // We set the flag and if it changed, we request appropriate restyling and
70 : // also queue a post-reflow callback to ensure that restyle and reflow happens
71 : // immediately after the current reflow.
72 : void SetIncrementScriptLevel(uint32_t aChildIndex, bool aIncrement);
73 : void SetPendingPostReflowIncrementScriptLevel();
74 :
75 : bool mIncrementUnder;
76 : bool mIncrementOver;
77 :
78 : struct SetIncrementScriptLevelCommand
79 : {
80 : uint32_t mChildIndex;
81 : bool mDoIncrement;
82 : };
83 :
84 : nsTArray<SetIncrementScriptLevelCommand>
85 : mPostReflowIncrementScriptLevelCommands;
86 : };
87 :
88 :
89 : #endif /* nsMathMLmunderoverFrame_h___ */
|