tor-browser

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

nsRubyBaseContainerFrame.h (3739B)


      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-base-container" */
      8 
      9 #ifndef nsRubyBaseContainerFrame_h___
     10 #define nsRubyBaseContainerFrame_h___
     11 
     12 #include "RubyUtils.h"
     13 #include "nsContainerFrame.h"
     14 
     15 namespace mozilla {
     16 class PresShell;
     17 }  // namespace mozilla
     18 
     19 /**
     20 * Factory function.
     21 * @return a newly allocated nsRubyBaseContainerFrame (infallible)
     22 */
     23 nsContainerFrame* NS_NewRubyBaseContainerFrame(mozilla::PresShell* aPresShell,
     24                                               mozilla::ComputedStyle* aStyle);
     25 
     26 class nsRubyBaseContainerFrame final : public nsContainerFrame {
     27 public:
     28  NS_DECL_FRAMEARENA_HELPERS(nsRubyBaseContainerFrame)
     29  NS_DECL_QUERYFRAME
     30 
     31  bool CanContinueTextRun() const override;
     32  void AddInlineMinISize(const mozilla::IntrinsicSizeInput& aInput,
     33                         InlineMinISizeData* aData) override;
     34  void AddInlinePrefISize(const mozilla::IntrinsicSizeInput& aInput,
     35                          InlinePrefISizeData* aData) override;
     36  SizeComputationResult ComputeSize(
     37      const SizeComputationInput& aSizingInput, mozilla::WritingMode aWM,
     38      const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize,
     39      const mozilla::LogicalSize& aMargin,
     40      const mozilla::LogicalSize& aBorderPadding,
     41      const mozilla::StyleSizeOverrides& aSizeOverrides,
     42      mozilla::ComputeSizeFlags aFlags) override;
     43  void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize,
     44              const ReflowInput& aReflowInput,
     45              nsReflowStatus& aStatus) override;
     46 
     47  Maybe<nscoord> GetNaturalBaselineBOffset(
     48      mozilla::WritingMode aWM, BaselineSharingGroup aBaselineGroup,
     49      BaselineExportContext) const override;
     50 
     51 #ifdef DEBUG_FRAME_DUMP
     52  nsresult GetFrameName(nsAString& aResult) const override;
     53 #endif
     54 
     55  void UpdateDescendantLeadings(const mozilla::RubyBlockLeadings& aLeadings) {
     56    mDescendantLeadings.Update(aLeadings);
     57  }
     58  mozilla::RubyBlockLeadings GetDescendantLeadings() const {
     59    return mDescendantLeadings;
     60  }
     61 
     62  mozilla::RubyMetrics RubyMetrics(float aRubyMetricsFactor) const override {
     63    // provided by nsContainerFrame
     64    return RubyMetricsIncludingChildren(aRubyMetricsFactor);
     65  }
     66 
     67 protected:
     68  friend nsContainerFrame* NS_NewRubyBaseContainerFrame(
     69      mozilla::PresShell* aPresShell, ComputedStyle* aStyle);
     70 
     71  explicit nsRubyBaseContainerFrame(ComputedStyle* aStyle,
     72                                    nsPresContext* aPresContext)
     73      : nsContainerFrame(aStyle, aPresContext, kClassID) {}
     74 
     75  struct RubyReflowInput;
     76  nscoord ReflowColumns(const RubyReflowInput& aReflowInput,
     77                        ReflowOutput& aDesiredSize, nsReflowStatus& aStatus);
     78  nscoord ReflowOneColumn(const RubyReflowInput& aReflowInput,
     79                          uint32_t aColumnIndex,
     80                          const mozilla::RubyColumn& aColumn,
     81                          ReflowOutput& aDesiredSize, nsReflowStatus& aStatus);
     82  nscoord ReflowSpans(const RubyReflowInput& aReflowInput);
     83 
     84  struct PullFrameState;
     85 
     86  // Pull ruby base and corresponding ruby text frames from
     87  // continuations after them.
     88  void PullOneColumn(nsLineLayout* aLineLayout, PullFrameState& aPullFrameState,
     89                     mozilla::RubyColumn& aColumn, bool& aIsComplete);
     90 
     91  nscoord mBaseline;
     92 
     93  // Leading produced by descendant ruby annotations.
     94  mozilla::RubyBlockLeadings mDescendantLeadings;
     95 };
     96 
     97 #endif /* nsRubyBaseContainerFrame_h___ */