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
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/
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
15 * The Original Code is Mozilla Communicator client code.
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.
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.
36 * ***** END LICENSE BLOCK ***** */
38 /* rendering object for list-item bullets */
40 #ifndef nsBulletFrame_h___
41 #define nsBulletFrame_h___
44 #include "nsStyleContext.h"
46 #include "imgIRequest.h"
47 #include "imgIDecoderObserver.h"
51 * A simple class that manages the layout and rendering of html bullets.
52 * This class also supports the CSS list-style properties.
54 class nsBulletFrame
: public nsFrame
{
56 nsBulletFrame(nsStyleContext
* aContext
) : nsFrame(aContext
) {}
57 virtual ~nsBulletFrame();
60 virtual void Destroy();
61 NS_IMETHOD
BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
62 const nsRect
& aDirtyRect
,
63 const nsDisplayListSet
& aLists
);
64 virtual nsIAtom
* GetType() const;
65 NS_IMETHOD
DidSetStyleContext();
67 NS_IMETHOD
GetFrameName(nsAString
& aResult
) const;
71 NS_IMETHOD
Reflow(nsPresContext
* aPresContext
,
72 nsHTMLReflowMetrics
& aMetrics
,
73 const nsHTMLReflowState
& aReflowState
,
74 nsReflowStatus
& aStatus
);
75 virtual nscoord
GetMinWidth(nsIRenderingContext
*aRenderingContext
);
76 virtual nscoord
GetPrefWidth(nsIRenderingContext
*aRenderingContext
);
79 PRInt32
SetListItemOrdinal(PRInt32 aNextOrdinal
, PRBool
* aChanged
);
82 NS_IMETHOD
OnStartContainer(imgIRequest
*aRequest
, imgIContainer
*aImage
);
83 NS_IMETHOD
OnDataAvailable(imgIRequest
*aRequest
,
84 gfxIImageFrame
*aFrame
,
86 NS_IMETHOD
OnStopDecode(imgIRequest
*aRequest
,
88 const PRUnichar
*aStatusArg
);
89 NS_IMETHOD
FrameChanged(imgIContainer
*aContainer
,
90 gfxIImageFrame
*aNewframe
,
93 /* get list item text, without '.' */
94 static PRBool
AppendCounterText(PRInt32 aListStyleType
,
98 /* get list item text, with '.' */
99 PRBool
GetListItemText(const nsStyleList
& aStyleList
,
102 void PaintBullet(nsIRenderingContext
& aRenderingContext
, nsPoint aPt
,
103 const nsRect
& aDirtyRect
);
105 virtual PRBool
IsEmpty();
106 virtual PRBool
IsSelfEmpty();
109 void GetDesiredSize(nsPresContext
* aPresContext
,
110 nsIRenderingContext
*aRenderingContext
,
111 nsHTMLReflowMetrics
& aMetrics
);
113 void GetLoadGroup(nsPresContext
*aPresContext
, nsILoadGroup
**aLoadGroup
);
117 nsCOMPtr
<imgIRequest
> mImageRequest
;
118 nsCOMPtr
<imgIDecoderObserver
> mListener
;
120 nsSize mIntrinsicSize
;
121 nsSize mComputedSize
;
125 #endif /* nsBulletFrame_h___ */