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 /* rendering object for list-item bullets */
8 #ifndef nsBulletFrame_h___
9 #define nsBulletFrame_h___
11 #include "mozilla/Attributes.h"
14 #include "imgINotificationObserver.h"
17 class imgRequestProxy
;
21 class nsBulletListener MOZ_FINAL
: public imgINotificationObserver
27 NS_DECL_IMGINOTIFICATIONOBSERVER
29 void SetFrame(nsBulletFrame
*frame
) { mFrame
= frame
; }
32 virtual ~nsBulletListener();
34 nsBulletFrame
*mFrame
;
38 * A simple class that manages the layout and rendering of html bullets.
39 * This class also supports the CSS list-style properties.
41 class nsBulletFrame MOZ_FINAL
: public nsFrame
{
43 NS_DECL_FRAMEARENA_HELPERS
45 NS_DECL_QUERYFRAME_TARGET(nsBulletFrame
)
49 explicit nsBulletFrame(nsStyleContext
* aContext
)
51 , mPadding(GetWritingMode())
52 , mIntrinsicSize(GetWritingMode())
55 virtual ~nsBulletFrame();
57 NS_IMETHOD
Notify(imgIRequest
*aRequest
, int32_t aType
, const nsIntRect
* aData
);
60 virtual void DestroyFrom(nsIFrame
* aDestructRoot
) MOZ_OVERRIDE
;
61 virtual void BuildDisplayList(nsDisplayListBuilder
* aBuilder
,
62 const nsRect
& aDirtyRect
,
63 const nsDisplayListSet
& aLists
) MOZ_OVERRIDE
;
64 virtual nsIAtom
* GetType() const MOZ_OVERRIDE
;
65 virtual void DidSetStyleContext(nsStyleContext
* aOldStyleContext
) MOZ_OVERRIDE
;
66 #ifdef DEBUG_FRAME_DUMP
67 virtual nsresult
GetFrameName(nsAString
& aResult
) const MOZ_OVERRIDE
;
71 virtual void Reflow(nsPresContext
* aPresContext
,
72 nsHTMLReflowMetrics
& aMetrics
,
73 const nsHTMLReflowState
& aReflowState
,
74 nsReflowStatus
& aStatus
) MOZ_OVERRIDE
;
75 virtual nscoord
GetMinISize(nsRenderingContext
*aRenderingContext
) MOZ_OVERRIDE
;
76 virtual nscoord
GetPrefISize(nsRenderingContext
*aRenderingContext
) MOZ_OVERRIDE
;
79 int32_t SetListItemOrdinal(int32_t aNextOrdinal
, bool* aChanged
,
82 /* get list item text, with prefix & suffix */
83 void GetListItemText(nsAString
& aResult
);
85 void GetSpokenText(nsAString
& aText
);
87 void PaintBullet(nsRenderingContext
& aRenderingContext
, nsPoint aPt
,
88 const nsRect
& aDirtyRect
, uint32_t aFlags
);
90 virtual bool IsEmpty() MOZ_OVERRIDE
;
91 virtual bool IsSelfEmpty() MOZ_OVERRIDE
;
92 virtual nscoord
GetLogicalBaseline(mozilla::WritingMode aWritingMode
) const MOZ_OVERRIDE
;
94 float GetFontSizeInflation() const;
95 bool HasFontSizeInflation() const {
96 return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION
) != 0;
98 void SetFontSizeInflation(float aInflation
);
100 int32_t GetOrdinal() { return mOrdinal
; }
102 already_AddRefed
<imgIContainer
> GetImage() const;
105 nsresult
OnStartContainer(imgIRequest
*aRequest
, imgIContainer
*aImage
);
107 void AppendSpacingToPadding(nsFontMetrics
* aFontMetrics
);
108 void GetDesiredSize(nsPresContext
* aPresContext
,
109 nsRenderingContext
*aRenderingContext
,
110 nsHTMLReflowMetrics
& aMetrics
,
111 float aFontSizeInflation
);
113 void GetLoadGroup(nsPresContext
*aPresContext
, nsILoadGroup
**aLoadGroup
);
115 mozilla::LogicalMargin mPadding
;
116 nsRefPtr
<imgRequestProxy
> mImageRequest
;
117 nsRefPtr
<nsBulletListener
> mListener
;
119 mozilla::LogicalSize mIntrinsicSize
;
124 // This is a boolean flag indicating whether or not the current image request
125 // has been registered with the refresh driver.
126 bool mRequestRegistered
;
129 #endif /* nsBulletFrame_h___ */