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 /* rendering object for CSS "display: ruby-base-container" */
9 #ifndef nsRubyBaseContainerFrame_h___
10 #define nsRubyBaseContainerFrame_h___
12 #include "nsContainerFrame.h"
13 #include "RubyUtils.h"
17 } // namespace mozilla
21 * @return a newly allocated nsRubyBaseContainerFrame (infallible)
23 nsContainerFrame
* NS_NewRubyBaseContainerFrame(mozilla::PresShell
* aPresShell
,
24 mozilla::ComputedStyle
* aStyle
);
26 class nsRubyBaseContainerFrame final
: public nsContainerFrame
{
28 NS_DECL_FRAMEARENA_HELPERS(nsRubyBaseContainerFrame
)
32 virtual bool IsFrameOfType(uint32_t aFlags
) const override
;
33 virtual bool CanContinueTextRun() const override
;
34 virtual void AddInlineMinISize(gfxContext
* aRenderingContext
,
35 InlineMinISizeData
* aData
) override
;
36 virtual void AddInlinePrefISize(gfxContext
* aRenderingContext
,
37 InlinePrefISizeData
* aData
) override
;
38 SizeComputationResult
ComputeSize(
39 gfxContext
* aRenderingContext
, mozilla::WritingMode aWM
,
40 const mozilla::LogicalSize
& aCBSize
, nscoord aAvailableISize
,
41 const mozilla::LogicalSize
& aMargin
,
42 const mozilla::LogicalSize
& aBorderPadding
,
43 const mozilla::StyleSizeOverrides
& aSizeOverrides
,
44 mozilla::ComputeSizeFlags aFlags
) override
;
45 virtual void Reflow(nsPresContext
* aPresContext
, ReflowOutput
& aDesiredSize
,
46 const ReflowInput
& aReflowInput
,
47 nsReflowStatus
& aStatus
) override
;
49 Maybe
<nscoord
> GetNaturalBaselineBOffset(
50 mozilla::WritingMode aWM
, BaselineSharingGroup aBaselineGroup
,
51 BaselineExportContext
) const override
;
53 #ifdef DEBUG_FRAME_DUMP
54 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
;
57 void UpdateDescendantLeadings(const mozilla::RubyBlockLeadings
& aLeadings
) {
58 mDescendantLeadings
.Update(aLeadings
);
60 mozilla::RubyBlockLeadings
GetDescendantLeadings() const {
61 return mDescendantLeadings
;
65 friend nsContainerFrame
* NS_NewRubyBaseContainerFrame(
66 mozilla::PresShell
* aPresShell
, ComputedStyle
* aStyle
);
68 explicit nsRubyBaseContainerFrame(ComputedStyle
* aStyle
,
69 nsPresContext
* aPresContext
)
70 : nsContainerFrame(aStyle
, aPresContext
, kClassID
) {}
72 struct RubyReflowInput
;
73 nscoord
ReflowColumns(const RubyReflowInput
& aReflowInput
,
74 ReflowOutput
& aDesiredSize
, nsReflowStatus
& aStatus
);
75 nscoord
ReflowOneColumn(const RubyReflowInput
& aReflowInput
,
76 uint32_t aColumnIndex
,
77 const mozilla::RubyColumn
& aColumn
,
78 ReflowOutput
& aDesiredSize
, nsReflowStatus
& aStatus
);
79 nscoord
ReflowSpans(const RubyReflowInput
& aReflowInput
);
81 struct PullFrameState
;
83 // Pull ruby base and corresponding ruby text frames from
84 // continuations after them.
85 void PullOneColumn(nsLineLayout
* aLineLayout
, PullFrameState
& aPullFrameState
,
86 mozilla::RubyColumn
& aColumn
, bool& aIsComplete
);
90 // Leading produced by descendant ruby annotations.
91 mozilla::RubyBlockLeadings mDescendantLeadings
;
94 #endif /* nsRubyBaseContainerFrame_h___ */