gecko-dev/layout/generic/nsBulletFrame.h
Nathan Froyd 01583602a9 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 01:24:48 -04:00

147 lines
4.6 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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 */
#ifndef nsBulletFrame_h___
#define nsBulletFrame_h___
#include "mozilla/Attributes.h"
#include "nsFrame.h"
#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;
};
/**
* 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;
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)
{ }
virtual ~nsBulletFrame();
NS_IMETHOD Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData);
NS_IMETHOD BlockOnload(imgIRequest* aRequest);
NS_IMETHOD UnblockOnload(imgIRequest* aRequest);
// 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
// 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;
// nsBulletFrame
int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged,
int32_t aIncrement);
/* 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;
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);
void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
nsIDocument* GetOurCurrentDoc() const;
mozilla::LogicalMargin mPadding;
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;
};
#endif /* nsBulletFrame_h___ */