2017-10-27 20:33:53 +03:00
|
|
|
/* -*- 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/. */
|
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
|
|
|
|
2015-02-05 00:50:56 +03:00
|
|
|
#include "imgIContainer.h"
|
2012-10-12 20:11:22 +04:00
|
|
|
#include "imgINotificationObserver.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;
|
2017-01-24 11:53:42 +03:00
|
|
|
class BulletRenderer;
|
2011-12-24 12:28:23 +04:00
|
|
|
|
2017-11-01 13:59:10 +03:00
|
|
|
class nsBulletListener final : public imgINotificationObserver {
|
2011-12-24 12:28:23 +04:00
|
|
|
public:
|
|
|
|
nsBulletListener();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2012-10-12 20:11:22 +04:00
|
|
|
NS_DECL_IMGINOTIFICATIONOBSERVER
|
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.
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsBulletFrame final : public nsFrame {
|
2017-12-11 18:37:59 +03:00
|
|
|
typedef mozilla::image::ImgDrawResult ImgDrawResult;
|
2015-02-05 00:50:56 +03:00
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
public:
|
2017-05-26 13:11:11 +03:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS(nsBulletFrame)
|
2014-01-18 11:08:22 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
#endif
|
2009-09-12 20:49:24 +04:00
|
|
|
|
2019-02-05 19:45:54 +03:00
|
|
|
explicit nsBulletFrame(ComputedStyle* aStyle, nsPresContext* aPresContext)
|
|
|
|
: nsFrame(aStyle, aPresContext, kClassID),
|
2014-07-24 12:30:07 +04:00
|
|
|
mPadding(GetWritingMode()),
|
|
|
|
mIntrinsicSize(GetWritingMode()),
|
2014-11-11 00:37:49 +03:00
|
|
|
mRequestRegistered(false) {}
|
2017-04-30 18:30:08 +03:00
|
|
|
|
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);
|
2012-10-12 20:11:22 +04:00
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
// nsIFrame
|
2017-11-07 03:20:33 +03:00
|
|
|
virtual void DestroyFrom(nsIFrame* aDestructRoot,
|
|
|
|
PostDestroyData& aPostDestroyData) override;
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
2018-03-22 21:20:41 +03:00
|
|
|
virtual void DidSetComputedStyle(ComputedStyle* aOldComputedStyle) override;
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const override;
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-12-01 19:13:49 +03:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext, ReflowOutput& aMetrics,
|
2016-07-21 13:36:39 +03:00
|
|
|
const ReflowInput& aReflowInput,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
virtual nscoord GetMinISize(gfxContext* aRenderingContext) override;
|
|
|
|
virtual nscoord GetPrefISize(gfxContext* aRenderingContext) override;
|
|
|
|
void AddInlineMinISize(gfxContext* aRenderingContext,
|
2016-04-14 02:32:12 +03:00
|
|
|
nsIFrame::InlineMinISizeData* aData) override;
|
2017-06-09 22:14:53 +03:00
|
|
|
void AddInlinePrefISize(gfxContext* aRenderingContext,
|
2016-04-14 02:32:12 +03:00
|
|
|
nsIFrame::InlinePrefISizeData* aData) override;
|
1998-12-01 19:13:49 +03:00
|
|
|
|
2017-10-18 02:38:17 +03:00
|
|
|
virtual bool IsFrameOfType(uint32_t aFlags) const override {
|
2018-08-08 01:02:07 +03:00
|
|
|
if (aFlags & (eSupportsCSSTransforms | eSupportsContainLayoutAndPaint)) {
|
2017-10-18 02:38:17 +03:00
|
|
|
return false;
|
|
|
|
}
|
2019-03-25 01:13:53 +03:00
|
|
|
return nsFrame::IsFrameOfType(aFlags & ~nsIFrame::eLineParticipant);
|
2017-10-18 02:38:17 +03:00
|
|
|
}
|
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
// nsBulletFrame
|
|
|
|
|
2014-06-12 05:13:00 +04:00
|
|
|
/* get list item text, with prefix & suffix */
|
2019-02-02 21:41:44 +03:00
|
|
|
static void GetListItemText(mozilla::CounterStyle*, mozilla::WritingMode,
|
|
|
|
int32_t aOrdinal, nsAString& aResult);
|
2014-06-12 05:12:00 +04:00
|
|
|
|
2019-04-08 22:49:20 +03:00
|
|
|
#ifdef ACCESSIBILITY
|
2014-06-12 05:12:00 +04:00
|
|
|
void GetSpokenText(nsAString& aText);
|
2019-04-08 22:49:20 +03:00
|
|
|
#endif
|
2017-01-24 11:53:42 +03:00
|
|
|
|
2017-06-09 22:14:53 +03:00
|
|
|
Maybe<BulletRenderer> CreateBulletRenderer(gfxContext& aRenderingContext,
|
|
|
|
nsPoint aPt);
|
2017-12-11 18:37:59 +03:00
|
|
|
ImgDrawResult PaintBullet(gfxContext& aRenderingContext, nsPoint aPt,
|
2016-05-31 21:56:22 +03:00
|
|
|
const nsRect& aDirtyRect, uint32_t aFlags,
|
|
|
|
bool aDisableSubpixelAA);
|
2017-01-24 11:53:42 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsEmpty() override;
|
|
|
|
virtual bool IsSelfEmpty() override;
|
|
|
|
virtual nscoord GetLogicalBaseline(
|
|
|
|
mozilla::WritingMode aWritingMode) const 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);
|
|
|
|
|
2019-04-08 22:49:20 +03:00
|
|
|
// aDebugFromA11y should not be used
|
|
|
|
int32_t Ordinal(bool aDebugFromA11y = false) const;
|
2012-12-21 13:09:23 +04:00
|
|
|
|
2013-06-22 20:30:57 +04:00
|
|
|
already_AddRefed<imgIContainer> GetImage() const;
|
|
|
|
|
1998-12-01 19:13:49 +03:00
|
|
|
protected:
|
2014-11-18 01:29:56 +03:00
|
|
|
nsresult OnSizeAvailable(imgIRequest* aRequest, imgIContainer* aImage);
|
2012-10-12 20:11:22 +04:00
|
|
|
|
2015-03-12 12:53:54 +03:00
|
|
|
void AppendSpacingToPadding(nsFontMetrics* aFontMetrics,
|
|
|
|
mozilla::LogicalMargin* aPadding);
|
2004-08-01 03:15:21 +04:00
|
|
|
void GetDesiredSize(nsPresContext* aPresContext,
|
2017-06-09 22:14:53 +03:00
|
|
|
gfxContext* aRenderingContext, ReflowOutput& aMetrics,
|
2015-03-12 12:53:54 +03:00
|
|
|
float aFontSizeInflation,
|
|
|
|
mozilla::LogicalMargin* aPadding);
|
1998-12-01 19:13:49 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void GetLoadGroup(nsPresContext* aPresContext, nsILoadGroup** aLoadGroup);
|
2019-01-02 16:05:23 +03:00
|
|
|
mozilla::dom::Document* GetOurCurrentDoc() const;
|
1999-04-14 01:49:58 +04:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
mozilla::LogicalMargin mPadding;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<imgRequestProxy> mImageRequest;
|
|
|
|
RefPtr<nsBulletListener> mListener;
|
2001-08-10 00:22:39 +04:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
mozilla::LogicalSize mIntrinsicSize;
|
2013-12-02 21:51:25 +04:00
|
|
|
|
2011-11-10 01:39:16 +04:00
|
|
|
private:
|
2019-02-02 21:41:44 +03:00
|
|
|
mozilla::CounterStyle* ResolveCounterStyle();
|
|
|
|
nscoord GetListStyleAscent() const;
|
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;
|
1998-12-01 19:13:49 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* nsBulletFrame_h___ */
|