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/. */
6 #ifndef nsFirstLetterFrame_h__
7 #define nsFirstLetterFrame_h__
9 /* rendering object for CSS :first-letter pseudo-element */
11 #include "mozilla/Attributes.h"
12 #include "nsContainerFrame.h"
14 class nsFirstLetterFrame MOZ_FINAL
: public nsContainerFrame
{
16 NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame
)
18 NS_DECL_FRAMEARENA_HELPERS
20 explicit nsFirstLetterFrame(nsStyleContext
* aContext
) : nsContainerFrame(aContext
) {}
22 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
23 const nsRect
& aDirtyRect
,
24 const nsDisplayListSet
& aLists
) MOZ_OVERRIDE
;
26 virtual void Init(nsIContent
* aContent
,
27 nsContainerFrame
* aParent
,
28 nsIFrame
* aPrevInFlow
) MOZ_OVERRIDE
;
29 virtual void SetInitialChildList(ChildListID aListID
,
30 nsFrameList
& aChildList
) MOZ_OVERRIDE
;
31 #ifdef DEBUG_FRAME_DUMP
32 virtual nsresult
GetFrameName(nsAString
& aResult
) const MOZ_OVERRIDE
;
34 virtual nsIAtom
* GetType() const MOZ_OVERRIDE
;
36 bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW
; }
38 virtual bool IsFrameOfType(uint32_t aFlags
) const MOZ_OVERRIDE
41 aFlags
= aFlags
& ~(nsIFrame::eLineParticipant
);
42 return nsContainerFrame::IsFrameOfType(aFlags
&
43 ~(nsIFrame::eBidiInlineContainer
));
46 virtual nscoord
GetMinISize(nsRenderingContext
*aRenderingContext
) MOZ_OVERRIDE
;
47 virtual nscoord
GetPrefISize(nsRenderingContext
*aRenderingContext
) MOZ_OVERRIDE
;
48 virtual void AddInlineMinISize(nsRenderingContext
*aRenderingContext
,
49 InlineMinISizeData
*aData
) MOZ_OVERRIDE
;
50 virtual void AddInlinePrefISize(nsRenderingContext
*aRenderingContext
,
51 InlinePrefISizeData
*aData
) MOZ_OVERRIDE
;
53 virtual mozilla::LogicalSize
54 ComputeSize(nsRenderingContext
*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 uint32_t aFlags
) MOZ_OVERRIDE
;
63 virtual void Reflow(nsPresContext
* aPresContext
,
64 nsHTMLReflowMetrics
& aDesiredSize
,
65 const nsHTMLReflowState
& aReflowState
,
66 nsReflowStatus
& aStatus
) MOZ_OVERRIDE
;
68 virtual bool CanContinueTextRun() const MOZ_OVERRIDE
;
69 virtual nscoord
GetLogicalBaseline(mozilla::WritingMode aWritingMode
) const MOZ_OVERRIDE
;
70 virtual LogicalSides
GetLogicalSkipSides(const nsHTMLReflowState
* aReflowState
= nullptr) const MOZ_OVERRIDE
;
72 //override of nsFrame method
73 virtual nsresult
GetChildFrameContainingOffset(int32_t inContentOffset
,
75 int32_t* outFrameContentOffset
,
76 nsIFrame
** outChildFrame
) MOZ_OVERRIDE
;
78 nscoord
GetFirstLetterBaseline() const { return mBaseline
; }
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
84 nsresult
CreateContinuationForFloatingParent(nsPresContext
* aPresContext
,
86 nsIFrame
** aContinuation
,
92 void DrainOverflowFrames(nsPresContext
* aPresContext
);
95 #endif /* nsFirstLetterFrame_h__ */