2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-03-29 18:29:03 +00:00
|
|
|
|
|
|
|
/* rendering object for list-item bullets */
|
|
|
|
|
1998-12-01 16:13:49 +00:00
|
|
|
#ifndef nsBulletFrame_h___
|
|
|
|
#define nsBulletFrame_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
1999-04-13 21:49:58 +00:00
|
|
|
#include "nsFrame.h"
|
1998-12-01 16:13:49 +00:00
|
|
|
|
2012-10-12 16:11:22 +00:00
|
|
|
#include "imgINotificationObserver.h"
|
2001-08-09 20:22:39 +00:00
|
|
|
|
2013-06-22 16:30:57 +00:00
|
|
|
class imgIContainer;
|
2012-10-12 12:43:01 +00:00
|
|
|
class imgRequestProxy;
|
|
|
|
|
2011-12-24 08:28:23 +00:00
|
|
|
class nsBulletFrame;
|
|
|
|
|
2012-10-12 16:11:22 +00:00
|
|
|
class nsBulletListener : public imgINotificationObserver
|
2011-12-24 08:28:23 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsBulletListener();
|
|
|
|
virtual ~nsBulletListener();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2012-10-12 16:11:22 +00:00
|
|
|
NS_DECL_IMGINOTIFICATIONOBSERVER
|
2011-12-24 08:28:23 +00:00
|
|
|
|
|
|
|
void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsBulletFrame *mFrame;
|
|
|
|
};
|
|
|
|
|
1998-12-01 16:13:49 +00:00
|
|
|
/**
|
|
|
|
* A simple class that manages the layout and rendering of html bullets.
|
|
|
|
* This class also supports the CSS list-style properties.
|
|
|
|
*/
|
|
|
|
class nsBulletFrame : public nsFrame {
|
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2014-01-18 07:08:22 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsBulletFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
#endif
|
2009-09-12 16:49:24 +00:00
|
|
|
|
2011-11-24 02:48:23 +00:00
|
|
|
nsBulletFrame(nsStyleContext* aContext)
|
|
|
|
: nsFrame(aContext)
|
|
|
|
{
|
|
|
|
}
|
1998-12-01 16:13:49 +00:00
|
|
|
virtual ~nsBulletFrame();
|
|
|
|
|
2012-10-12 16:11:22 +00:00
|
|
|
NS_IMETHOD Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData);
|
|
|
|
|
1998-12-01 16:13:49 +00:00
|
|
|
// nsIFrame
|
2013-05-14 16:33:23 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 07:47:48 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1998-12-01 16:13:49 +00:00
|
|
|
|
|
|
|
// nsIHTMLReflow
|
2014-05-13 00:47:52 +00:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
1998-12-01 16:13:49 +00:00
|
|
|
|
|
|
|
// nsBulletFrame
|
2012-09-08 02:30:24 +00:00
|
|
|
int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged,
|
|
|
|
int32_t aIncrement);
|
1998-12-01 16:13:49 +00:00
|
|
|
|
2014-06-12 01:13:00 +00:00
|
|
|
/* get list item text, with prefix & suffix */
|
2014-06-12 01:12:00 +00:00
|
|
|
void GetListItemText(nsAString& aResult);
|
|
|
|
|
|
|
|
void GetSpokenText(nsAString& aText);
|
2006-01-26 02:29:17 +00:00
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
2013-05-29 23:23:31 +00:00
|
|
|
const nsRect& aDirtyRect, uint32_t aFlags);
|
2008-03-12 00:46:18 +00:00
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual bool IsEmpty() MOZ_OVERRIDE;
|
|
|
|
virtual bool IsSelfEmpty() MOZ_OVERRIDE;
|
2014-06-17 12:19:38 +00:00
|
|
|
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const MOZ_OVERRIDE;
|
2004-06-04 19:28:36 +00:00
|
|
|
|
2011-11-24 02:48:23 +00:00
|
|
|
float GetFontSizeInflation() const;
|
|
|
|
bool HasFontSizeInflation() const {
|
|
|
|
return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION) != 0;
|
|
|
|
}
|
|
|
|
void SetFontSizeInflation(float aInflation);
|
|
|
|
|
2012-12-21 09:09:23 +00:00
|
|
|
int32_t GetOrdinal() { return mOrdinal; }
|
|
|
|
|
2013-06-22 16:30:57 +00:00
|
|
|
already_AddRefed<imgIContainer> GetImage() const;
|
|
|
|
|
1998-12-01 16:13:49 +00:00
|
|
|
protected:
|
2012-10-12 16:11:22 +00:00
|
|
|
nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
|
|
|
|
|
2014-06-13 15:34:00 +00:00
|
|
|
void AppendSpacingToPadding(nsFontMetrics* aFontMetrics);
|
2004-07-31 23:15:21 +00:00
|
|
|
void GetDesiredSize(nsPresContext* aPresContext,
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext *aRenderingContext,
|
2011-11-24 02:48:23 +00:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
float aFontSizeInflation);
|
1998-12-01 16:13:49 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
|
1999-04-13 21:49:58 +00:00
|
|
|
|
1998-12-01 16:13:49 +00:00
|
|
|
nsMargin mPadding;
|
2012-10-12 12:43:01 +00:00
|
|
|
nsRefPtr<imgRequestProxy> mImageRequest;
|
2011-12-24 08:28:23 +00:00
|
|
|
nsRefPtr<nsBulletListener> mListener;
|
2001-08-09 20:22:39 +00:00
|
|
|
|
|
|
|
nsSize mIntrinsicSize;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mOrdinal;
|
2013-12-02 17:51:25 +00:00
|
|
|
|
2011-11-09 21:39:16 +00:00
|
|
|
private:
|
|
|
|
|
|
|
|
// This is a boolean flag indicating whether or not the current image request
|
|
|
|
// has been registered with the refresh driver.
|
|
|
|
bool mRequestRegistered;
|
1998-12-01 16:13:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsBulletFrame_h___ */
|