1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* ***** BEGIN LICENSE BLOCK *****
3 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Original Code is Mozilla Communicator client code.
16 : *
17 : * The Initial Developer of the Original Code is
18 : * Netscape Communications Corporation.
19 : * Portions created by the Initial Developer are Copyright (C) 1998
20 : * the Initial Developer. All Rights Reserved.
21 : *
22 : * Contributor(s):
23 : *
24 : * Alternatively, the contents of this file may be used under the terms of
25 : * either of the GNU General Public License Version 2 or later (the "GPL"),
26 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 : * in which case the provisions of the GPL or the LGPL are applicable instead
28 : * of those above. If you wish to allow use of your version of this file only
29 : * under the terms of either the GPL or the LGPL, and not to allow others to
30 : * use your version of this file under the terms of the MPL, indicate your
31 : * decision by deleting the provisions above and replace them with the notice
32 : * and other provisions required by the GPL or the LGPL. If you do not delete
33 : * the provisions above, a recipient may use your version of this file under
34 : * the terms of any one of the MPL, the GPL or the LGPL.
35 : *
36 : * ***** END LICENSE BLOCK ***** */
37 :
38 : #ifndef nsFirstLetterFrame_h__
39 : #define nsFirstLetterFrame_h__
40 :
41 : /* rendering object for CSS :first-letter pseudo-element */
42 :
43 : #include "nsContainerFrame.h"
44 :
45 0 : class nsFirstLetterFrame : public nsContainerFrame {
46 : public:
47 : NS_DECL_QUERYFRAME_TARGET(nsFirstLetterFrame)
48 : NS_DECL_QUERYFRAME
49 : NS_DECL_FRAMEARENA_HELPERS
50 :
51 0 : nsFirstLetterFrame(nsStyleContext* aContext) : nsContainerFrame(aContext) {}
52 :
53 : NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
54 : const nsRect& aDirtyRect,
55 : const nsDisplayListSet& aLists);
56 :
57 : NS_IMETHOD Init(nsIContent* aContent,
58 : nsIFrame* aParent,
59 : nsIFrame* aPrevInFlow);
60 : NS_IMETHOD SetInitialChildList(ChildListID aListID,
61 : nsFrameList& aChildList);
62 : #ifdef NS_DEBUG
63 : NS_IMETHOD GetFrameName(nsAString& aResult) const;
64 : #endif
65 : virtual nsIAtom* GetType() const;
66 :
67 0 : bool IsFloating() const { return GetStateBits() & NS_FRAME_OUT_OF_FLOW; }
68 :
69 0 : virtual bool IsFrameOfType(PRUint32 aFlags) const
70 : {
71 0 : if (!IsFloating())
72 0 : aFlags = aFlags & ~(nsIFrame::eLineParticipant);
73 : return nsContainerFrame::IsFrameOfType(aFlags &
74 0 : ~(nsIFrame::eBidiInlineContainer));
75 : }
76 :
77 : virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
78 : virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
79 : virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
80 : InlineMinWidthData *aData);
81 : virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
82 : InlinePrefWidthData *aData);
83 : virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
84 : nsSize aCBSize, nscoord aAvailableWidth,
85 : nsSize aMargin, nsSize aBorder, nsSize aPadding,
86 : bool aShrinkWrap);
87 : NS_IMETHOD Reflow(nsPresContext* aPresContext,
88 : nsHTMLReflowMetrics& aDesiredSize,
89 : const nsHTMLReflowState& aReflowState,
90 : nsReflowStatus& aStatus);
91 :
92 : virtual bool CanContinueTextRun() const;
93 : virtual nscoord GetBaseline() const;
94 :
95 : //override of nsFrame method
96 : NS_IMETHOD GetChildFrameContainingOffset(PRInt32 inContentOffset,
97 : bool inHint,
98 : PRInt32* outFrameContentOffset,
99 : nsIFrame **outChildFrame);
100 :
101 : nscoord GetFirstLetterBaseline() const { return mBaseline; }
102 :
103 : // For floating first letter frames, create a continuation for aChild and
104 : // place it in the correct place. aContinuation is an outparam for the
105 : // continuation that is created. aIsFluid determines if the continuation is
106 : // fluid or not.
107 : nsresult CreateContinuationForFloatingParent(nsPresContext* aPresContext,
108 : nsIFrame* aChild,
109 : nsIFrame** aContinuation,
110 : bool aIsFluid);
111 :
112 : protected:
113 : nscoord mBaseline;
114 :
115 : virtual PRIntn GetSkipSides() const;
116 :
117 : void DrainOverflowFrames(nsPresContext* aPresContext);
118 : };
119 :
120 : #endif /* nsFirstLetterFrame_h__ */
|