Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #ifndef nsFirstLetterFrame_h__
7 : #define nsFirstLetterFrame_h__
8 :
9 : /* rendering object for CSS :first-letter pseudo-element */
10 :
11 : #include "mozilla/Attributes.h"
12 : #include "nsContainerFrame.h"
13 :
14 0 : class nsFirstLetterFrame final : public nsContainerFrame {
15 : public:
16 : NS_DECL_QUERYFRAME
17 0 : NS_DECL_FRAMEARENA_HELPERS(nsFirstLetterFrame)
18 :
19 0 : explicit nsFirstLetterFrame(nsStyleContext* aContext)
20 0 : : nsContainerFrame(aContext, kClassID)
21 0 : {}
22 :
23 : virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
24 : const nsRect& aDirtyRect,
25 : const nsDisplayListSet& aLists) override;
26 :
27 : virtual void Init(nsIContent* aContent,
28 : nsContainerFrame* aParent,
29 : nsIFrame* aPrevInFlow) override;
30 : virtual void SetInitialChildList(ChildListID aListID,
31 : nsFrameList& aChildList) override;
32 : #ifdef DEBUG_FRAME_DUMP
33 : virtual nsresult GetFrameName(nsAString& aResult) const override;
34 : #endif
35 :
36 0 : bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
37 :
38 0 : virtual bool IsFrameOfType(uint32_t aFlags) const override
39 : {
40 0 : if (!IsFloating())
41 0 : aFlags = aFlags & ~(nsIFrame::eLineParticipant);
42 0 : return nsContainerFrame::IsFrameOfType(aFlags &
43 0 : ~(nsIFrame::eBidiInlineContainer));
44 : }
45 :
46 : virtual nscoord GetMinISize(gfxContext *aRenderingContext) override;
47 : virtual nscoord GetPrefISize(gfxContext *aRenderingContext) override;
48 : virtual void AddInlineMinISize(gfxContext *aRenderingContext,
49 : InlineMinISizeData *aData) override;
50 : virtual void AddInlinePrefISize(gfxContext *aRenderingContext,
51 : InlinePrefISizeData *aData) override;
52 :
53 : virtual mozilla::LogicalSize
54 : ComputeSize(gfxContext *aRenderingContext,
55 : mozilla::WritingMode aWritingMode,
56 : const mozilla::LogicalSize& aCBSize,
57 : nscoord aAvailableISize,
58 : const mozilla::LogicalSize& aMargin,
59 : const mozilla::LogicalSize& aBorder,
60 : const mozilla::LogicalSize& aPadding,
61 : ComputeSizeFlags aFlags) override;
62 :
63 : virtual void Reflow(nsPresContext* aPresContext,
64 : ReflowOutput& aDesiredSize,
65 : const ReflowInput& aReflowInput,
66 : nsReflowStatus& aStatus) override;
67 :
68 : virtual bool CanContinueTextRun() const override;
69 : virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
70 : virtual LogicalSides GetLogicalSkipSides(const ReflowInput* aReflowInput = nullptr) const override;
71 :
72 : //override of nsFrame method
73 : virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset,
74 : bool inHint,
75 : int32_t* outFrameContentOffset,
76 : nsIFrame** outChildFrame) override;
77 :
78 : nscoord GetFirstLetterBaseline() const { return mBaseline; }
79 :
80 : // For floating first letter frames, create a continuation for aChild and
81 : // place it in the correct place. aContinuation is an outparam for the
82 : // continuation that is created. aIsFluid determines if the continuation is
83 : // fluid or not.
84 : nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
85 : nsIFrame* aChild,
86 : nsIFrame** aContinuation,
87 : bool aIsFluid);
88 :
89 : protected:
90 : nscoord mBaseline;
91 :
92 : void DrainOverflowFrames(nsPresContext* aPresContext);
93 : };
94 :
95 : #endif /* nsFirstLetterFrame_h__ */
|