2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 22:29:03 +04:00
|
|
|
|
|
|
|
/* rendering object for list-item bullets */
|
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
#ifndef nsBulletFrame_h___
|
|
|
|
#define nsBulletFrame_h___
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
1999-04-14 01:49:58 +04:00
|
|
|
#include "nsFrame.h"
|
2003-02-22 03:32:13 +03:00
|
|
|
#include "nsStyleContext.h"
|
1998-12-01 19:13:49 +03:00
|
|
|
|
2001-08-10 00:22:39 +04:00
|
|
|
#include "imgIRequest.h"
|
2012-10-12 20:11:22 +04:00
|
|
|
#include "imgINotificationObserver.h"
|
2001-08-10 00:22:39 +04:00
|
|
|
|
2012-10-12 16:43:01 +04:00
|
|
|
class imgRequestProxy;
|
|
|
|
|
2011-11-24 06:48:23 +04:00
|
|
|
#define BULLET_FRAME_IMAGE_LOADING NS_FRAME_STATE_BIT(63)
|
|
|
|
#define BULLET_FRAME_HAS_FONT_INFLATION NS_FRAME_STATE_BIT(62)
|
|
|
|
|
2011-12-24 12:28:23 +04:00
|
|
|
class nsBulletFrame;
|
|
|
|
|
2012-10-12 20:11:22 +04:00
|
|
|
class nsBulletListener : public imgINotificationObserver
|
2011-12-24 12:28:23 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsBulletListener();
|
|
|
|
virtual ~nsBulletListener();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2012-10-12 20:11:22 +04:00
|
|
|
NS_DECL_IMGINOTIFICATIONOBSERVER
|
2011-12-24 12:28:23 +04:00
|
|
|
|
|
|
|
void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsBulletFrame *mFrame;
|
|
|
|
};
|
|
|
|
|
1998-12-01 19:13:49 +03: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 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
2011-11-24 06:48:23 +04:00
|
|
|
nsBulletFrame(nsStyleContext* aContext)
|
|
|
|
: nsFrame(aContext)
|
|
|
|
{
|
|
|
|
}
|
1998-12-01 19:13:49 +03:00
|
|
|
virtual ~nsBulletFrame();
|
|
|
|
|
2012-10-12 20:11:22 +04:00
|
|
|
NS_IMETHOD Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData);
|
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
// nsIFrame
|
2013-05-14 20:33:23 +04:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
|
2012-06-25 23:59:42 +04:00
|
|
|
#ifdef DEBUG
|
2012-09-14 20:10:08 +04:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-12-01 19:13:49 +03:00
|
|
|
|
|
|
|
// nsIHTMLReflow
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-12-01 19:13:49 +03:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 20:10:08 +04:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
1998-12-01 19:13:49 +03:00
|
|
|
|
|
|
|
// nsBulletFrame
|
2012-09-08 06:30:24 +04:00
|
|
|
int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged,
|
|
|
|
int32_t aIncrement);
|
1998-12-01 19:13:49 +03:00
|
|
|
|
2001-08-10 00:22:39 +04:00
|
|
|
|
2005-04-02 03:07:00 +04:00
|
|
|
/* get list item text, without '.' */
|
2012-08-22 19:56:38 +04:00
|
|
|
static bool AppendCounterText(int32_t aListStyleType,
|
|
|
|
int32_t aOrdinal,
|
2005-04-02 03:07:00 +04:00
|
|
|
nsString& aResult);
|
2004-06-04 23:28:36 +04:00
|
|
|
|
2005-04-02 03:07:00 +04:00
|
|
|
/* get list item text, with '.' */
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetListItemText(const nsStyleList& aStyleList,
|
2005-04-02 03:07:00 +04:00
|
|
|
nsString& aResult);
|
2006-01-26 05:29:17 +03:00
|
|
|
|
2011-04-08 05:04:40 +04:00
|
|
|
void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
2013-05-30 03:23:31 +04:00
|
|
|
const nsRect& aDirtyRect, uint32_t aFlags);
|
2008-03-12 03:46:18 +03:00
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
virtual bool IsEmpty() MOZ_OVERRIDE;
|
|
|
|
virtual bool IsSelfEmpty() MOZ_OVERRIDE;
|
2013-02-12 05:52:55 +04:00
|
|
|
virtual nscoord GetBaseline() const MOZ_OVERRIDE;
|
2004-06-04 23:28:36 +04:00
|
|
|
|
2011-11-24 06:48:23 +04:00
|
|
|
float GetFontSizeInflation() const;
|
|
|
|
bool HasFontSizeInflation() const {
|
|
|
|
return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION) != 0;
|
|
|
|
}
|
|
|
|
void SetFontSizeInflation(float aInflation);
|
|
|
|
|
2012-12-21 13:09:23 +04:00
|
|
|
int32_t GetOrdinal() { return mOrdinal; }
|
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
protected:
|
2012-10-12 20:11:22 +04:00
|
|
|
nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
|
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void GetDesiredSize(nsPresContext* aPresContext,
|
2011-04-08 05:04:40 +04:00
|
|
|
nsRenderingContext *aRenderingContext,
|
2011-11-24 06:48:23 +04:00
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
float aFontSizeInflation);
|
1998-12-01 19:13:49 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
|
1999-04-14 01:49:58 +04:00
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
nsMargin mPadding;
|
2012-10-12 16:43:01 +04:00
|
|
|
nsRefPtr<imgRequestProxy> mImageRequest;
|
2011-12-24 12:28:23 +04:00
|
|
|
nsRefPtr<nsBulletListener> mListener;
|
2001-08-10 00:22:39 +04:00
|
|
|
|
|
|
|
nsSize mIntrinsicSize;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mOrdinal;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mTextIsRTL;
|
2011-11-10 01:39:16 +04: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 19:13:49 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsBulletFrame_h___ */
|