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 "nsContainerFrame.h" 13 #include "RubyUtils.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 // nsIFrame overrides 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 virtual mozilla::LogicalSize ComputeSize( 39 gfxContext* aRenderingContext, mozilla::WritingMode aWritingMode, 40 const mozilla::LogicalSize& aCBSize, nscoord aAvailableISize, 41 const mozilla::LogicalSize& aMargin, const mozilla::LogicalSize& aBorder, 42 const mozilla::LogicalSize& aPadding, ComputeSizeFlags aFlags) override; 43 virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aDesiredSize, 44 const ReflowInput& aReflowInput, 45 nsReflowStatus& aStatus) override; 46 47 virtual nscoord GetLogicalBaseline( 48 mozilla::WritingMode aWritingMode) const override; 49 50 #ifdef DEBUG_FRAME_DUMP 51 virtual nsresult GetFrameName(nsAString& aResult) const override; 52 #endif 53 UpdateDescendantLeadings(const mozilla::RubyBlockLeadings & aLeadings)54 void UpdateDescendantLeadings(const mozilla::RubyBlockLeadings& aLeadings) { 55 mDescendantLeadings.Update(aLeadings); 56 } GetDescendantLeadings()57 mozilla::RubyBlockLeadings GetDescendantLeadings() const { 58 return mDescendantLeadings; 59 } 60 61 protected: 62 friend nsContainerFrame* NS_NewRubyBaseContainerFrame( 63 mozilla::PresShell* aPresShell, ComputedStyle* aStyle); 64 nsRubyBaseContainerFrame(ComputedStyle * aStyle,nsPresContext * aPresContext)65 explicit nsRubyBaseContainerFrame(ComputedStyle* aStyle, 66 nsPresContext* aPresContext) 67 : nsContainerFrame(aStyle, aPresContext, kClassID) {} 68 69 struct RubyReflowInput; 70 nscoord ReflowColumns(const RubyReflowInput& aReflowInput, 71 ReflowOutput& aDesiredSize, nsReflowStatus& aStatus); 72 nscoord ReflowOneColumn(const RubyReflowInput& aReflowInput, 73 uint32_t aColumnIndex, 74 const mozilla::RubyColumn& aColumn, 75 ReflowOutput& aDesiredSize, nsReflowStatus& aStatus); 76 nscoord ReflowSpans(const RubyReflowInput& aReflowInput); 77 78 struct PullFrameState; 79 80 // Pull ruby base and corresponding ruby text frames from 81 // continuations after them. 82 void PullOneColumn(nsLineLayout* aLineLayout, PullFrameState& aPullFrameState, 83 mozilla::RubyColumn& aColumn, bool& aIsComplete); 84 85 nscoord mBaseline; 86 87 // Leading produced by descendant ruby annotations. 88 mozilla::RubyBlockLeadings mDescendantLeadings; 89 }; 90 91 #endif /* nsRubyBaseContainerFrame_h___ */ 92