2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 18:29:03 +00:00
|
|
|
|
|
|
|
/* rendering object for HTML <frameset> elements */
|
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
#ifndef nsHTMLFrameset_h___
|
|
|
|
#define nsHTMLFrameset_h___
|
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 20:18:48 +00:00
|
|
|
#include "nsContainerFrame.h"
|
1998-09-24 21:37:45 +00:00
|
|
|
#include "nsColor.h"
|
1998-07-15 23:42:14 +00:00
|
|
|
|
|
|
|
class nsIContent;
|
2004-07-31 23:15:21 +00:00
|
|
|
class nsPresContext;
|
1998-07-15 23:42:14 +00:00
|
|
|
struct nsRect;
|
1998-10-02 04:10:00 +00:00
|
|
|
struct nsHTMLReflowState;
|
1998-07-15 23:42:14 +00:00
|
|
|
struct nsSize;
|
|
|
|
class nsIAtom;
|
1998-09-03 01:16:27 +00:00
|
|
|
class nsHTMLFramesetBorderFrame;
|
|
|
|
class nsHTMLFramesetFrame;
|
|
|
|
|
|
|
|
#define NO_COLOR 0xFFFFFFFA
|
|
|
|
|
2012-12-21 14:06:50 +00:00
|
|
|
// defined at HTMLFrameSetElement.h
|
2011-06-08 19:04:10 +00:00
|
|
|
struct nsFramesetSpec;
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
struct nsBorderColor
|
|
|
|
{
|
|
|
|
nscolor mLeft;
|
|
|
|
nscolor mRight;
|
|
|
|
nscolor mTop;
|
|
|
|
nscolor mBottom;
|
|
|
|
|
|
|
|
nsBorderColor() { Set(NO_COLOR); }
|
|
|
|
~nsBorderColor() {}
|
|
|
|
void Set(nscolor aColor) { mLeft = mRight = mTop = mBottom = aColor; }
|
|
|
|
};
|
1998-07-15 23:42:14 +00:00
|
|
|
|
1998-08-06 19:40:37 +00:00
|
|
|
enum nsFrameborder {
|
|
|
|
eFrameborder_Yes = 0,
|
|
|
|
eFrameborder_No,
|
|
|
|
eFrameborder_Notset
|
|
|
|
};
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
struct nsFramesetDrag {
|
2009-05-12 10:13:09 +00:00
|
|
|
nsHTMLFramesetFrame* mSource; // frameset whose border was dragged to cause the resize
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mIndex; // index of left col or top row of effected area
|
|
|
|
int32_t mChange; // pos for left to right or top to bottom, neg otherwise
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mVertical; // vertical if true, otherwise horizontal
|
1999-03-10 06:13:35 +00:00
|
|
|
|
|
|
|
nsFramesetDrag();
|
2011-09-29 06:19:26 +00:00
|
|
|
void Reset(bool aVertical,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aIndex,
|
|
|
|
int32_t aChange,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsHTMLFramesetFrame* aSource);
|
|
|
|
void UnSet();
|
1998-09-03 01:16:27 +00:00
|
|
|
};
|
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetFrame
|
|
|
|
******************************************************************************/
|
2011-12-27 20:18:48 +00:00
|
|
|
class nsHTMLFramesetFrame : public nsContainerFrame
|
2001-11-02 02:19:49 +00:00
|
|
|
{
|
2002-04-05 05:42:10 +00:00
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsHTMLFramesetFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2002-04-17 04:17:16 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsHTMLFramesetFrame(nsStyleContext* aContext);
|
1998-07-15 23:42:14 +00:00
|
|
|
|
1998-07-20 18:52:40 +00:00
|
|
|
virtual ~nsHTMLFramesetFrame();
|
|
|
|
|
2013-03-20 01:47:48 +00:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
1998-09-03 01:16:27 +00:00
|
|
|
|
2011-08-24 20:54:30 +00:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2013-05-14 16:33:23 +00:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
2009-01-19 18:31:31 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
static bool gDragInProgress;
|
1999-03-10 06:13:35 +00:00
|
|
|
|
1998-07-21 23:20:04 +00:00
|
|
|
void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
|
1998-07-20 18:52:40 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void GetSizeOfChildAt(int32_t aIndexInParent,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsSize& aSize,
|
2009-01-15 03:27:09 +00:00
|
|
|
nsIntPoint& aCellIndex);
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
2013-10-02 03:46:03 +00:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus) MOZ_OVERRIDE;
|
1998-09-03 01:16:27 +00:00
|
|
|
|
2004-12-30 21:56:11 +00:00
|
|
|
NS_IMETHOD GetCursor(const nsPoint& aPoint,
|
2012-09-14 16:10:08 +00:00
|
|
|
nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2013-02-14 11:12:27 +00:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 16:10:08 +00:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
1998-09-03 01:16:27 +00:00
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2014-01-05 23:31:14 +00:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2012-09-14 16:10:08 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
Bug 300030: Move intrinsic width computation out of nsIFrame::Reflow and into its own methods on nsIFrame. Replace reflow reasons, types, and commands with dirty bits/notifications. Thanks to bzbarsky for almost all of the HTML form controls (mozilla/layout/forms) changes, and many others for help testing and patching. For detailed commit logs, see REFLOW_YYYYMMDD_BRANCH, where YYYYMMDD is one of 20061031, 20060830, 20060603, 20060302, 20060119, 20051011, 20050804, 20050429, 20050315, 20050111, and 20041213.
2006-12-08 05:38:33 +00:00
|
|
|
#endif
|
2005-09-06 02:14:36 +00:00
|
|
|
|
2012-09-14 16:10:08 +00:00
|
|
|
virtual bool IsLeaf() const MOZ_OVERRIDE;
|
2005-08-16 22:52:48 +00:00
|
|
|
|
2013-10-02 03:46:03 +00:00
|
|
|
void StartMouseDrag(nsPresContext* aPresContext,
|
|
|
|
nsHTMLFramesetBorderFrame* aBorder,
|
|
|
|
mozilla::WidgetGUIEvent* aEvent);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
void MouseDrag(nsPresContext* aPresContext,
|
2013-10-02 03:46:03 +00:00
|
|
|
mozilla::WidgetGUIEvent* aEvent);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
void EndMouseDrag(nsPresContext* aPresContext);
|
1998-09-03 01:16:27 +00:00
|
|
|
|
1998-08-06 19:40:37 +00:00
|
|
|
nsFrameborder GetParentFrameborder() { return mParentFrameborder; }
|
|
|
|
|
1999-03-10 06:13:35 +00:00
|
|
|
void SetParentFrameborder(nsFrameborder aValue) { mParentFrameborder = aValue; }
|
1998-11-28 18:59:38 +00:00
|
|
|
|
1999-03-10 06:13:35 +00:00
|
|
|
nsFramesetDrag& GetDrag() { return mDrag; }
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2001-04-12 08:16:54 +00:00
|
|
|
void RecalculateBorderResize();
|
|
|
|
|
1999-03-10 06:13:35 +00:00
|
|
|
protected:
|
|
|
|
void Scale(nscoord aDesired,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aNumIndicies,
|
|
|
|
int32_t* aIndicies,
|
|
|
|
int32_t aNumItems,
|
|
|
|
int32_t* aItems);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
void CalculateRowCol(nsPresContext* aPresContext,
|
2002-08-06 01:06:50 +00:00
|
|
|
nscoord aSize,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aNumSpecs,
|
2002-08-06 01:06:50 +00:00
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
void GenerateRowCol(nsPresContext* aPresContext,
|
2002-08-06 01:06:50 +00:00
|
|
|
nscoord aSize,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aNumSpecs,
|
2002-08-06 01:06:50 +00:00
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues,
|
|
|
|
nsString& aNewAttr);
|
1999-06-11 00:51:05 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
virtual void GetDesiredSize(nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t GetBorderWidth(nsPresContext* aPresContext,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aTakeForcingIntoAccount);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t GetParentBorderWidth() { return mParentBorderWidth; }
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void SetParentBorderWidth(int32_t aWidth) { mParentBorderWidth = aWidth; }
|
1999-03-10 06:13:35 +00:00
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
nscolor GetParentBorderColor() { return mParentBorderColor; }
|
1999-03-10 06:13:35 +00:00
|
|
|
|
|
|
|
void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; }
|
1998-07-27 05:59:37 +00:00
|
|
|
|
2001-12-07 19:40:07 +00:00
|
|
|
nsFrameborder GetFrameBorder();
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2001-12-07 19:40:07 +00:00
|
|
|
nsFrameborder GetFrameBorder(nsIContent* aContent);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
nscolor GetBorderColor();
|
1999-03-10 06:13:35 +00:00
|
|
|
|
1998-09-09 23:30:30 +00:00
|
|
|
nscolor GetBorderColor(nsIContent* aFrameContent);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetNoResize(nsIFrame* aChildFrame);
|
1998-07-30 21:25:35 +00:00
|
|
|
|
1998-10-02 04:10:00 +00:00
|
|
|
void ReflowPlaceChild(nsIFrame* aChild,
|
2004-07-31 23:15:21 +00:00
|
|
|
nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsPoint& aOffset,
|
|
|
|
nsSize& aSize,
|
2009-01-15 03:27:09 +00:00
|
|
|
nsIntPoint* aCellIndex = 0);
|
1998-09-03 01:16:27 +00:00
|
|
|
|
2012-12-01 02:28:02 +00:00
|
|
|
bool CanResize(bool aVertical, bool aLeft);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2012-12-01 02:28:02 +00:00
|
|
|
bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
|
1999-03-10 06:13:35 +00:00
|
|
|
|
2012-12-01 02:28:02 +00:00
|
|
|
void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
|
1998-09-03 01:16:27 +00:00
|
|
|
|
2013-12-10 23:10:01 +00:00
|
|
|
static void FrameResizePrefCallback(const char* aPref, void* aClosure);
|
2004-04-29 23:34:19 +00:00
|
|
|
|
2009-05-12 10:13:09 +00:00
|
|
|
nsFramesetDrag mDrag;
|
|
|
|
nsBorderColor mEdgeColors;
|
|
|
|
nsHTMLFramesetBorderFrame* mDragger;
|
|
|
|
nsHTMLFramesetFrame* mTopLevelFrameset;
|
|
|
|
nsHTMLFramesetBorderFrame** mVerBorders; // vertical borders
|
|
|
|
nsHTMLFramesetBorderFrame** mHorBorders; // horizontal borders
|
|
|
|
nsFrameborder* mChildFrameborder; // the frameborder attr of children
|
|
|
|
nsBorderColor* mChildBorderColors;
|
|
|
|
nscoord* mRowSizes; // currently computed row sizes
|
|
|
|
nscoord* mColSizes; // currently computed col sizes
|
|
|
|
nsIntPoint mFirstDragPoint;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mNumRows;
|
|
|
|
int32_t mNumCols;
|
|
|
|
int32_t mNonBorderChildCount;
|
|
|
|
int32_t mNonBlankChildCount;
|
|
|
|
int32_t mEdgeVisibility;
|
1998-08-06 19:40:37 +00:00
|
|
|
nsFrameborder mParentFrameborder;
|
1998-09-03 01:16:27 +00:00
|
|
|
nscolor mParentBorderColor;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mParentBorderWidth;
|
|
|
|
int32_t mPrevNeighborOrigSize; // used during resize
|
|
|
|
int32_t mNextNeighborOrigSize;
|
|
|
|
int32_t mMinDrag;
|
|
|
|
int32_t mChildCount;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mForceFrameResizability;
|
1998-07-15 23:42:14 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|