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"
|
1998-12-01 19:13:49 +03:00
|
|
|
|
2012-10-12 20:11:22 +04:00
|
|
|
#include "imgINotificationObserver.h"
|
2014-11-11 00:37:49 +03:00
|
|
|
#include "imgIOnloadBlocker.h"
|
2001-08-10 00:22:39 +04:00
|
|
|
|
2013-06-22 20:30:57 +04:00
|
|
|
class imgIContainer;
|
2012-10-12 16:43:01 +04:00
|
|
|
class imgRequestProxy;
|
|
|
|
|
2011-12-24 12:28:23 +04:00
|
|
|
class nsBulletFrame;
|
|
|
|
|
2014-11-11 00:37:49 +03:00
|
|
|
class nsBulletListener MOZ_FINAL : public imgINotificationObserver,
|
|
|
|
public imgIOnloadBlocker
|
2011-12-24 12:28:23 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsBulletListener();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2012-10-12 20:11:22 +04:00
|
|
|
NS_DECL_IMGINOTIFICATIONOBSERVER
|
2014-11-11 00:37:49 +03:00
|
|
|
NS_DECL_IMGIONLOADBLOCKER
|
2011-12-24 12:28:23 +04:00
|
|
|
|
|
|
|
void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
|
|
|
|
|
|
|
|
private:
|
2014-06-24 02:40:01 +04:00
|
|
|
virtual ~nsBulletListener();
|
|
|
|
|
2011-12-24 12:28:23 +04:00
|
|
|
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.
|
|
|
|
*/
|
2014-08-05 21:33:55 +04:00
|
|
|
class nsBulletFrame MOZ_FINAL : public nsFrame {
|
1998-12-01 19:13:49 +03:00
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2014-01-18 11:08:22 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsBulletFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
#endif
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsBulletFrame(nsStyleContext* aContext)
|
2011-11-24 06:48:23 +04:00
|
|
|
: nsFrame(aContext)
|
2014-07-24 12:30:07 +04:00
|
|
|
, mPadding(GetWritingMode())
|
|
|
|
, mIntrinsicSize(GetWritingMode())
|
2014-11-11 00:37:49 +03:00
|
|
|
, mRequestRegistered(false)
|
|
|
|
, mBlockingOnload(false)
|
|
|
|
{ }
|
1998-12-01 19:13:49 +03:00
|
|
|
virtual ~nsBulletFrame();
|
|
|
|
|
2014-11-11 00:37:49 +03: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 20:11:22 +04:00
|
|
|
|
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;
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-12-01 19:13:49 +03:00
|
|
|
|
|
|
|
// nsIHTMLReflow
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aMetrics,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2014-07-24 21:03:25 +04:00
|
|
|
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
|
|
|
|
virtual nscoord GetPrefISize(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
|
|
|
|
2014-06-12 05:13:00 +04:00
|
|
|
/* get list item text, with prefix & suffix */
|
2014-06-12 05:12:00 +04:00
|
|
|
void GetListItemText(nsAString& aResult);
|
|
|
|
|
|
|
|
void GetSpokenText(nsAString& aText);
|
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;
|
2014-06-17 16:19:38 +04:00
|
|
|
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) 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; }
|
|
|
|
|
2013-06-22 20:30:57 +04:00
|
|
|
already_AddRefed<imgIContainer> GetImage() const;
|
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
protected:
|
2012-10-12 20:11:22 +04:00
|
|
|
nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
|
|
|
|
|
2014-06-13 19:34:00 +04:00
|
|
|
void AppendSpacingToPadding(nsFontMetrics* aFontMetrics);
|
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);
|
2014-11-11 00:37:49 +03:00
|
|
|
nsIDocument* GetOurCurrentDoc() const;
|
1999-04-14 01:49:58 +04:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
mozilla::LogicalMargin 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
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
mozilla::LogicalSize mIntrinsicSize;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mOrdinal;
|
2013-12-02 21:51:25 +04:00
|
|
|
|
2011-11-10 01:39:16 +04:00
|
|
|
private:
|
2014-11-11 00:37:49 +03:00
|
|
|
void RegisterImageRequest(bool aKnownToBeAnimated);
|
|
|
|
void DeregisterAndCancelImageRequest();
|
2011-11-10 01:39:16 +04:00
|
|
|
|
|
|
|
// This is a boolean flag indicating whether or not the current image request
|
|
|
|
// has been registered with the refresh driver.
|
2014-11-11 00:37:49 +03:00
|
|
|
bool mRequestRegistered : 1;
|
|
|
|
|
|
|
|
// Whether we're currently blocking onload.
|
|
|
|
bool mBlockingOnload : 1;
|
1998-12-01 19:13:49 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsBulletFrame_h___ */
|