tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsMathMLmunderoverFrame.h (3046B)


      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/. */
      6 
      7 #ifndef nsMathMLmunderoverFrame_h___
      8 #define nsMathMLmunderoverFrame_h___
      9 
     10 #include "nsIReflowCallback.h"
     11 #include "nsMathMLContainerFrame.h"
     12 
     13 namespace mozilla {
     14 class PresShell;
     15 }  // namespace mozilla
     16 
     17 //
     18 // <munderover> -- attach an underscript-overscript pair to a base
     19 //
     20 
     21 class nsMathMLmunderoverFrame final : public nsMathMLContainerFrame,
     22                                      public nsIReflowCallback {
     23 public:
     24  NS_DECL_FRAMEARENA_HELPERS(nsMathMLmunderoverFrame)
     25 
     26  friend nsIFrame* NS_NewMathMLmunderoverFrame(mozilla::PresShell* aPresShell,
     27                                               ComputedStyle* aStyle);
     28 
     29  void Place(DrawTarget* aDrawTarget, const PlaceFlags& aFlags,
     30             ReflowOutput& aDesiredSize) override;
     31 
     32  NS_IMETHOD InheritAutomaticData(nsIFrame* aParent) override;
     33 
     34  NS_IMETHOD TransmitAutomaticData() override;
     35 
     36  NS_IMETHOD UpdatePresentationData(
     37      MathMLPresentationFlags aFlagsValues,
     38      MathMLPresentationFlags aFlagsToUpdate) override;
     39 
     40  void Destroy(DestroyContext&) override;
     41 
     42  nsresult AttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute,
     43                            AttrModType aModType) override;
     44 
     45  uint8_t ScriptIncrement(nsIFrame* aFrame) override;
     46 
     47  // nsIReflowCallback.
     48  bool ReflowFinished() override;
     49  void ReflowCallbackCanceled() override;
     50 
     51 protected:
     52  explicit nsMathMLmunderoverFrame(ComputedStyle* aStyle,
     53                                   nsPresContext* aPresContext)
     54      : nsMathMLContainerFrame(aStyle, aPresContext, kClassID),
     55        mIncrementUnder(false),
     56        mIncrementOver(false) {}
     57 
     58  virtual ~nsMathMLmunderoverFrame();
     59 
     60 private:
     61  bool IsMathContentBoxHorizontallyCentered() const final;
     62 
     63  // Helper to set the "increment script level" flag on the element belonging
     64  // to a child frame given by aChildIndex.
     65  //
     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).
     69  //
     70  // This should be called during reflow.
     71  //
     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();
     77 
     78  bool mIncrementUnder;
     79  bool mIncrementOver;
     80 
     81  struct SetIncrementScriptLevelCommand {
     82    uint32_t mChildIndex;
     83    bool mDoIncrement;
     84  };
     85 
     86  nsTArray<SetIncrementScriptLevelCommand>
     87      mPostReflowIncrementScriptLevelCommands;
     88 };
     89 
     90 #endif /* nsMathMLmunderoverFrame_h___ */