layout/generic/nsBulletFrame.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /* rendering object for list-item bullets */
michael@0 7
michael@0 8 #ifndef nsBulletFrame_h___
michael@0 9 #define nsBulletFrame_h___
michael@0 10
michael@0 11 #include "mozilla/Attributes.h"
michael@0 12 #include "nsFrame.h"
michael@0 13
michael@0 14 #include "imgINotificationObserver.h"
michael@0 15
michael@0 16 class imgIContainer;
michael@0 17 class imgRequestProxy;
michael@0 18
michael@0 19 class nsBulletFrame;
michael@0 20
michael@0 21 class nsBulletListener : public imgINotificationObserver
michael@0 22 {
michael@0 23 public:
michael@0 24 nsBulletListener();
michael@0 25 virtual ~nsBulletListener();
michael@0 26
michael@0 27 NS_DECL_ISUPPORTS
michael@0 28 NS_DECL_IMGINOTIFICATIONOBSERVER
michael@0 29
michael@0 30 void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
michael@0 31
michael@0 32 private:
michael@0 33 nsBulletFrame *mFrame;
michael@0 34 };
michael@0 35
michael@0 36 /**
michael@0 37 * A simple class that manages the layout and rendering of html bullets.
michael@0 38 * This class also supports the CSS list-style properties.
michael@0 39 */
michael@0 40 class nsBulletFrame : public nsFrame {
michael@0 41 public:
michael@0 42 NS_DECL_FRAMEARENA_HELPERS
michael@0 43 #ifdef DEBUG
michael@0 44 NS_DECL_QUERYFRAME_TARGET(nsBulletFrame)
michael@0 45 NS_DECL_QUERYFRAME
michael@0 46 #endif
michael@0 47
michael@0 48 nsBulletFrame(nsStyleContext* aContext)
michael@0 49 : nsFrame(aContext)
michael@0 50 {
michael@0 51 }
michael@0 52 virtual ~nsBulletFrame();
michael@0 53
michael@0 54 NS_IMETHOD Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData);
michael@0 55
michael@0 56 // nsIFrame
michael@0 57 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
michael@0 58 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
michael@0 59 const nsRect& aDirtyRect,
michael@0 60 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
michael@0 61 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
michael@0 62 virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) MOZ_OVERRIDE;
michael@0 63 #ifdef DEBUG_FRAME_DUMP
michael@0 64 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
michael@0 65 #endif
michael@0 66
michael@0 67 // nsIHTMLReflow
michael@0 68 virtual nsresult Reflow(nsPresContext* aPresContext,
michael@0 69 nsHTMLReflowMetrics& aMetrics,
michael@0 70 const nsHTMLReflowState& aReflowState,
michael@0 71 nsReflowStatus& aStatus) MOZ_OVERRIDE;
michael@0 72 virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
michael@0 73 virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) MOZ_OVERRIDE;
michael@0 74
michael@0 75 // nsBulletFrame
michael@0 76 int32_t SetListItemOrdinal(int32_t aNextOrdinal, bool* aChanged,
michael@0 77 int32_t aIncrement);
michael@0 78
michael@0 79
michael@0 80 /* get list item text, without '.' */
michael@0 81 static void AppendCounterText(int32_t aListStyleType,
michael@0 82 int32_t aOrdinal,
michael@0 83 nsString& aResult,
michael@0 84 bool& aIsRTL);
michael@0 85
michael@0 86 /* get suffix of list item */
michael@0 87 static void GetListItemSuffix(int32_t aListStyleType,
michael@0 88 nsString& aResult,
michael@0 89 bool& aSuppressPadding);
michael@0 90
michael@0 91 /* get list item text, with '.' */
michael@0 92 void GetListItemText(const nsStyleList& aStyleList, nsString& aResult);
michael@0 93
michael@0 94 void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
michael@0 95 const nsRect& aDirtyRect, uint32_t aFlags);
michael@0 96
michael@0 97 virtual bool IsEmpty() MOZ_OVERRIDE;
michael@0 98 virtual bool IsSelfEmpty() MOZ_OVERRIDE;
michael@0 99 virtual nscoord GetBaseline() const MOZ_OVERRIDE;
michael@0 100
michael@0 101 float GetFontSizeInflation() const;
michael@0 102 bool HasFontSizeInflation() const {
michael@0 103 return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION) != 0;
michael@0 104 }
michael@0 105 void SetFontSizeInflation(float aInflation);
michael@0 106
michael@0 107 int32_t GetOrdinal() { return mOrdinal; }
michael@0 108
michael@0 109 already_AddRefed<imgIContainer> GetImage() const;
michael@0 110
michael@0 111 protected:
michael@0 112 nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
michael@0 113
michael@0 114 void GetDesiredSize(nsPresContext* aPresContext,
michael@0 115 nsRenderingContext *aRenderingContext,
michael@0 116 nsHTMLReflowMetrics& aMetrics,
michael@0 117 float aFontSizeInflation);
michael@0 118
michael@0 119 void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
michael@0 120
michael@0 121 nsMargin mPadding;
michael@0 122 nsRefPtr<imgRequestProxy> mImageRequest;
michael@0 123 nsRefPtr<nsBulletListener> mListener;
michael@0 124
michael@0 125 nsSize mIntrinsicSize;
michael@0 126 int32_t mOrdinal;
michael@0 127 bool mTextIsRTL;
michael@0 128
michael@0 129 // If set to true, any padding of bullet defined in the UA style sheet will
michael@0 130 // be suppressed. This is used for some CJK numbering styles where extra
michael@0 131 // space after the suffix is not desired. Note that, any author-specified
michael@0 132 // padding overriding the default style will NOT be suppressed.
michael@0 133 bool mSuppressPadding;
michael@0 134
michael@0 135 private:
michael@0 136
michael@0 137 // This is a boolean flag indicating whether or not the current image request
michael@0 138 // has been registered with the refresh driver.
michael@0 139 bool mRequestRegistered;
michael@0 140 };
michael@0 141
michael@0 142 #endif /* nsBulletFrame_h___ */

mercurial