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