gecko-dev/layout/generic/nsBulletFrame.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

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

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
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"
class imgIContainer;
class imgRequestProxy;
class nsBulletFrame;
class BulletRenderer;
class nsBulletListener final : public imgINotificationObserver {
public:
nsBulletListener();
NS_DECL_ISUPPORTS
NS_DECL_IMGINOTIFICATIONOBSERVER
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::ImgDrawResult ImgDrawResult;
1998-12-01 19:13:49 +03:00
public:
NS_DECL_FRAMEARENA_HELPERS(nsBulletFrame)
#ifdef DEBUG
NS_DECL_QUERYFRAME
#endif
explicit nsBulletFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
: nsFrame(aStyle, aPresContext, kClassID),
mPadding(GetWritingMode()),
mIntrinsicSize(GetWritingMode()),
mRequestRegistered(false) {}
1998-12-01 19:13:49 +03:00
virtual ~nsBulletFrame();
NS_IMETHOD Notify(imgIRequest* aRequest, int32_t aType,
const nsIntRect* aData);
1998-12-01 19:13:49 +03:00
// nsIFrame
virtual void DestroyFrom(nsIFrame* aDestructRoot,
PostDestroyData& aPostDestroyData) override;
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsDisplayListSet& aLists) override;
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
#ifdef DEBUG_FRAME_DUMP
virtual nsresult GetFrameName(nsAString& aResult) const override;
#endif
1998-12-01 19:13:49 +03:00
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
const ReflowInput& aReflowInput,
nsReflowStatus& aStatus) override;
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
void AddInlineMinISize(gfxContext* aRenderingContext,
nsIFrame::InlineMinISizeData* aData) override;
void AddInlinePrefISize(gfxContext* aRenderingContext,
nsIFrame::InlinePrefISizeData* aData) override;
1998-12-01 19:13:49 +03:00
virtual bool IsFrameOfType(uint32_t aFlags) const override {
if (aFlags & (eSupportsCSSTransforms | eSupportsContainLayoutAndPaint)) {
return false;
}
return nsFrame::IsFrameOfType(aFlags & ~nsIFrame::eLineParticipant);
}
1998-12-01 19:13:49 +03:00
// nsBulletFrame
/* get list item text, with prefix & suffix */
static void GetListItemText(mozilla::CounterStyle*, mozilla::WritingMode,
int32_t aOrdinal, nsAString& aResult);
#ifdef ACCESSIBILITY
void GetSpokenText(nsAString& aText);
#endif
Maybe<BulletRenderer> CreateBulletRenderer(gfxContext& aRenderingContext,
nsPoint aPt);
ImgDrawResult PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
const nsRect& aDirtyRect, uint32_t aFlags,
bool aDisableSubpixelAA);
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);
// aDebugFromA11y should not be used
int32_t Ordinal(bool aDebugFromA11y = false) const;
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,
gfxContext* aRenderingContext, ReflowOutput& aMetrics,
float aFontSizeInflation,
mozilla::LogicalMargin* aPadding);
1998-12-01 19:13:49 +03:00
void GetLoadGroup(nsPresContext* aPresContext, nsILoadGroup** aLoadGroup);
mozilla::dom::Document* 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;
private:
mozilla::CounterStyle* ResolveCounterStyle();
nscoord GetListStyleAscent() const;
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;
1998-12-01 19:13:49 +03:00
};
#endif /* nsBulletFrame_h___ */