Bumping manifests a=b2g-bump
[gecko.git] / layout / generic / nsFrameSetFrame.h
blob1da0dee41bf2414b8be3ba47727f6306f73e1873
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* rendering object for HTML <frameset> elements */
8 #ifndef nsHTMLFrameset_h___
9 #define nsHTMLFrameset_h___
11 #include "mozilla/Attributes.h"
12 #include "nsContainerFrame.h"
13 #include "nsColor.h"
15 class nsIContent;
16 class nsPresContext;
17 struct nsRect;
18 struct nsHTMLReflowState;
19 struct nsSize;
20 class nsIAtom;
21 class nsHTMLFramesetBorderFrame;
22 class nsHTMLFramesetFrame;
24 #define NO_COLOR 0xFFFFFFFA
26 // defined at HTMLFrameSetElement.h
27 struct nsFramesetSpec;
29 struct nsBorderColor
31 nscolor mLeft;
32 nscolor mRight;
33 nscolor mTop;
34 nscolor mBottom;
36 nsBorderColor() { Set(NO_COLOR); }
37 ~nsBorderColor() {}
38 void Set(nscolor aColor) { mLeft = mRight = mTop = mBottom = aColor; }
41 enum nsFrameborder {
42 eFrameborder_Yes = 0,
43 eFrameborder_No,
44 eFrameborder_Notset
47 struct nsFramesetDrag {
48 nsHTMLFramesetFrame* mSource; // frameset whose border was dragged to cause the resize
49 int32_t mIndex; // index of left col or top row of effected area
50 int32_t mChange; // pos for left to right or top to bottom, neg otherwise
51 bool mVertical; // vertical if true, otherwise horizontal
53 nsFramesetDrag();
54 void Reset(bool aVertical,
55 int32_t aIndex,
56 int32_t aChange,
57 nsHTMLFramesetFrame* aSource);
58 void UnSet();
61 /*******************************************************************************
62 * nsHTMLFramesetFrame
63 ******************************************************************************/
64 class nsHTMLFramesetFrame : public nsContainerFrame
66 public:
67 NS_DECL_QUERYFRAME_TARGET(nsHTMLFramesetFrame)
68 NS_DECL_QUERYFRAME
69 NS_DECL_FRAMEARENA_HELPERS
71 explicit nsHTMLFramesetFrame(nsStyleContext* aContext);
73 virtual ~nsHTMLFramesetFrame();
75 virtual void Init(nsIContent* aContent,
76 nsContainerFrame* aParent,
77 nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
79 virtual void SetInitialChildList(ChildListID aListID,
80 nsFrameList& aChildList) MOZ_OVERRIDE;
82 static bool gDragInProgress;
84 void GetSizeOfChild(nsIFrame* aChild, mozilla::WritingMode aWM,
85 mozilla::LogicalSize& aSize);
87 void GetSizeOfChildAt(int32_t aIndexInParent,
88 mozilla::WritingMode aWM,
89 mozilla::LogicalSize& aSize,
90 nsIntPoint& aCellIndex);
92 virtual nsresult HandleEvent(nsPresContext* aPresContext,
93 mozilla::WidgetGUIEvent* aEvent,
94 nsEventStatus* aEventStatus) MOZ_OVERRIDE;
96 virtual nsresult GetCursor(const nsPoint& aPoint,
97 nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
99 virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
100 const nsRect& aDirtyRect,
101 const nsDisplayListSet& aLists) MOZ_OVERRIDE;
103 virtual void Reflow(nsPresContext* aPresContext,
104 nsHTMLReflowMetrics& aDesiredSize,
105 const nsHTMLReflowState& aReflowState,
106 nsReflowStatus& aStatus) MOZ_OVERRIDE;
108 virtual nsIAtom* GetType() const MOZ_OVERRIDE;
109 #ifdef DEBUG_FRAME_DUMP
110 virtual nsresult GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
111 #endif
113 virtual bool IsLeaf() const MOZ_OVERRIDE;
115 void StartMouseDrag(nsPresContext* aPresContext,
116 nsHTMLFramesetBorderFrame* aBorder,
117 mozilla::WidgetGUIEvent* aEvent);
119 void MouseDrag(nsPresContext* aPresContext,
120 mozilla::WidgetGUIEvent* aEvent);
122 void EndMouseDrag(nsPresContext* aPresContext);
124 nsFrameborder GetParentFrameborder() { return mParentFrameborder; }
126 void SetParentFrameborder(nsFrameborder aValue) { mParentFrameborder = aValue; }
128 nsFramesetDrag& GetDrag() { return mDrag; }
130 void RecalculateBorderResize();
132 protected:
133 void Scale(nscoord aDesired,
134 int32_t aNumIndicies,
135 int32_t* aIndicies,
136 int32_t aNumItems,
137 int32_t* aItems);
139 void CalculateRowCol(nsPresContext* aPresContext,
140 nscoord aSize,
141 int32_t aNumSpecs,
142 const nsFramesetSpec* aSpecs,
143 nscoord* aValues);
145 void GenerateRowCol(nsPresContext* aPresContext,
146 nscoord aSize,
147 int32_t aNumSpecs,
148 const nsFramesetSpec* aSpecs,
149 nscoord* aValues,
150 nsString& aNewAttr);
152 virtual void GetDesiredSize(nsPresContext* aPresContext,
153 const nsHTMLReflowState& aReflowState,
154 nsHTMLReflowMetrics& aDesiredSize);
156 int32_t GetBorderWidth(nsPresContext* aPresContext,
157 bool aTakeForcingIntoAccount);
159 int32_t GetParentBorderWidth() { return mParentBorderWidth; }
161 void SetParentBorderWidth(int32_t aWidth) { mParentBorderWidth = aWidth; }
163 nscolor GetParentBorderColor() { return mParentBorderColor; }
165 void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; }
167 nsFrameborder GetFrameBorder();
169 nsFrameborder GetFrameBorder(nsIContent* aContent);
171 nscolor GetBorderColor();
173 nscolor GetBorderColor(nsIContent* aFrameContent);
175 bool GetNoResize(nsIFrame* aChildFrame);
177 void ReflowPlaceChild(nsIFrame* aChild,
178 nsPresContext* aPresContext,
179 const nsHTMLReflowState& aReflowState,
180 nsPoint& aOffset,
181 nsSize& aSize,
182 nsIntPoint* aCellIndex = 0);
184 bool CanResize(bool aVertical, bool aLeft);
186 bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
188 void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
190 static void FrameResizePrefCallback(const char* aPref, void* aClosure);
192 nsFramesetDrag mDrag;
193 nsBorderColor mEdgeColors;
194 nsHTMLFramesetBorderFrame* mDragger;
195 nsHTMLFramesetFrame* mTopLevelFrameset;
196 nsHTMLFramesetBorderFrame** mVerBorders; // vertical borders
197 nsHTMLFramesetBorderFrame** mHorBorders; // horizontal borders
198 nsFrameborder* mChildFrameborder; // the frameborder attr of children
199 nsBorderColor* mChildBorderColors;
200 nscoord* mRowSizes; // currently computed row sizes
201 nscoord* mColSizes; // currently computed col sizes
202 nsIntPoint mFirstDragPoint;
203 int32_t mNumRows;
204 int32_t mNumCols;
205 int32_t mNonBorderChildCount;
206 int32_t mNonBlankChildCount;
207 int32_t mEdgeVisibility;
208 nsFrameborder mParentFrameborder;
209 nscolor mParentBorderColor;
210 int32_t mParentBorderWidth;
211 int32_t mPrevNeighborOrigSize; // used during resize
212 int32_t mNextNeighborOrigSize;
213 int32_t mMinDrag;
214 int32_t mChildCount;
215 bool mForceFrameResizability;
218 #endif