gecko-dev/layout/generic/nsBulletFrame.h

147 строки
4.6 KiB
C
Исходник Обычный вид История

/* -*- 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/. */
/* rendering object for list-item bullets */
1998-12-01 19:13:49 +03:00
#ifndef nsBulletFrame_h___
#define nsBulletFrame_h___
#include "mozilla/Attributes.h"
1999-04-14 01:49:58 +04:00
#include "nsFrame.h"
1998-12-01 19:13:49 +03:00
#include "imgIContainer.h"
#include "imgINotificationObserver.h"
#include "imgIOnloadBlocker.h"
class imgIContainer;
class imgRequestProxy;
class nsBulletFrame;
class nsBulletListener final : public imgINotificationObserver,
public imgIOnloadBlocker
{
public:
nsBulletListener();
NS_DECL_ISUPPORTS
NS_DECL_IMGINOTIFICATIONOBSERVER
NS_DECL_IMGIONLOADBLOCKER
void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
private:
virtual ~nsBulletListener();
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 final : public nsFrame {
typedef mozilla::image::DrawResult DrawResult;
1998-12-01 19:13:49 +03:00
public:
NS_DECL_FRAMEARENA_HELPERS
#ifdef DEBUG
NS_DECL_QUERYFRAME_TARGET(nsBulletFrame)
NS_DECL_QUERYFRAME
#endif
explicit nsBulletFrame(nsStyleContext* aContext)
: nsFrame(aContext)
, mPadding(GetWritingMode())
, mIntrinsicSize(GetWritingMode())
, mRequestRegistered(false)
, mBlockingOnload(false)
{ }
1998-12-01 19:13:49 +03:00
virtual ~nsBulletFrame();
NS_IMETHOD Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData);
NS_IMETHOD BlockOnload(imgIRequest* aRequest);
NS_IMETHOD UnblockOnload(imgIRequest* aRequest);
1998-12-01 19:13:49 +03:00
// nsIFrame
virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
virtual nsIAtom* GetType() const override;
virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
1998-12-01 19:13:49 +03:00
// nsIHTMLReflow
virtual void Reflow(nsPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus) override;
virtual nscoord GetMinISize(nsRenderingContext *aRenderingContext) override;
virtual nscoord GetPrefISize(nsRenderingContext *aRenderingContext) override;
1998-12-01 19:13:49 +03:00
// nsBulletFrame
int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged,
int32_t aIncrement);
1998-12-01 19:13:49 +03:00
/* get list item text, with prefix & suffix */
void GetListItemText(nsAString& aResult);
void GetSpokenText(nsAString& aText);
DrawResult PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags);
virtual bool IsEmpty() override;
virtual bool IsSelfEmpty() override;
virtual nscoord GetLogicalBaseline(mozilla::WritingMode aWritingMode) const override;
float GetFontSizeInflation() const;
bool HasFontSizeInflation() const {
return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION) != 0;
}
void SetFontSizeInflation(float aInflation);
int32_t GetOrdinal() { return mOrdinal; }
already_AddRefed<imgIContainer> GetImage() const;
1998-12-01 19:13:49 +03:00
protected:
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
void AppendSpacingToPadding(nsFontMetrics* aFontMetrics,
mozilla::LogicalMargin* aPadding);
void GetDesiredSize(nsPresContext* aPresContext,
nsRenderingContext *aRenderingContext,
nsHTMLReflowMetrics& aMetrics,
float aFontSizeInflation,
mozilla::LogicalMargin* aPadding);
1998-12-01 19:13:49 +03:00
void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
nsIDocument* GetOurCurrentDoc() const;
1999-04-14 01:49:58 +04:00
mozilla::LogicalMargin mPadding;
Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat The bulk of this commit was generated with a script, executed at the top level of a typical source code checkout. The only non-machine-generated part was modifying MFBT's moz.build to reflect the new naming. CLOSED TREE makes big refactorings like this a piece of cake. # The main substitution. find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \ xargs perl -p -i -e ' s/nsRefPtr\.h/RefPtr\.h/g; # handle includes s/nsRefPtr ?</RefPtr</g; # handle declarations and variables ' # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h. perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h # Handle nsRefPtr.h itself, a couple places that define constructors # from nsRefPtr, and code generators specially. We do this here, rather # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename # things like nsRefPtrHashtable. perl -p -i -e 's/nsRefPtr/RefPtr/g' \ mfbt/nsRefPtr.h \ xpcom/glue/nsCOMPtr.h \ xpcom/base/OwningNonNull.h \ ipc/ipdl/ipdl/lower.py \ ipc/ipdl/ipdl/builtin.py \ dom/bindings/Codegen.py \ python/lldbutils/lldbutils/utils.py # In our indiscriminate substitution above, we renamed # nsRefPtrGetterAddRefs, the class behind getter_AddRefs. Fix that up. find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \ xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g' if [ -d .git ]; then git mv mfbt/nsRefPtr.h mfbt/RefPtr.h else hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h fi --HG-- rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 08:24:48 +03:00
RefPtr<imgRequestProxy> mImageRequest;
RefPtr<nsBulletListener> mListener;
mozilla::LogicalSize mIntrinsicSize;
int32_t mOrdinal;
private:
void RegisterImageRequest(bool aKnownToBeAnimated);
void DeregisterAndCancelImageRequest();
// This is a boolean flag indicating whether or not the current image request
// has been registered with the refresh driver.
bool mRequestRegistered : 1;
// Whether we're currently blocking onload.
bool mBlockingOnload : 1;
1998-12-01 19:13:49 +03:00
};
#endif /* nsBulletFrame_h___ */