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
|
|
|
|
2015-02-04 21:50:56 +00:00
|
|
|
#include "imgIContainer.h"
|
2012-10-12 16:11:22 +00:00
|
|
|
#include "imgINotificationObserver.h"
|
2014-11-10 21:37:49 +00:00
|
|
|
#include "imgIOnloadBlocker.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;
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsBulletListener final : public imgINotificationObserver,
|
2015-03-27 18:52:19 +00:00
|
|
|
public imgIOnloadBlocker
|
2011-12-24 08:28:23 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsBulletListener();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2012-10-12 16:11:22 +00:00
|
|
|
NS_DECL_IMGINOTIFICATIONOBSERVER
|
2014-11-10 21:37:49 +00:00
|
|
|
NS_DECL_IMGIONLOADBLOCKER
|
2011-12-24 08:28:23 +00:00
|
|
|
|
|
|
|
void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
|
|
|
|
|
|
|
|
private:
|
2014-06-23 22:40:01 +00:00
|
|
|
virtual ~nsBulletListener();
|
|
|
|
|
2011-12-24 08:28:23 +00:00
|
|
|
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.
|
|
|
|
*/
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsBulletFrame final : public nsFrame {
|
2015-02-04 21:50:56 +00:00
|
|
|
typedef mozilla::image::DrawResult DrawResult;
|
|
|
|
|
1998-12-01 16:13:49 +00:00
|
|
|
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
|
|
|
|
2014-09-01 03:36:37 +00:00
|
|
|
explicit nsBulletFrame(nsStyleContext* aContext)
|
2011-11-24 02:48:23 +00:00
|
|
|
: nsFrame(aContext)
|
2014-07-24 08:30:07 +00:00
|
|
|
, mPadding(GetWritingMode())
|
|
|
|
, mIntrinsicSize(GetWritingMode())
|
2014-11-10 21:37:49 +00:00
|
|
|
, mRequestRegistered(false)
|
|
|
|
, mBlockingOnload(false)
|
|
|
|
{ }
|
1998-12-01 16:13:49 +00:00
|
|
|
virtual ~nsBulletFrame();
|
|
|
|
|
2014-11-10 21:37:49 +00:00
|
|
|
NS_IMETHOD Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData);
|
|
|
|
NS_IMETHOD BlockOnload(imgIRequest* aRequest);
|
|
|
|
NS_IMETHOD UnblockOnload(imgIRequest* aRequest);
|
2012-10-12 16:11:22 +00:00
|
|
|
|
1998-12-01 16:13:49 +00:00
|
|
|
// nsIFrame
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 16:28:04 +00:00
|
|
|
const nsDisplayListSet& aLists) override;
|
|
|
|
virtual nsIAtom* GetType() const override;
|
|
|
|
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const 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,
|
2015-03-21 16:28:04 +00:00
|
|
|
nsReflowStatus& aStatus) override;
|
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) 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
|
|
|
|
2015-02-04 21:50:56 +00:00
|
|
|
DrawResult PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
|
|
|
|
const nsRect& aDirtyRect, uint32_t aFlags);
|
2008-03-12 00:46:18 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool IsEmpty() override;
|
|
|
|
virtual bool IsSelfEmpty() override;
|
|
|
|
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const 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:
|
2014-11-17 22:29:56 +00:00
|
|
|
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
2012-10-12 16:11:22 +00:00
|
|
|
|
2015-03-12 09:53:54 +00:00
|
|
|
void AppendSpacingToPadding(nsFontMetrics* aFontMetrics,
|
|
|
|
mozilla::LogicalMargin* aPadding);
|
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,
|
2015-03-12 09:53:54 +00:00
|
|
|
float aFontSizeInflation,
|
|
|
|
mozilla::LogicalMargin* aPadding);
|
1998-12-01 16:13:49 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
|
2014-11-10 21:37:49 +00:00
|
|
|
nsIDocument* GetOurCurrentDoc() const;
|
1999-04-13 21:49:58 +00:00
|
|
|
|
2014-07-24 08:30:07 +00:00
|
|
|
mozilla::LogicalMargin 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
|
|
|
|
2014-07-24 08:30:07 +00:00
|
|
|
mozilla::LogicalSize 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:
|
2014-11-10 21:37:49 +00:00
|
|
|
void RegisterImageRequest(bool aKnownToBeAnimated);
|
|
|
|
void DeregisterAndCancelImageRequest();
|
2011-11-09 21:39:16 +00:00
|
|
|
|
|
|
|
// This is a boolean flag indicating whether or not the current image request
|
|
|
|
// has been registered with the refresh driver.
|
2014-11-10 21:37:49 +00:00
|
|
|
bool mRequestRegistered : 1;
|
|
|
|
|
|
|
|
// Whether we're currently blocking onload.
|
|
|
|
bool mBlockingOnload : 1;
|
1998-12-01 16:13:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsBulletFrame_h___ */
|