layout/generic/nsFrameSetFrame.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 HTML <frameset> elements */
michael@0 7
michael@0 8 #ifndef nsHTMLFrameset_h___
michael@0 9 #define nsHTMLFrameset_h___
michael@0 10
michael@0 11 #include "mozilla/Attributes.h"
michael@0 12 #include "nsContainerFrame.h"
michael@0 13 #include "nsColor.h"
michael@0 14
michael@0 15 class nsIContent;
michael@0 16 class nsPresContext;
michael@0 17 struct nsRect;
michael@0 18 struct nsHTMLReflowState;
michael@0 19 struct nsSize;
michael@0 20 class nsIAtom;
michael@0 21 class nsHTMLFramesetBorderFrame;
michael@0 22 class nsHTMLFramesetFrame;
michael@0 23
michael@0 24 #define NO_COLOR 0xFFFFFFFA
michael@0 25
michael@0 26 // defined at HTMLFrameSetElement.h
michael@0 27 struct nsFramesetSpec;
michael@0 28
michael@0 29 struct nsBorderColor
michael@0 30 {
michael@0 31 nscolor mLeft;
michael@0 32 nscolor mRight;
michael@0 33 nscolor mTop;
michael@0 34 nscolor mBottom;
michael@0 35
michael@0 36 nsBorderColor() { Set(NO_COLOR); }
michael@0 37 ~nsBorderColor() {}
michael@0 38 void Set(nscolor aColor) { mLeft = mRight = mTop = mBottom = aColor; }
michael@0 39 };
michael@0 40
michael@0 41 enum nsFrameborder {
michael@0 42 eFrameborder_Yes = 0,
michael@0 43 eFrameborder_No,
michael@0 44 eFrameborder_Notset
michael@0 45 };
michael@0 46
michael@0 47 struct nsFramesetDrag {
michael@0 48 nsHTMLFramesetFrame* mSource; // frameset whose border was dragged to cause the resize
michael@0 49 int32_t mIndex; // index of left col or top row of effected area
michael@0 50 int32_t mChange; // pos for left to right or top to bottom, neg otherwise
michael@0 51 bool mVertical; // vertical if true, otherwise horizontal
michael@0 52
michael@0 53 nsFramesetDrag();
michael@0 54 void Reset(bool aVertical,
michael@0 55 int32_t aIndex,
michael@0 56 int32_t aChange,
michael@0 57 nsHTMLFramesetFrame* aSource);
michael@0 58 void UnSet();
michael@0 59 };
michael@0 60
michael@0 61 /*******************************************************************************
michael@0 62 * nsHTMLFramesetFrame
michael@0 63 ******************************************************************************/
michael@0 64 class nsHTMLFramesetFrame : public nsContainerFrame
michael@0 65 {
michael@0 66 public:
michael@0 67 NS_DECL_QUERYFRAME_TARGET(nsHTMLFramesetFrame)
michael@0 68 NS_DECL_QUERYFRAME
michael@0 69 NS_DECL_FRAMEARENA_HELPERS
michael@0 70
michael@0 71 nsHTMLFramesetFrame(nsStyleContext* aContext);
michael@0 72
michael@0 73 virtual ~nsHTMLFramesetFrame();
michael@0 74
michael@0 75 virtual void Init(nsIContent* aContent,
michael@0 76 nsIFrame* aParent,
michael@0 77 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
michael@0 78
michael@0 79 virtual nsresult SetInitialChildList(ChildListID aListID,
michael@0 80 nsFrameList& aChildList) MOZ_OVERRIDE;
michael@0 81
michael@0 82 static bool gDragInProgress;
michael@0 83
michael@0 84 void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
michael@0 85
michael@0 86 void GetSizeOfChildAt(int32_t aIndexInParent,
michael@0 87 nsSize& aSize,
michael@0 88 nsIntPoint& aCellIndex);
michael@0 89
michael@0 90 virtual nsresult HandleEvent(nsPresContext* aPresContext,
michael@0 91 mozilla::WidgetGUIEvent* aEvent,
michael@0 92 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
michael@0 93
michael@0 94 virtual nsresult GetCursor(const nsPoint& aPoint,
michael@0 95 nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
michael@0 96
michael@0 97 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
michael@0 98 const nsRect& aDirtyRect,
michael@0 99 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
michael@0 100
michael@0 101 virtual nsresult Reflow(nsPresContext* aPresContext,
michael@0 102 nsHTMLReflowMetrics& aDesiredSize,
michael@0 103 const nsHTMLReflowState& aReflowState,
michael@0 104 nsReflowStatus& aStatus) MOZ_OVERRIDE;
michael@0 105
michael@0 106 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
michael@0 107 #ifdef DEBUG_FRAME_DUMP
michael@0 108 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
michael@0 109 #endif
michael@0 110
michael@0 111 virtual bool IsLeaf() const MOZ_OVERRIDE;
michael@0 112
michael@0 113 void StartMouseDrag(nsPresContext* aPresContext,
michael@0 114 nsHTMLFramesetBorderFrame* aBorder,
michael@0 115 mozilla::WidgetGUIEvent* aEvent);
michael@0 116
michael@0 117 void MouseDrag(nsPresContext* aPresContext,
michael@0 118 mozilla::WidgetGUIEvent* aEvent);
michael@0 119
michael@0 120 void EndMouseDrag(nsPresContext* aPresContext);
michael@0 121
michael@0 122 nsFrameborder GetParentFrameborder() { return mParentFrameborder; }
michael@0 123
michael@0 124 void SetParentFrameborder(nsFrameborder aValue) { mParentFrameborder = aValue; }
michael@0 125
michael@0 126 nsFramesetDrag& GetDrag() { return mDrag; }
michael@0 127
michael@0 128 void RecalculateBorderResize();
michael@0 129
michael@0 130 protected:
michael@0 131 void Scale(nscoord aDesired,
michael@0 132 int32_t aNumIndicies,
michael@0 133 int32_t* aIndicies,
michael@0 134 int32_t aNumItems,
michael@0 135 int32_t* aItems);
michael@0 136
michael@0 137 void CalculateRowCol(nsPresContext* aPresContext,
michael@0 138 nscoord aSize,
michael@0 139 int32_t aNumSpecs,
michael@0 140 const nsFramesetSpec* aSpecs,
michael@0 141 nscoord* aValues);
michael@0 142
michael@0 143 void GenerateRowCol(nsPresContext* aPresContext,
michael@0 144 nscoord aSize,
michael@0 145 int32_t aNumSpecs,
michael@0 146 const nsFramesetSpec* aSpecs,
michael@0 147 nscoord* aValues,
michael@0 148 nsString& aNewAttr);
michael@0 149
michael@0 150 virtual void GetDesiredSize(nsPresContext* aPresContext,
michael@0 151 const nsHTMLReflowState& aReflowState,
michael@0 152 nsHTMLReflowMetrics& aDesiredSize);
michael@0 153
michael@0 154 int32_t GetBorderWidth(nsPresContext* aPresContext,
michael@0 155 bool aTakeForcingIntoAccount);
michael@0 156
michael@0 157 int32_t GetParentBorderWidth() { return mParentBorderWidth; }
michael@0 158
michael@0 159 void SetParentBorderWidth(int32_t aWidth) { mParentBorderWidth = aWidth; }
michael@0 160
michael@0 161 nscolor GetParentBorderColor() { return mParentBorderColor; }
michael@0 162
michael@0 163 void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; }
michael@0 164
michael@0 165 nsFrameborder GetFrameBorder();
michael@0 166
michael@0 167 nsFrameborder GetFrameBorder(nsIContent* aContent);
michael@0 168
michael@0 169 nscolor GetBorderColor();
michael@0 170
michael@0 171 nscolor GetBorderColor(nsIContent* aFrameContent);
michael@0 172
michael@0 173 bool GetNoResize(nsIFrame* aChildFrame);
michael@0 174
michael@0 175 void ReflowPlaceChild(nsIFrame* aChild,
michael@0 176 nsPresContext* aPresContext,
michael@0 177 const nsHTMLReflowState& aReflowState,
michael@0 178 nsPoint& aOffset,
michael@0 179 nsSize& aSize,
michael@0 180 nsIntPoint* aCellIndex = 0);
michael@0 181
michael@0 182 bool CanResize(bool aVertical, bool aLeft);
michael@0 183
michael@0 184 bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
michael@0 185
michael@0 186 void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
michael@0 187
michael@0 188 static void FrameResizePrefCallback(const char* aPref, void* aClosure);
michael@0 189
michael@0 190 nsFramesetDrag mDrag;
michael@0 191 nsBorderColor mEdgeColors;
michael@0 192 nsHTMLFramesetBorderFrame* mDragger;
michael@0 193 nsHTMLFramesetFrame* mTopLevelFrameset;
michael@0 194 nsHTMLFramesetBorderFrame** mVerBorders; // vertical borders
michael@0 195 nsHTMLFramesetBorderFrame** mHorBorders; // horizontal borders
michael@0 196 nsFrameborder* mChildFrameborder; // the frameborder attr of children
michael@0 197 nsBorderColor* mChildBorderColors;
michael@0 198 nscoord* mRowSizes; // currently computed row sizes
michael@0 199 nscoord* mColSizes; // currently computed col sizes
michael@0 200 nsIntPoint mFirstDragPoint;
michael@0 201 int32_t mNumRows;
michael@0 202 int32_t mNumCols;
michael@0 203 int32_t mNonBorderChildCount;
michael@0 204 int32_t mNonBlankChildCount;
michael@0 205 int32_t mEdgeVisibility;
michael@0 206 nsFrameborder mParentFrameborder;
michael@0 207 nscolor mParentBorderColor;
michael@0 208 int32_t mParentBorderWidth;
michael@0 209 int32_t mPrevNeighborOrigSize; // used during resize
michael@0 210 int32_t mNextNeighborOrigSize;
michael@0 211 int32_t mMinDrag;
michael@0 212 int32_t mChildCount;
michael@0 213 bool mForceFrameResizability;
michael@0 214 };
michael@0 215
michael@0 216 #endif

mercurial