layout/xul/nsTextBoxFrame.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

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 #ifndef nsTextBoxFrame_h___
michael@0 6 #define nsTextBoxFrame_h___
michael@0 7
michael@0 8 #include "mozilla/Attributes.h"
michael@0 9 #include "nsLeafBoxFrame.h"
michael@0 10
michael@0 11 class nsAccessKeyInfo;
michael@0 12 class nsAsyncAccesskeyUpdate;
michael@0 13
michael@0 14 typedef nsLeafBoxFrame nsTextBoxFrameSuper;
michael@0 15 class nsTextBoxFrame : public nsTextBoxFrameSuper
michael@0 16 {
michael@0 17 public:
michael@0 18 NS_DECL_QUERYFRAME_TARGET(nsTextBoxFrame)
michael@0 19 NS_DECL_QUERYFRAME
michael@0 20 NS_DECL_FRAMEARENA_HELPERS
michael@0 21
michael@0 22 virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 23 virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 24 virtual nscoord GetBoxAscent(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 25 NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState) MOZ_OVERRIDE;
michael@0 26 virtual void MarkIntrinsicWidthsDirty() MOZ_OVERRIDE;
michael@0 27
michael@0 28 enum CroppingStyle { CropNone, CropLeft, CropRight, CropCenter };
michael@0 29
michael@0 30 friend nsIFrame* NS_NewTextBoxFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
michael@0 31
michael@0 32 virtual void Init(nsIContent* aContent,
michael@0 33 nsIFrame* aParent,
michael@0 34 nsIFrame* asPrevInFlow) MOZ_OVERRIDE;
michael@0 35
michael@0 36 virtual void DestroyFrom(nsIFrame* aDestructRoot) MOZ_OVERRIDE;
michael@0 37
michael@0 38 virtual nsresult AttributeChanged(int32_t aNameSpaceID,
michael@0 39 nsIAtom* aAttribute,
michael@0 40 int32_t aModType) MOZ_OVERRIDE;
michael@0 41
michael@0 42 #ifdef DEBUG_FRAME_DUMP
michael@0 43 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
michael@0 44 #endif
michael@0 45
michael@0 46 void UpdateAttributes(nsIAtom* aAttribute,
michael@0 47 bool& aResize,
michael@0 48 bool& aRedraw);
michael@0 49
michael@0 50 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
michael@0 51 const nsRect& aDirtyRect,
michael@0 52 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
michael@0 53
michael@0 54 virtual ~nsTextBoxFrame();
michael@0 55
michael@0 56 void PaintTitle(nsRenderingContext& aRenderingContext,
michael@0 57 const nsRect& aDirtyRect,
michael@0 58 nsPoint aPt,
michael@0 59 const nscolor* aOverrideColor);
michael@0 60
michael@0 61 nsRect GetComponentAlphaBounds();
michael@0 62
michael@0 63 virtual bool ComputesOwnOverflowArea() MOZ_OVERRIDE;
michael@0 64
michael@0 65 void GetCroppedTitle(nsString& aTitle) const { aTitle = mCroppedTitle; }
michael@0 66
michael@0 67 protected:
michael@0 68 friend class nsAsyncAccesskeyUpdate;
michael@0 69 friend class nsDisplayXULTextBox;
michael@0 70 // Should be called only by nsAsyncAccesskeyUpdate.
michael@0 71 // Returns true if accesskey was updated.
michael@0 72 bool UpdateAccesskey(nsWeakFrame& aWeakThis);
michael@0 73 void UpdateAccessTitle();
michael@0 74 void UpdateAccessIndex();
michael@0 75
michael@0 76 // REVIEW: SORRY! Couldn't resist devirtualizing these
michael@0 77 void LayoutTitle(nsPresContext* aPresContext,
michael@0 78 nsRenderingContext& aRenderingContext,
michael@0 79 const nsRect& aRect);
michael@0 80
michael@0 81 void CalculateUnderline(nsRenderingContext& aRenderingContext);
michael@0 82
michael@0 83 void CalcTextSize(nsBoxLayoutState& aBoxLayoutState);
michael@0 84
michael@0 85 void CalcDrawRect(nsRenderingContext &aRenderingContext);
michael@0 86
michael@0 87 nsTextBoxFrame(nsIPresShell* aShell, nsStyleContext* aContext);
michael@0 88
michael@0 89 nscoord CalculateTitleForWidth(nsPresContext* aPresContext,
michael@0 90 nsRenderingContext& aRenderingContext,
michael@0 91 nscoord aWidth);
michael@0 92
michael@0 93 void GetTextSize(nsPresContext* aPresContext,
michael@0 94 nsRenderingContext& aRenderingContext,
michael@0 95 const nsString& aString,
michael@0 96 nsSize& aSize,
michael@0 97 nscoord& aAscent);
michael@0 98
michael@0 99 nsresult RegUnregAccessKey(bool aDoReg);
michael@0 100
michael@0 101 private:
michael@0 102
michael@0 103 bool AlwaysAppendAccessKey();
michael@0 104 bool InsertSeparatorBeforeAccessKey();
michael@0 105
michael@0 106 void DrawText(nsRenderingContext& aRenderingContext,
michael@0 107 const nsRect& aDirtyRect,
michael@0 108 const nsRect& aTextRect,
michael@0 109 const nscolor* aOverrideColor);
michael@0 110
michael@0 111 nsString mTitle;
michael@0 112 nsString mCroppedTitle;
michael@0 113 nsString mAccessKey;
michael@0 114 nsSize mTextSize;
michael@0 115 nsRect mTextDrawRect;
michael@0 116 nsAccessKeyInfo* mAccessKeyInfo;
michael@0 117
michael@0 118 CroppingStyle mCropType;
michael@0 119 nscoord mAscent;
michael@0 120 bool mNeedsRecalc;
michael@0 121 bool mNeedsReflowCallback;
michael@0 122
michael@0 123 static bool gAlwaysAppendAccessKey;
michael@0 124 static bool gAccessKeyPrefInitialized;
michael@0 125 static bool gInsertSeparatorBeforeAccessKey;
michael@0 126 static bool gInsertSeparatorPrefInitialized;
michael@0 127
michael@0 128 }; // class nsTextBoxFrame
michael@0 129
michael@0 130 #endif /* nsTextBoxFrame_h___ */

mercurial