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"
50 * A simple class that manages the layout and rendering of html bullets.
51 * This class also supports the CSS list-style properties.
53 class nsBulletFrame
: public nsFrame
{
55 nsBulletFrame(nsStyleContext
* aContext
) : nsFrame(aContext
) {}
56 virtual ~nsBulletFrame();
59 virtual void Destroy();
60 NS_IMETHOD
BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
61 const nsRect
& aDirtyRect
,
62 const nsDisplayListSet
& aLists
);
63 virtual nsIAtom
* GetType() const;
64 virtual void DidSetStyleContext(nsStyleContext
* aOldStyleContext
);
66 NS_IMETHOD
GetFrameName(nsAString
& aResult
) const;
70 NS_IMETHOD
Reflow(nsPresContext
* aPresContext
,
71 nsHTMLReflowMetrics
& aMetrics
,
72 const nsHTMLReflowState
& aReflowState
,
73 nsReflowStatus
& aStatus
);
74 virtual nscoord
GetMinWidth(nsIRenderingContext
*aRenderingContext
);
75 virtual nscoord
GetPrefWidth(nsIRenderingContext
*aRenderingContext
);
78 PRInt32
SetListItemOrdinal(PRInt32 aNextOrdinal
, PRBool
* aChanged
);
81 NS_IMETHOD
OnStartContainer(imgIRequest
*aRequest
, imgIContainer
*aImage
);
82 NS_IMETHOD
OnDataAvailable(imgIRequest
*aRequest
,
84 const nsIntRect
*aRect
);
85 NS_IMETHOD
OnStopDecode(imgIRequest
*aRequest
,
87 const PRUnichar
*aStatusArg
);
88 NS_IMETHOD
FrameChanged(imgIContainer
*aContainer
,
89 nsIntRect
*aDirtyRect
);
91 /* get list item text, without '.' */
92 static PRBool
AppendCounterText(PRInt32 aListStyleType
,
96 /* get list item text, with '.' */
97 PRBool
GetListItemText(const nsStyleList
& aStyleList
,
100 void PaintBullet(nsIRenderingContext
& aRenderingContext
, nsPoint aPt
,
101 const nsRect
& aDirtyRect
);
103 virtual PRBool
IsEmpty();
104 virtual PRBool
IsSelfEmpty();
107 void GetDesiredSize(nsPresContext
* aPresContext
,
108 nsIRenderingContext
*aRenderingContext
,
109 nsHTMLReflowMetrics
& aMetrics
);
111 void GetLoadGroup(nsPresContext
*aPresContext
, nsILoadGroup
**aLoadGroup
);
114 nsCOMPtr
<imgIRequest
> mImageRequest
;
115 nsCOMPtr
<imgIDecoderObserver
> mListener
;
117 nsSize mIntrinsicSize
;
118 nsSize mComputedSize
;
123 #endif /* nsBulletFrame_h___ */