tor-browser

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

nsRubyTextContainerFrame.h (2979B)


      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 /* rendering object for CSS "display: ruby-text-container" */
      8 
      9 #ifndef nsRubyTextContainerFrame_h___
     10 #define nsRubyTextContainerFrame_h___
     11 
     12 #include "nsBlockFrame.h"
     13 
     14 namespace mozilla {
     15 class PresShell;
     16 }  // namespace mozilla
     17 
     18 /**
     19 * Factory function.
     20 * @return a newly allocated nsRubyTextContainerFrame (infallible)
     21 */
     22 nsContainerFrame* NS_NewRubyTextContainerFrame(mozilla::PresShell* aPresShell,
     23                                               mozilla::ComputedStyle* aStyle);
     24 
     25 class nsRubyTextContainerFrame final : public nsContainerFrame {
     26 public:
     27  NS_DECL_FRAMEARENA_HELPERS(nsRubyTextContainerFrame)
     28  NS_DECL_QUERYFRAME
     29 
     30  // nsIFrame overrides
     31  void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
     32              const ReflowInput& aReflowInput,
     33              nsReflowStatus& aStatus) override;
     34 
     35 #ifdef DEBUG_FRAME_DUMP
     36  nsresult GetFrameName(nsAString& aResult) const override;
     37 #endif
     38 
     39  // nsContainerFrame overrides
     40  void SetInitialChildList(ChildListID aListID,
     41                           nsFrameList&& aChildList) override;
     42  void AppendFrames(ChildListID aListID, nsFrameList&& aFrameList) override;
     43  void InsertFrames(ChildListID aListID, nsIFrame* aPrevFrame,
     44                    const nsLineList::iterator* aPrevFrameLine,
     45                    nsFrameList&& aFrameList) override;
     46  void RemoveFrame(DestroyContext&, ChildListID, nsIFrame*) override;
     47 
     48  bool IsSpanContainer() const {
     49    return HasAnyStateBits(NS_RUBY_TEXT_CONTAINER_IS_SPAN);
     50  }
     51 
     52  // For ruby text container frames, these values also include any block-axis
     53  // margin/border/padding that applies to the children, so that positioning
     54  // of the annotations will take these into account.
     55  // This relies on GetUsed{Margin,Border,Padding} of the children, so they
     56  // should be reflowed before querying the container's RubyMetrics.
     57  mozilla::RubyMetrics RubyMetrics(float aRubyMetricsFactor) const override;
     58 
     59 protected:
     60  friend nsContainerFrame* NS_NewRubyTextContainerFrame(
     61      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
     62 
     63  explicit nsRubyTextContainerFrame(ComputedStyle* aStyle,
     64                                    nsPresContext* aPresContext)
     65      : nsContainerFrame(aStyle, aPresContext, kClassID), mISize(0) {}
     66 
     67  void UpdateSpanFlag();
     68 
     69  friend class nsRubyBaseContainerFrame;
     70  void SetISize(nscoord aISize) { mISize = aISize; }
     71 
     72  // The intended inline size of the ruby text container. It is set by
     73  // the corresponding ruby base container when the segment is reflowed,
     74  // and used when the ruby text container is reflowed by its parent.
     75  nscoord mISize;
     76 };
     77 
     78 #endif /* nsRubyTextContainerFrame_h___ */