2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* rendering object for HTML <frameset> elements */
|
|
|
|
|
|
|
|
#ifndef nsHTMLFrameset_h___
|
|
|
|
#define nsHTMLFrameset_h___
|
|
|
|
|
|
|
|
#include "nsGkAtoms.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsColor.h"
|
|
|
|
#include "nsIObserver.h"
|
|
|
|
#include "nsWeakPtr.h"
|
|
|
|
|
|
|
|
class nsIContent;
|
|
|
|
class nsIFrame;
|
|
|
|
class nsPresContext;
|
2011-04-07 18:04:40 -07:00
|
|
|
class nsRenderingContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
struct nsRect;
|
|
|
|
struct nsHTMLReflowState;
|
|
|
|
struct nsSize;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsHTMLFramesetBorderFrame;
|
|
|
|
class nsGUIEvent;
|
|
|
|
class nsHTMLFramesetFrame;
|
|
|
|
|
|
|
|
#define NO_COLOR 0xFFFFFFFA
|
|
|
|
|
2011-06-08 12:04:10 -07:00
|
|
|
// defined at nsHTMLFrameSetElement.h
|
|
|
|
struct nsFramesetSpec;
|
|
|
|
|
2007-03-22 10:30:00 -07: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; }
|
|
|
|
};
|
|
|
|
|
|
|
|
enum nsFrameborder {
|
|
|
|
eFrameborder_Yes = 0,
|
|
|
|
eFrameborder_No,
|
|
|
|
eFrameborder_Notset
|
|
|
|
};
|
|
|
|
|
|
|
|
struct nsFramesetDrag {
|
2009-05-12 03:13:09 -07:00
|
|
|
nsHTMLFramesetFrame* mSource; // frameset whose border was dragged to cause the resize
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 mIndex; // index of left col or top row of effected area
|
|
|
|
PRInt32 mChange; // pos for left to right or top to bottom, neg otherwise
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mVertical; // vertical if true, otherwise horizontal
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsFramesetDrag();
|
2011-09-28 23:19:26 -07:00
|
|
|
void Reset(bool aVertical,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 aIndex,
|
|
|
|
PRInt32 aChange,
|
|
|
|
nsHTMLFramesetFrame* aSource);
|
|
|
|
void UnSet();
|
|
|
|
};
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetFrame
|
|
|
|
******************************************************************************/
|
2011-12-27 12:18:48 -08:00
|
|
|
class nsHTMLFramesetFrame : public nsContainerFrame
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2009-09-12 09:49:24 -07:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsHTMLFramesetFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsHTMLFramesetFrame(nsStyleContext* aContext);
|
|
|
|
|
|
|
|
virtual ~nsHTMLFramesetFrame();
|
|
|
|
|
|
|
|
NS_IMETHOD Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow);
|
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2009-07-28 05:53:20 -07:00
|
|
|
nsFrameList& aChildList);
|
2009-01-19 10:31:31 -08:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
static bool gDragInProgress;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void GetSizeOfChild(nsIFrame* aChild, nsSize& aSize);
|
|
|
|
|
|
|
|
void GetSizeOfChildAt(PRInt32 aIndexInParent,
|
|
|
|
nsSize& aSize,
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntPoint& aCellIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static nsHTMLFramesetFrame* GetFramesetParent(nsIFrame* aChild);
|
|
|
|
|
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
|
|
|
nsGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus);
|
|
|
|
|
|
|
|
NS_IMETHOD GetCursor(const nsPoint& aPoint,
|
|
|
|
nsIFrame::Cursor& aCursor);
|
|
|
|
|
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
|
|
|
virtual nsIAtom* GetType() const;
|
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
|
|
|
#endif
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsLeaf() const;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void StartMouseDrag(nsPresContext* aPresContext,
|
|
|
|
nsHTMLFramesetBorderFrame* aBorder,
|
|
|
|
nsGUIEvent* aEvent);
|
|
|
|
|
|
|
|
void MouseDrag(nsPresContext* aPresContext,
|
|
|
|
nsGUIEvent* aEvent);
|
|
|
|
|
|
|
|
void EndMouseDrag(nsPresContext* aPresContext);
|
|
|
|
|
|
|
|
nsFrameborder GetParentFrameborder() { return mParentFrameborder; }
|
|
|
|
|
|
|
|
void SetParentFrameborder(nsFrameborder aValue) { mParentFrameborder = aValue; }
|
|
|
|
|
|
|
|
nsFramesetDrag& GetDrag() { return mDrag; }
|
|
|
|
|
|
|
|
void RecalculateBorderResize();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void Scale(nscoord aDesired,
|
|
|
|
PRInt32 aNumIndicies,
|
|
|
|
PRInt32* aIndicies,
|
|
|
|
PRInt32 aNumItems,
|
|
|
|
PRInt32* aItems);
|
|
|
|
|
|
|
|
void CalculateRowCol(nsPresContext* aPresContext,
|
|
|
|
nscoord aSize,
|
|
|
|
PRInt32 aNumSpecs,
|
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues);
|
|
|
|
|
|
|
|
void GenerateRowCol(nsPresContext* aPresContext,
|
|
|
|
nscoord aSize,
|
|
|
|
PRInt32 aNumSpecs,
|
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues,
|
|
|
|
nsString& aNewAttr);
|
|
|
|
|
|
|
|
virtual void GetDesiredSize(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
|
|
|
|
|
|
|
PRInt32 GetBorderWidth(nsPresContext* aPresContext,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aTakeForcingIntoAccount);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
PRInt32 GetParentBorderWidth() { return mParentBorderWidth; }
|
|
|
|
|
|
|
|
void SetParentBorderWidth(PRInt32 aWidth) { mParentBorderWidth = aWidth; }
|
|
|
|
|
|
|
|
nscolor GetParentBorderColor() { return mParentBorderColor; }
|
|
|
|
|
|
|
|
void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; }
|
|
|
|
|
|
|
|
nsFrameborder GetFrameBorder();
|
|
|
|
|
|
|
|
nsFrameborder GetFrameBorder(nsIContent* aContent);
|
|
|
|
|
|
|
|
nscolor GetBorderColor();
|
|
|
|
|
|
|
|
nscolor GetBorderColor(nsIContent* aFrameContent);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool GetNoResize(nsIFrame* aChildFrame);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
|
|
|
|
|
|
|
void ReflowPlaceChild(nsIFrame* aChild,
|
|
|
|
nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsPoint& aOffset,
|
|
|
|
nsSize& aSize,
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntPoint* aCellIndex = 0);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool CanResize(bool aVertical,
|
|
|
|
bool aLeft);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool CanChildResize(bool aVertical,
|
|
|
|
bool aLeft,
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 aChildX,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aFrameset);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void SetBorderResize(PRInt32* aChildTypes,
|
|
|
|
nsHTMLFramesetBorderFrame* aBorderFrame);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ChildIsFrameset(nsIFrame* aChild);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
static int FrameResizePrefCallback(const char* aPref, void* aClosure);
|
|
|
|
|
2009-05-12 03:13:09 -07:00
|
|
|
nsFramesetDrag mDrag;
|
|
|
|
nsBorderColor mEdgeColors;
|
|
|
|
nsHTMLFramesetBorderFrame* mDragger;
|
|
|
|
nsHTMLFramesetFrame* mTopLevelFrameset;
|
|
|
|
nsHTMLFramesetBorderFrame** mVerBorders; // vertical borders
|
|
|
|
nsHTMLFramesetBorderFrame** mHorBorders; // horizontal borders
|
|
|
|
PRInt32* mChildTypes; // frameset/frame distinction of children
|
|
|
|
nsFrameborder* mChildFrameborder; // the frameborder attr of children
|
|
|
|
nsBorderColor* mChildBorderColors;
|
|
|
|
nscoord* mRowSizes; // currently computed row sizes
|
|
|
|
nscoord* mColSizes; // currently computed col sizes
|
|
|
|
nsIntPoint mFirstDragPoint;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 mNumRows;
|
|
|
|
PRInt32 mNumCols;
|
|
|
|
PRInt32 mNonBorderChildCount;
|
|
|
|
PRInt32 mNonBlankChildCount;
|
|
|
|
PRInt32 mEdgeVisibility;
|
|
|
|
nsFrameborder mParentFrameborder;
|
|
|
|
nscolor mParentBorderColor;
|
|
|
|
PRInt32 mParentBorderWidth;
|
|
|
|
PRInt32 mPrevNeighborOrigSize; // used during resize
|
|
|
|
PRInt32 mNextNeighborOrigSize;
|
|
|
|
PRInt32 mMinDrag;
|
|
|
|
PRInt32 mChildCount;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mForceFrameResizability;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|