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 #ifndef nsFirstLetterFrame_h__
8 #define nsFirstLetterFrame_h__
10 /* rendering object for CSS :first-letter pseudo-element */
12 #include "mozilla/Attributes.h"
13 #include "nsContainerFrame.h"
15 class nsFirstLetterFrame final
: public nsContainerFrame
{
18 NS_DECL_FRAMEARENA_HELPERS(nsFirstLetterFrame
)
20 explicit nsFirstLetterFrame(ComputedStyle
* aStyle
,
21 nsPresContext
* aPresContext
)
22 : nsContainerFrame(aStyle
, aPresContext
, kClassID
) {}
24 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
25 const nsDisplayListSet
& aLists
) override
;
27 virtual void Init(nsIContent
* aContent
, nsContainerFrame
* aParent
,
28 nsIFrame
* aPrevInFlow
) override
;
29 virtual void SetInitialChildList(ChildListID aListID
,
30 nsFrameList
& aChildList
) override
;
31 #ifdef DEBUG_FRAME_DUMP
32 virtual nsresult
GetFrameName(nsAString
& aResult
) const override
;
35 bool IsFloating() const { return HasAnyStateBits(NS_FRAME_OUT_OF_FLOW
); }
37 virtual bool IsFrameOfType(uint32_t aFlags
) const override
{
38 if (!IsFloating()) aFlags
= aFlags
& ~(nsIFrame::eLineParticipant
);
39 return nsContainerFrame::IsFrameOfType(aFlags
&
40 ~(nsIFrame::eBidiInlineContainer
));
43 virtual nscoord
GetMinISize(gfxContext
* aRenderingContext
) override
;
44 virtual nscoord
GetPrefISize(gfxContext
* aRenderingContext
) override
;
45 virtual void AddInlineMinISize(gfxContext
* aRenderingContext
,
46 InlineMinISizeData
* aData
) override
;
47 virtual void AddInlinePrefISize(gfxContext
* aRenderingContext
,
48 InlinePrefISizeData
* aData
) override
;
50 SizeComputationResult
ComputeSize(
51 gfxContext
* aRenderingContext
, mozilla::WritingMode aWM
,
52 const mozilla::LogicalSize
& aCBSize
, nscoord aAvailableISize
,
53 const mozilla::LogicalSize
& aMargin
,
54 const mozilla::LogicalSize
& aBorderPadding
,
55 const mozilla::StyleSizeOverrides
& aSizeOverrides
,
56 mozilla::ComputeSizeFlags aFlags
) override
;
58 virtual void Reflow(nsPresContext
* aPresContext
, ReflowOutput
& aDesiredSize
,
59 const ReflowInput
& aReflowInput
,
60 nsReflowStatus
& aStatus
) override
;
62 virtual bool CanContinueTextRun() const override
;
63 virtual nscoord
GetLogicalBaseline(
64 mozilla::WritingMode aWritingMode
) const override
;
65 virtual LogicalSides
GetLogicalSkipSides() const override
;
67 // override of nsFrame method
68 virtual nsresult
GetChildFrameContainingOffset(
69 int32_t inContentOffset
, bool inHint
, int32_t* outFrameContentOffset
,
70 nsIFrame
** outChildFrame
) override
;
72 nscoord
GetFirstLetterBaseline() const { return mBaseline
; }
74 // For floating first letter frames, create a continuation for aChild and
75 // place it in the correct place. aContinuation is an outparam for the
76 // continuation that is created. aIsFluid determines if the continuation is
78 void CreateContinuationForFloatingParent(nsIFrame
* aChild
,
79 nsIFrame
** aContinuation
,
85 void DrainOverflowFrames(nsPresContext
* aPresContext
);
88 #endif /* nsFirstLetterFrame_h__ */