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___
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2011-12-27 12:18:48 -08:00
|
|
|
#include "nsContainerFrame.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsColor.h"
|
|
|
|
|
|
|
|
class nsIContent;
|
|
|
|
class nsPresContext;
|
|
|
|
struct nsRect;
|
|
|
|
struct nsHTMLReflowState;
|
|
|
|
struct nsSize;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsHTMLFramesetBorderFrame;
|
|
|
|
class nsHTMLFramesetFrame;
|
|
|
|
|
|
|
|
#define NO_COLOR 0xFFFFFFFA
|
|
|
|
|
2012-12-21 06:06:50 -08:00
|
|
|
// defined at HTMLFrameSetElement.h
|
2011-06-08 12:04:10 -07:00
|
|
|
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
|
2012-08-22 08:56:38 -07: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-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,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aIndex,
|
|
|
|
int32_t aChange,
|
2007-03-22 10:30:00 -07:00
|
|
|
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();
|
|
|
|
|
2013-03-19 18:47:48 -07:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-08-24 13:54:30 -07:00
|
|
|
NS_IMETHOD SetInitialChildList(ChildListID aListID,
|
2013-05-14 09:33:23 -07:00
|
|
|
nsFrameList& aChildList) MOZ_OVERRIDE;
|
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);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void GetSizeOfChildAt(int32_t aIndexInParent,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsSize& aSize,
|
2009-01-14 19:27:09 -08:00
|
|
|
nsIntPoint& aCellIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
2013-10-01 20:46:03 -07:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
|
|
|
nsEventStatus* aEventStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD GetCursor(const nsPoint& aPoint,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsIFrame::Cursor& aCursor) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-02-14 03:12:27 -08:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
2012-09-14 09:10:08 -07:00
|
|
|
nsReflowStatus& aStatus) MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIAtom* GetType() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef DEBUG
|
2012-09-14 09:10:08 -07:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual bool IsLeaf() const MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-10-01 20:46:03 -07:00
|
|
|
void StartMouseDrag(nsPresContext* aPresContext,
|
|
|
|
nsHTMLFramesetBorderFrame* aBorder,
|
|
|
|
mozilla::WidgetGUIEvent* aEvent);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void MouseDrag(nsPresContext* aPresContext,
|
2013-10-01 20:46:03 -07:00
|
|
|
mozilla::WidgetGUIEvent* aEvent);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
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,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aNumIndicies,
|
|
|
|
int32_t* aIndicies,
|
|
|
|
int32_t aNumItems,
|
|
|
|
int32_t* aItems);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
void CalculateRowCol(nsPresContext* aPresContext,
|
|
|
|
nscoord aSize,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aNumSpecs,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues);
|
|
|
|
|
|
|
|
void GenerateRowCol(nsPresContext* aPresContext,
|
|
|
|
nscoord aSize,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aNumSpecs,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues,
|
|
|
|
nsString& aNewAttr);
|
|
|
|
|
|
|
|
virtual void GetDesiredSize(nsPresContext* aPresContext,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize);
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetBorderWidth(nsPresContext* aPresContext,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aTakeForcingIntoAccount);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetParentBorderWidth() { return mParentBorderWidth; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetParentBorderWidth(int32_t aWidth) { mParentBorderWidth = aWidth; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
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
|
|
|
|
2012-11-30 18:28:02 -08:00
|
|
|
bool CanResize(bool aVertical, bool aLeft);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-30 18:28:02 -08:00
|
|
|
bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-30 18:28:02 -08:00
|
|
|
void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
|
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
|
|
|
|
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 08:56:38 -07:00
|
|
|
int32_t mNumRows;
|
|
|
|
int32_t mNumCols;
|
|
|
|
int32_t mNonBorderChildCount;
|
|
|
|
int32_t mNonBlankChildCount;
|
|
|
|
int32_t mEdgeVisibility;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsFrameborder mParentFrameborder;
|
|
|
|
nscolor mParentBorderColor;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mParentBorderWidth;
|
|
|
|
int32_t mPrevNeighborOrigSize; // used during resize
|
|
|
|
int32_t mNextNeighborOrigSize;
|
|
|
|
int32_t mMinDrag;
|
|
|
|
int32_t mChildCount;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mForceFrameResizability;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|