|
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 class nsFirstLetterFrame MOZ_FINAL : public nsContainerFrame { |
|
15 public: |
|
16 NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame) |
|
17 NS_DECL_QUERYFRAME |
|
18 NS_DECL_FRAMEARENA_HELPERS |
|
19 |
|
20 nsFirstLetterFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {} |
|
21 |
|
22 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder, |
|
23 const nsRect& aDirtyRect, |
|
24 const nsDisplayListSet& aLists) MOZ_OVERRIDE; |
|
25 |
|
26 virtual void Init(nsIContent* aContent, |
|
27 nsIFrame* aParent, |
|
28 nsIFrame* aPrevInFlow) MOZ_OVERRIDE; |
|
29 virtual nsresult SetInitialChildList(ChildListID aListID, |
|
30 nsFrameList& aChildList) MOZ_OVERRIDE; |
|
31 #ifdef DEBUG_FRAME_DUMP |
|
32 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE; |
|
33 #endif |
|
34 virtual nsIAtom* GetType() const MOZ_OVERRIDE; |
|
35 |
|
36 bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; } |
|
37 |
|
38 virtual bool IsFrameOfType(uint32_t aFlags) const MOZ_OVERRIDE |
|
39 { |
|
40 if (!IsFloating()) |
|
41 aFlags = aFlags & ~(nsIFrame::eLineParticipant); |
|
42 return nsContainerFrame::IsFrameOfType(aFlags & |
|
43 ~(nsIFrame::eBidiInlineContainer)); |
|
44 } |
|
45 |
|
46 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; |
|
47 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE; |
|
48 virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext, |
|
49 InlineMinWidthData *aData) MOZ_OVERRIDE; |
|
50 virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext, |
|
51 InlinePrefWidthData *aData) MOZ_OVERRIDE; |
|
52 virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext, |
|
53 nsSize aCBSize, nscoord aAvailableWidth, |
|
54 nsSize aMargin, nsSize aBorder, nsSize aPadding, |
|
55 uint32_t aFlags) MOZ_OVERRIDE; |
|
56 virtual nsresult Reflow(nsPresContext* aPresContext, |
|
57 nsHTMLReflowMetrics& aDesiredSize, |
|
58 const nsHTMLReflowState& aReflowState, |
|
59 nsReflowStatus& aStatus) MOZ_OVERRIDE; |
|
60 |
|
61 virtual bool CanContinueTextRun() const MOZ_OVERRIDE; |
|
62 virtual nscoord GetBaseline() const MOZ_OVERRIDE; |
|
63 virtual int GetLogicalSkipSides(const nsHTMLReflowState* aReflowState = nullptr) const MOZ_OVERRIDE; |
|
64 |
|
65 //override of nsFrame method |
|
66 virtual nsresult GetChildFrameContainingOffset(int32_t inContentOffset, |
|
67 bool inHint, |
|
68 int32_t* outFrameContentOffset, |
|
69 nsIFrame** outChildFrame) MOZ_OVERRIDE; |
|
70 |
|
71 nscoord GetFirstLetterBaseline() const { return mBaseline; } |
|
72 |
|
73 // For floating first letter frames, create a continuation for aChild and |
|
74 // place it in the correct place. aContinuation is an outparam for the |
|
75 // continuation that is created. aIsFluid determines if the continuation is |
|
76 // fluid or not. |
|
77 nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext, |
|
78 nsIFrame* aChild, |
|
79 nsIFrame** aContinuation, |
|
80 bool aIsFluid); |
|
81 |
|
82 protected: |
|
83 nscoord mBaseline; |
|
84 |
|
85 void DrainOverflowFrames(nsPresContext* aPresContext); |
|
86 }; |
|
87 |
|
88 #endif /* nsFirstLetterFrame_h__ */ |