2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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 22:29:03 +04:00
|
|
|
|
|
|
|
/* rendering object for HTML <frameset> elements */
|
|
|
|
|
1998-07-16 03:42:14 +04:00
|
|
|
#ifndef nsHTMLFrameset_h___
|
|
|
|
#define nsHTMLFrameset_h___
|
|
|
|
|
2012-09-14 20:10:08 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2015-10-29 23:16:13 +03:00
|
|
|
#include "mozilla/UniquePtr.h"
|
2011-12-28 00:18:48 +04:00
|
|
|
#include "nsContainerFrame.h"
|
1998-09-25 01:37:45 +04:00
|
|
|
#include "nsColor.h"
|
1998-07-16 03:42:14 +04:00
|
|
|
|
|
|
|
class nsIContent;
|
2004-08-01 03:15:21 +04:00
|
|
|
class nsPresContext;
|
1998-07-16 03:42:14 +04:00
|
|
|
struct nsRect;
|
|
|
|
struct nsSize;
|
|
|
|
class nsIAtom;
|
1998-09-03 05:16:27 +04:00
|
|
|
class nsHTMLFramesetBorderFrame;
|
|
|
|
class nsHTMLFramesetFrame;
|
|
|
|
|
|
|
|
#define NO_COLOR 0xFFFFFFFA
|
|
|
|
|
2012-12-21 18:06:50 +04:00
|
|
|
// defined at HTMLFrameSetElement.h
|
2011-06-08 23:04:10 +04:00
|
|
|
struct nsFramesetSpec;
|
|
|
|
|
1998-09-03 05:16:27 +04: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-16 03:42:14 +04:00
|
|
|
|
1998-08-06 23:40:37 +04:00
|
|
|
enum nsFrameborder {
|
|
|
|
eFrameborder_Yes = 0,
|
|
|
|
eFrameborder_No,
|
|
|
|
eFrameborder_Notset
|
|
|
|
};
|
|
|
|
|
1998-09-03 05:16:27 +04:00
|
|
|
struct nsFramesetDrag {
|
2009-05-12 14:13:09 +04:00
|
|
|
nsHTMLFramesetFrame* mSource; // frameset whose border was dragged to cause the resize
|
2012-08-22 19:56:38 +04: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 10:19:26 +04:00
|
|
|
bool mVertical; // vertical if true, otherwise horizontal
|
1999-03-10 09:13:35 +03:00
|
|
|
|
|
|
|
nsFramesetDrag();
|
2011-09-29 10:19:26 +04:00
|
|
|
void Reset(bool aVertical,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aIndex,
|
|
|
|
int32_t aChange,
|
1999-03-10 09:13:35 +03:00
|
|
|
nsHTMLFramesetFrame* aSource);
|
|
|
|
void UnSet();
|
1998-09-03 05:16:27 +04:00
|
|
|
};
|
|
|
|
|
1998-07-16 03:42:14 +04:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetFrame
|
|
|
|
******************************************************************************/
|
2011-12-28 00:18:48 +04:00
|
|
|
class nsHTMLFramesetFrame : public nsContainerFrame
|
2001-11-02 05:19:49 +03:00
|
|
|
{
|
2002-04-05 09:42:10 +04:00
|
|
|
public:
|
2009-09-12 20:49:24 +04:00
|
|
|
NS_DECL_QUERYFRAME_TARGET(nsHTMLFramesetFrame)
|
|
|
|
NS_DECL_QUERYFRAME
|
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
2002-04-17 08:17:16 +04:00
|
|
|
|
2014-09-01 07:36:37 +04:00
|
|
|
explicit nsHTMLFramesetFrame(nsStyleContext* aContext);
|
1998-07-16 03:42:14 +04:00
|
|
|
|
1998-07-20 22:52:40 +04:00
|
|
|
virtual ~nsHTMLFramesetFrame();
|
|
|
|
|
2014-05-25 02:20:40 +04:00
|
|
|
virtual void Init(nsIContent* aContent,
|
|
|
|
nsContainerFrame* aParent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame* aPrevInFlow) override;
|
1998-09-03 05:16:27 +04:00
|
|
|
|
2014-05-28 23:36:58 +04:00
|
|
|
virtual void SetInitialChildList(ChildListID aListID,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsFrameList& aChildList) override;
|
2009-01-19 21:31:31 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool gDragInProgress;
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
void GetSizeOfChild(nsIFrame* aChild, mozilla::WritingMode aWM,
|
|
|
|
mozilla::LogicalSize& aSize);
|
1998-07-20 22:52:40 +04:00
|
|
|
|
2014-07-24 12:30:07 +04:00
|
|
|
void GetSizeOfChildAt(int32_t aIndexInParent,
|
|
|
|
mozilla::WritingMode aWM,
|
|
|
|
mozilla::LogicalSize& aSize,
|
2009-01-15 06:27:09 +03:00
|
|
|
nsIntPoint& aCellIndex);
|
1998-07-16 03:42:14 +04:00
|
|
|
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult HandleEvent(nsPresContext* aPresContext,
|
2014-02-18 12:36:33 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsEventStatus* aEventStatus) override;
|
1998-09-03 05:16:27 +04:00
|
|
|
|
2014-02-18 11:47:48 +04:00
|
|
|
virtual nsresult GetCursor(const nsPoint& aPoint,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIFrame::Cursor& aCursor) override;
|
1998-07-16 03:42:14 +04:00
|
|
|
|
2013-02-14 15:12:27 +04:00
|
|
|
virtual void BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsDisplayListSet& aLists) override;
|
1998-07-16 03:42:14 +04:00
|
|
|
|
2014-05-13 04:47:52 +04:00
|
|
|
virtual void Reflow(nsPresContext* aPresContext,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize,
|
2016-07-21 13:36:35 +03:00
|
|
|
const ReflowInput& aReflowState,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsReflowStatus& aStatus) override;
|
1998-09-03 05:16:27 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsIAtom* GetType() const override;
|
2014-01-06 03:31:14 +04:00
|
|
|
#ifdef DEBUG_FRAME_DUMP
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual nsresult GetFrameName(nsAString& aResult) const 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 08:38:33 +03:00
|
|
|
#endif
|
2005-09-06 06:14:36 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsLeaf() const override;
|
2005-08-17 02:52:48 +04:00
|
|
|
|
2013-10-02 07:46:03 +04:00
|
|
|
void StartMouseDrag(nsPresContext* aPresContext,
|
|
|
|
nsHTMLFramesetBorderFrame* aBorder,
|
|
|
|
mozilla::WidgetGUIEvent* aEvent);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void MouseDrag(nsPresContext* aPresContext,
|
2013-10-02 07:46:03 +04:00
|
|
|
mozilla::WidgetGUIEvent* aEvent);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void EndMouseDrag(nsPresContext* aPresContext);
|
1998-09-03 05:16:27 +04:00
|
|
|
|
1998-08-06 23:40:37 +04:00
|
|
|
nsFrameborder GetParentFrameborder() { return mParentFrameborder; }
|
|
|
|
|
1999-03-10 09:13:35 +03:00
|
|
|
void SetParentFrameborder(nsFrameborder aValue) { mParentFrameborder = aValue; }
|
1998-11-28 21:59:38 +03:00
|
|
|
|
1999-03-10 09:13:35 +03:00
|
|
|
nsFramesetDrag& GetDrag() { return mDrag; }
|
1998-07-16 03:42:14 +04:00
|
|
|
|
2001-04-12 12:16:54 +04:00
|
|
|
void RecalculateBorderResize();
|
|
|
|
|
1999-03-10 09:13:35 +03:00
|
|
|
protected:
|
|
|
|
void Scale(nscoord aDesired,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aNumIndicies,
|
|
|
|
int32_t* aIndicies,
|
|
|
|
int32_t aNumItems,
|
|
|
|
int32_t* aItems);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void CalculateRowCol(nsPresContext* aPresContext,
|
2002-08-06 05:06:50 +04:00
|
|
|
nscoord aSize,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aNumSpecs,
|
2002-08-06 05:06:50 +04:00
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
void GenerateRowCol(nsPresContext* aPresContext,
|
2002-08-06 05:06:50 +04:00
|
|
|
nscoord aSize,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aNumSpecs,
|
2002-08-06 05:06:50 +04:00
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues,
|
|
|
|
nsString& aNewAttr);
|
1999-06-11 04:51:05 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
virtual void GetDesiredSize(nsPresContext* aPresContext,
|
2016-07-21 13:36:35 +03:00
|
|
|
const ReflowInput& aReflowState,
|
2016-07-21 13:36:38 +03:00
|
|
|
ReflowOutput& aDesiredSize);
|
1998-07-16 03:42:14 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetBorderWidth(nsPresContext* aPresContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aTakeForcingIntoAccount);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t GetParentBorderWidth() { return mParentBorderWidth; }
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void SetParentBorderWidth(int32_t aWidth) { mParentBorderWidth = aWidth; }
|
1999-03-10 09:13:35 +03:00
|
|
|
|
1998-09-03 05:16:27 +04:00
|
|
|
nscolor GetParentBorderColor() { return mParentBorderColor; }
|
1999-03-10 09:13:35 +03:00
|
|
|
|
|
|
|
void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; }
|
1998-07-27 09:59:37 +04:00
|
|
|
|
2001-12-07 22:40:07 +03:00
|
|
|
nsFrameborder GetFrameBorder();
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2001-12-07 22:40:07 +03:00
|
|
|
nsFrameborder GetFrameBorder(nsIContent* aContent);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
1998-09-03 05:16:27 +04:00
|
|
|
nscolor GetBorderColor();
|
1999-03-10 09:13:35 +03:00
|
|
|
|
1998-09-10 03:30:30 +04:00
|
|
|
nscolor GetBorderColor(nsIContent* aFrameContent);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool GetNoResize(nsIFrame* aChildFrame);
|
1998-07-31 01:25:35 +04:00
|
|
|
|
1998-10-02 08:10:00 +04:00
|
|
|
void ReflowPlaceChild(nsIFrame* aChild,
|
2004-08-01 03:15:21 +04:00
|
|
|
nsPresContext* aPresContext,
|
2016-07-21 13:36:35 +03:00
|
|
|
const ReflowInput& aReflowState,
|
1998-10-02 08:10:00 +04:00
|
|
|
nsPoint& aOffset,
|
|
|
|
nsSize& aSize,
|
2009-01-15 06:27:09 +03:00
|
|
|
nsIntPoint* aCellIndex = 0);
|
1998-09-03 05:16:27 +04:00
|
|
|
|
2012-12-01 06:28:02 +04:00
|
|
|
bool CanResize(bool aVertical, bool aLeft);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2012-12-01 06:28:02 +04:00
|
|
|
bool CanChildResize(bool aVertical, bool aLeft, int32_t aChildX);
|
1999-03-10 09:13:35 +03:00
|
|
|
|
2012-12-01 06:28:02 +04:00
|
|
|
void SetBorderResize(nsHTMLFramesetBorderFrame* aBorderFrame);
|
1998-09-03 05:16:27 +04:00
|
|
|
|
2015-10-29 23:16:13 +03:00
|
|
|
template<typename T, class D = mozilla::DefaultDelete<T>>
|
|
|
|
using UniquePtr = mozilla::UniquePtr<T, D>;
|
|
|
|
|
2009-05-12 14:13:09 +04:00
|
|
|
nsFramesetDrag mDrag;
|
|
|
|
nsBorderColor mEdgeColors;
|
|
|
|
nsHTMLFramesetBorderFrame* mDragger;
|
|
|
|
nsHTMLFramesetFrame* mTopLevelFrameset;
|
2015-10-29 23:16:13 +03:00
|
|
|
UniquePtr<nsHTMLFramesetBorderFrame*[]> mVerBorders; // vertical borders
|
|
|
|
UniquePtr<nsHTMLFramesetBorderFrame*[]> mHorBorders; // horizontal borders
|
|
|
|
UniquePtr<nsFrameborder[]> mChildFrameborder; // the frameborder attr of children
|
|
|
|
UniquePtr<nsBorderColor[]> mChildBorderColors;
|
|
|
|
UniquePtr<nscoord[]> mRowSizes; // currently computed row sizes
|
|
|
|
UniquePtr<nscoord[]> mColSizes; // currently computed col sizes
|
2015-02-04 23:21:03 +03:00
|
|
|
mozilla::LayoutDeviceIntPoint mFirstDragPoint;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mNumRows;
|
|
|
|
int32_t mNumCols;
|
|
|
|
int32_t mNonBorderChildCount;
|
|
|
|
int32_t mNonBlankChildCount;
|
|
|
|
int32_t mEdgeVisibility;
|
1998-08-06 23:40:37 +04:00
|
|
|
nsFrameborder mParentFrameborder;
|
1998-09-03 05:16:27 +04:00
|
|
|
nscolor mParentBorderColor;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mParentBorderWidth;
|
|
|
|
int32_t mPrevNeighborOrigSize; // used during resize
|
|
|
|
int32_t mNextNeighborOrigSize;
|
|
|
|
int32_t mMinDrag;
|
|
|
|
int32_t mChildCount;
|
1998-07-16 03:42:14 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|