Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=2 et sw=2 tw=80: */
3 : /* This Source Code is subject to the terms of the Mozilla Public License
4 : * version 2.0 (the "License"). You can obtain a copy of the License at
5 : * 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 "nsContainerFrame.h"
13 : #include "RubyUtils.h"
14 :
15 : /**
16 : * Factory function.
17 : * @return a newly allocated nsRubyBaseContainerFrame (infallible)
18 : */
19 : nsContainerFrame* NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
20 : nsStyleContext* aContext);
21 :
22 0 : class nsRubyBaseContainerFrame final : public nsContainerFrame
23 : {
24 : public:
25 0 : NS_DECL_FRAMEARENA_HELPERS(nsRubyBaseContainerFrame)
26 : NS_DECL_QUERYFRAME
27 :
28 : // nsIFrame overrides
29 : virtual bool IsFrameOfType(uint32_t aFlags) const override;
30 : virtual bool CanContinueTextRun() const override;
31 : virtual void AddInlineMinISize(gfxContext *aRenderingContext,
32 : InlineMinISizeData *aData) override;
33 : virtual void AddInlinePrefISize(gfxContext *aRenderingContext,
34 : InlinePrefISizeData *aData) override;
35 : virtual mozilla::LogicalSize
36 : ComputeSize(gfxContext *aRenderingContext,
37 : mozilla::WritingMode aWritingMode,
38 : const mozilla::LogicalSize& aCBSize,
39 : nscoord aAvailableISize,
40 : const mozilla::LogicalSize& aMargin,
41 : const mozilla::LogicalSize& aBorder,
42 : const mozilla::LogicalSize& aPadding,
43 : ComputeSizeFlags aFlags) override;
44 : virtual void Reflow(nsPresContext* aPresContext,
45 : ReflowOutput& aDesiredSize,
46 : const ReflowInput& aReflowInput,
47 : nsReflowStatus& aStatus) override;
48 :
49 : virtual nscoord
50 : GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
51 :
52 : #ifdef DEBUG_FRAME_DUMP
53 : virtual nsresult GetFrameName(nsAString& aResult) const override;
54 : #endif
55 :
56 0 : void UpdateDescendantLeadings(const mozilla::RubyBlockLeadings& aLeadings) {
57 0 : mDescendantLeadings.Update(aLeadings);
58 0 : }
59 0 : mozilla::RubyBlockLeadings GetDescendantLeadings() const {
60 0 : return mDescendantLeadings;
61 : }
62 :
63 : protected:
64 : friend nsContainerFrame*
65 : NS_NewRubyBaseContainerFrame(nsIPresShell* aPresShell,
66 : nsStyleContext* aContext);
67 :
68 0 : explicit nsRubyBaseContainerFrame(nsStyleContext* aContext)
69 0 : : nsContainerFrame(aContext, kClassID)
70 0 : {}
71 :
72 : struct RubyReflowInput;
73 : nscoord ReflowColumns(const RubyReflowInput& aReflowInput,
74 : nsReflowStatus& aStatus);
75 : nscoord ReflowOneColumn(const RubyReflowInput& aReflowInput,
76 : uint32_t aColumnIndex,
77 : const mozilla::RubyColumn& aColumn,
78 : nsReflowStatus& aStatus);
79 : nscoord ReflowSpans(const RubyReflowInput& aReflowInput);
80 :
81 : struct PullFrameState;
82 :
83 : // Pull ruby base and corresponding ruby text frames from
84 : // continuations after them.
85 : void PullOneColumn(nsLineLayout* aLineLayout,
86 : PullFrameState& aPullFrameState,
87 : mozilla::RubyColumn& aColumn,
88 : bool& aIsComplete);
89 :
90 : nscoord mBaseline;
91 :
92 : // Leading produced by descendant ruby annotations.
93 : mozilla::RubyBlockLeadings mDescendantLeadings;
94 : };
95 :
96 : #endif /* nsRubyBaseContainerFrame_h___ */
|