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 "nsContainerFrame.h"
14 class nsFirstLetterFrame
: public nsContainerFrame
{
17 NS_DECL_FRAMEARENA_HELPERS(nsFirstLetterFrame
)
19 nsFirstLetterFrame(ComputedStyle
* aStyle
, nsPresContext
* aPresContext
,
21 : nsContainerFrame(aStyle
, aPresContext
, aClassID
) {}
23 nsFirstLetterFrame(ComputedStyle
* aStyle
, nsPresContext
* aPresContext
)
24 : nsContainerFrame(aStyle
, aPresContext
, kClassID
) {}
26 void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
27 const nsDisplayListSet
& aLists
) final
;
29 void Init(nsIContent
* aContent
, nsContainerFrame
* aParent
,
30 nsIFrame
* aPrevInFlow
) final
;
31 void SetInitialChildList(ChildListID aListID
, nsFrameList
&& aChildList
) final
;
32 #ifdef DEBUG_FRAME_DUMP
33 nsresult
GetFrameName(nsAString
& aResult
) const final
;
36 bool IsFloating() const { return HasAnyStateBits(NS_FRAME_OUT_OF_FLOW
); }
38 nscoord
GetMinISize(gfxContext
* aRenderingContext
) final
;
39 nscoord
GetPrefISize(gfxContext
* aRenderingContext
) final
;
40 void AddInlineMinISize(gfxContext
* aRenderingContext
,
41 InlineMinISizeData
* aData
) final
;
42 void AddInlinePrefISize(gfxContext
* aRenderingContext
,
43 InlinePrefISizeData
* aData
) final
;
45 SizeComputationResult
ComputeSize(
46 gfxContext
* aRenderingContext
, mozilla::WritingMode aWM
,
47 const mozilla::LogicalSize
& aCBSize
, nscoord aAvailableISize
,
48 const mozilla::LogicalSize
& aMargin
,
49 const mozilla::LogicalSize
& aBorderPadding
,
50 const mozilla::StyleSizeOverrides
& aSizeOverrides
,
51 mozilla::ComputeSizeFlags aFlags
) final
;
53 void Reflow(nsPresContext
* aPresContext
, ReflowOutput
& aDesiredSize
,
54 const ReflowInput
& aReflowInput
, nsReflowStatus
& aStatus
) final
;
56 bool CanContinueTextRun() const final
;
57 Maybe
<nscoord
> GetNaturalBaselineBOffset(mozilla::WritingMode aWM
,
58 BaselineSharingGroup aBaselineGroup
,
59 BaselineExportContext
) const final
;
60 LogicalSides
GetLogicalSkipSides() const final
;
62 // final of nsFrame method
63 nsresult
GetChildFrameContainingOffset(int32_t inContentOffset
, bool inHint
,
64 int32_t* outFrameContentOffset
,
65 nsIFrame
** outChildFrame
) final
;
67 nscoord
GetFirstLetterBaseline() const { return mBaseline
; }
69 // For floating first letter frames, create a continuation for aChild and
70 // place it in the correct place. aContinuation is an outparam for the
71 // continuation that is created. aIsFluid determines if the continuation is
73 void CreateContinuationForFloatingParent(nsIFrame
* aChild
,
74 nsIFrame
** aContinuation
,
77 // Whether to use tight glyph bounds for a floating first-letter frame,
78 // or "loose" bounds based on font metrics rather than individual glyphs.
79 bool UseTightBounds() const;
84 void DrainOverflowFrames(nsPresContext
* aPresContext
);
87 class nsFloatingFirstLetterFrame
: public nsFirstLetterFrame
{
90 NS_DECL_FRAMEARENA_HELPERS(nsFloatingFirstLetterFrame
)
92 nsFloatingFirstLetterFrame(ComputedStyle
* aStyle
, nsPresContext
* aPresContext
)
93 : nsFirstLetterFrame(aStyle
, aPresContext
, kClassID
) {}
96 #endif /* nsFirstLetterFrame_h__ */