2010-08-24 07:06:07 +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 */
|
|
|
|
|
1999-02-12 17:45:58 +00:00
|
|
|
#include "nsCOMPtr.h"
|
1998-09-10 17:23:31 +00:00
|
|
|
#include "nsFrameSetFrame.h"
|
2005-01-12 19:45:38 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
1998-07-15 23:42:14 +00:00
|
|
|
#include "nsLeafFrame.h"
|
2011-12-27 20:18:48 +00:00
|
|
|
#include "nsContainerFrame.h"
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
1998-07-15 23:42:14 +00:00
|
|
|
#include "nsIPresShell.h"
|
1999-03-09 09:44:27 +00:00
|
|
|
#include "nsIComponentManager.h"
|
1998-07-15 23:42:14 +00:00
|
|
|
#include "nsIStreamListener.h"
|
|
|
|
#include "nsIURL.h"
|
|
|
|
#include "nsIDocument.h"
|
2003-09-27 04:18:26 +00:00
|
|
|
#include "nsINodeInfo.h"
|
1998-07-15 23:42:14 +00:00
|
|
|
#include "nsIView.h"
|
|
|
|
#include "nsIViewManager.h"
|
|
|
|
#include "nsWidgetsCID.h"
|
2007-01-30 00:06:41 +00:00
|
|
|
#include "nsGkAtoms.h"
|
1998-07-15 23:42:14 +00:00
|
|
|
#include "nsStyleCoord.h"
|
1998-09-09 23:30:30 +00:00
|
|
|
#include "nsStyleConsts.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
1998-09-13 02:45:07 +00:00
|
|
|
#include "nsHTMLParts.h"
|
2001-07-16 02:40:48 +00:00
|
|
|
#include "nsGUIEvent.h"
|
2011-04-08 01:04:40 +00:00
|
|
|
#include "nsRenderingContext.h"
|
2001-11-02 02:19:49 +00:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsIDOMMutationEvent.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
2002-11-17 15:37:56 +00:00
|
|
|
#include "nsCSSAnonBoxes.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2004-01-28 00:18:22 +00:00
|
|
|
#include "nsStyleSet.h"
|
2010-08-24 07:06:07 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
2006-01-26 02:29:17 +00:00
|
|
|
#include "nsDisplayList.h"
|
2006-07-02 07:23:10 +00:00
|
|
|
#include "nsNodeUtils.h"
|
2008-04-11 17:29:06 +00:00
|
|
|
#include "mozAutoDocUpdate.h"
|
2011-05-25 06:31:59 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
2011-06-08 19:04:10 +00:00
|
|
|
#include "nsHTMLFrameSetElement.h"
|
2011-09-09 02:27:13 +00:00
|
|
|
#include "mozilla/LookAndFeel.h"
|
2011-05-25 06:31:59 +00:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2001-07-16 02:40:48 +00:00
|
|
|
|
1998-07-30 21:25:35 +00:00
|
|
|
// masks for mEdgeVisibility
|
1998-09-03 01:16:27 +00:00
|
|
|
#define LEFT_VIS 0x0001
|
|
|
|
#define RIGHT_VIS 0x0002
|
|
|
|
#define TOP_VIS 0x0004
|
|
|
|
#define BOTTOM_VIS 0x0008
|
|
|
|
#define ALL_VIS 0x000F
|
|
|
|
#define NONE_VIS 0x0000
|
|
|
|
|
1999-03-10 06:13:35 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsFramesetDrag
|
|
|
|
******************************************************************************/
|
|
|
|
nsFramesetDrag::nsFramesetDrag()
|
|
|
|
{
|
|
|
|
UnSet();
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
void nsFramesetDrag::Reset(bool aVertical,
|
1999-03-10 06:13:35 +00:00
|
|
|
PRInt32 aIndex,
|
|
|
|
PRInt32 aChange,
|
|
|
|
nsHTMLFramesetFrame* aSource)
|
|
|
|
{
|
|
|
|
mVertical = aVertical;
|
|
|
|
mIndex = aIndex;
|
|
|
|
mChange = aChange;
|
|
|
|
mSource = aSource;
|
|
|
|
}
|
|
|
|
|
|
|
|
void nsFramesetDrag::UnSet()
|
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
mVertical = true;
|
1999-03-10 06:13:35 +00:00
|
|
|
mIndex = -1;
|
|
|
|
mChange = 0;
|
|
|
|
mSource = nsnull;
|
|
|
|
}
|
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetBorderFrame
|
|
|
|
******************************************************************************/
|
2009-09-12 16:49:24 +00:00
|
|
|
class nsHTMLFramesetBorderFrame : public nsLeafFrame
|
|
|
|
{
|
1998-07-27 05:59:37 +00:00
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1998-07-27 05:59:37 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
|
1998-07-30 21:25:35 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus);
|
1998-07-30 21:25:35 +00:00
|
|
|
|
2004-12-30 21:56:11 +00:00
|
|
|
NS_IMETHOD GetCursor(const nsPoint& aPoint,
|
|
|
|
nsIFrame::Cursor& aCursor);
|
1998-11-18 05:25:26 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
1998-07-27 05:59:37 +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,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-07-27 05:59:37 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool GetVisibility() { return mVisibility || mVisibilityOverride; }
|
|
|
|
void SetVisibility(bool aVisibility);
|
1998-09-03 01:16:27 +00:00
|
|
|
void SetColor(nscolor aColor);
|
1998-07-30 21:25:35 +00:00
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void PaintBorder(nsRenderingContext& aRenderingContext, nsPoint aPt);
|
2006-01-26 02:29:17 +00:00
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
protected:
|
2011-09-29 06:19:26 +00:00
|
|
|
nsHTMLFramesetBorderFrame(nsStyleContext* aContext, PRInt32 aWidth, bool aVertical, bool aVisible);
|
1998-07-27 05:59:37 +00:00
|
|
|
virtual ~nsHTMLFramesetBorderFrame();
|
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
|
|
|
virtual nscoord GetIntrinsicWidth();
|
2008-10-30 17:10:19 +00:00
|
|
|
virtual nscoord GetIntrinsicHeight();
|
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
|
|
|
|
2009-05-12 10:13:09 +00:00
|
|
|
// the prev and next neighbors are indexes into the row (for a horizontal border) or col (for
|
|
|
|
// a vertical border) of nsHTMLFramesetFrames or nsHTMLFrames
|
|
|
|
PRInt32 mPrevNeighbor;
|
|
|
|
PRInt32 mNextNeighbor;
|
|
|
|
nscolor mColor;
|
1998-08-06 19:40:37 +00:00
|
|
|
PRInt32 mWidth;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mVertical;
|
|
|
|
bool mVisibility;
|
|
|
|
bool mVisibilityOverride;
|
|
|
|
bool mCanResize;
|
1998-07-27 05:59:37 +00:00
|
|
|
friend class nsHTMLFramesetFrame;
|
|
|
|
};
|
1998-08-05 22:24:56 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetBlankFrame
|
|
|
|
******************************************************************************/
|
2009-09-12 16:49:24 +00:00
|
|
|
class nsHTMLFramesetBlankFrame : public nsLeafFrame
|
|
|
|
{
|
1998-08-05 22:24:56 +00:00
|
|
|
public:
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_DECL_FRAMEARENA_HELPERS
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
2005-09-06 21:34:50 +00:00
|
|
|
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1998-08-05 22:24:56 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists);
|
1998-08-05 22:24:56 +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,
|
|
|
|
nsReflowStatus& aStatus);
|
1998-08-05 22:24:56 +00:00
|
|
|
|
|
|
|
protected:
|
2006-03-26 21:30:36 +00:00
|
|
|
nsHTMLFramesetBlankFrame(nsStyleContext* aContext) : nsLeafFrame(aContext) {}
|
1998-08-05 22:24:56 +00:00
|
|
|
virtual ~nsHTMLFramesetBlankFrame();
|
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
|
|
|
virtual nscoord GetIntrinsicWidth();
|
2008-10-30 17:10:19 +00:00
|
|
|
virtual nscoord GetIntrinsicHeight();
|
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
|
|
|
|
1998-08-05 22:24:56 +00:00
|
|
|
friend class nsHTMLFramesetFrame;
|
|
|
|
friend class nsHTMLFrameset;
|
|
|
|
};
|
1998-07-27 05:59:37 +00:00
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetFrame
|
|
|
|
******************************************************************************/
|
2011-09-29 06:19:26 +00:00
|
|
|
bool nsHTMLFramesetFrame::gDragInProgress = false;
|
2001-11-02 02:19:49 +00:00
|
|
|
#define kFrameResizePref "layout.frames.force_resizability"
|
|
|
|
#define DEFAULT_BORDER_WIDTH_PX 6
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
nsHTMLFramesetFrame::nsHTMLFramesetFrame(nsStyleContext* aContext)
|
2011-12-27 20:18:48 +00:00
|
|
|
: nsContainerFrame(aContext)
|
1998-07-15 23:42:14 +00:00
|
|
|
{
|
1999-04-13 00:56:23 +00:00
|
|
|
mNumRows = 0;
|
|
|
|
mRowSizes = nsnull;
|
|
|
|
mNumCols = 0;
|
|
|
|
mColSizes = nsnull;
|
|
|
|
mEdgeVisibility = 0;
|
|
|
|
mParentFrameborder = eFrameborder_Yes; // default
|
|
|
|
mParentBorderWidth = -1; // default not set
|
|
|
|
mParentBorderColor = NO_COLOR; // default not set
|
1999-06-11 01:18:50 +00:00
|
|
|
mFirstDragPoint.x = mFirstDragPoint.y = 0;
|
2007-02-07 07:46:44 +00:00
|
|
|
mMinDrag = nsPresContext::CSSPixelsToAppUnits(2);
|
1999-04-13 00:56:23 +00:00
|
|
|
mNonBorderChildCount = 0;
|
|
|
|
mNonBlankChildCount = 0;
|
|
|
|
mDragger = nsnull;
|
|
|
|
mChildCount = 0;
|
|
|
|
mTopLevelFrameset = nsnull;
|
1999-03-10 06:13:35 +00:00
|
|
|
mEdgeColors.Set(NO_COLOR);
|
2001-04-12 08:16:54 +00:00
|
|
|
mVerBorders = nsnull;
|
|
|
|
mHorBorders = nsnull;
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildTypes = nsnull;
|
|
|
|
mChildFrameborder = nsnull;
|
|
|
|
mChildBorderColors = nsnull;
|
2011-10-17 14:59:28 +00:00
|
|
|
mForceFrameResizability = false;
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
|
1998-07-20 18:52:40 +00:00
|
|
|
nsHTMLFramesetFrame::~nsHTMLFramesetFrame()
|
|
|
|
{
|
2004-04-29 23:34:19 +00:00
|
|
|
delete[] mRowSizes;
|
|
|
|
delete[] mColSizes;
|
2002-04-17 04:17:16 +00:00
|
|
|
delete[] mVerBorders;
|
|
|
|
delete[] mHorBorders;
|
2004-12-30 22:05:22 +00:00
|
|
|
delete[] mChildTypes;
|
|
|
|
delete[] mChildFrameborder;
|
|
|
|
delete[] mChildBorderColors;
|
2002-04-17 04:17:16 +00:00
|
|
|
|
2011-05-28 23:42:57 +00:00
|
|
|
Preferences::UnregisterCallback(FrameResizePrefCallback,
|
|
|
|
kFrameResizePref, this);
|
1998-07-20 18:52:40 +00:00
|
|
|
}
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
NS_QUERYFRAME_HEAD(nsHTMLFramesetFrame)
|
|
|
|
NS_QUERYFRAME_ENTRY(nsHTMLFramesetFrame)
|
2011-12-27 20:18:48 +00:00
|
|
|
NS_QUERYFRAME_TAIL_INHERITING(nsContainerFrame)
|
1998-09-03 01:16:27 +00:00
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
// static
|
|
|
|
int
|
|
|
|
nsHTMLFramesetFrame::FrameResizePrefCallback(const char* aPref, void* aClosure)
|
2001-11-02 02:19:49 +00:00
|
|
|
{
|
2004-04-29 23:34:19 +00:00
|
|
|
nsHTMLFramesetFrame *frame =
|
2007-07-08 07:08:04 +00:00
|
|
|
reinterpret_cast<nsHTMLFramesetFrame *>(aClosure);
|
2001-11-02 02:19:49 +00:00
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
nsIDocument* doc = frame->mContent->GetDocument();
|
2011-10-17 14:59:28 +00:00
|
|
|
mozAutoDocUpdate updateBatch(doc, UPDATE_CONTENT_MODEL, true);
|
2004-04-29 23:34:19 +00:00
|
|
|
if (doc) {
|
2010-08-24 07:06:20 +00:00
|
|
|
nsNodeUtils::AttributeWillChange(frame->GetContent()->AsElement(),
|
|
|
|
kNameSpaceID_None,
|
2009-06-29 18:36:25 +00:00
|
|
|
nsGkAtoms::frameborder,
|
|
|
|
nsIDOMMutationEvent::MODIFICATION);
|
2004-04-29 23:34:19 +00:00
|
|
|
}
|
2001-11-02 02:19:49 +00:00
|
|
|
|
2004-04-29 23:34:19 +00:00
|
|
|
frame->mForceFrameResizability =
|
2011-05-25 06:31:59 +00:00
|
|
|
Preferences::GetBool(kFrameResizePref, frame->mForceFrameResizability);
|
2004-04-29 23:34:19 +00:00
|
|
|
|
|
|
|
frame->RecalculateBorderResize();
|
|
|
|
if (doc) {
|
2010-08-24 07:06:07 +00:00
|
|
|
nsNodeUtils::AttributeChanged(frame->GetContent()->AsElement(),
|
2006-07-02 07:23:10 +00:00
|
|
|
kNameSpaceID_None,
|
2006-12-26 17:47:52 +00:00
|
|
|
nsGkAtoms::frameborder,
|
2009-12-10 22:36:04 +00:00
|
|
|
nsIDOMMutationEvent::MODIFICATION);
|
2001-11-02 02:19:49 +00:00
|
|
|
}
|
2004-04-29 23:34:19 +00:00
|
|
|
|
|
|
|
return 0;
|
2001-11-02 02:19:49 +00:00
|
|
|
}
|
|
|
|
|
2001-10-07 00:19:01 +00:00
|
|
|
#define FRAMESET 0
|
|
|
|
#define FRAME 1
|
|
|
|
#define BLANK 2
|
|
|
|
|
1999-03-10 06:13:35 +00:00
|
|
|
NS_IMETHODIMP
|
2006-03-09 18:55:21 +00:00
|
|
|
nsHTMLFramesetFrame::Init(nsIContent* aContent,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
2011-12-27 20:18:48 +00:00
|
|
|
nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
|
1999-03-10 06:13:35 +00:00
|
|
|
// find the highest ancestor that is a frameset
|
|
|
|
nsresult rv = NS_OK;
|
2003-07-05 15:30:50 +00:00
|
|
|
nsIFrame* parentFrame = GetParent();
|
1999-03-10 06:13:35 +00:00
|
|
|
mTopLevelFrameset = (nsHTMLFramesetFrame*)this;
|
|
|
|
while (parentFrame) {
|
2009-01-12 19:20:59 +00:00
|
|
|
nsHTMLFramesetFrame* frameset = do_QueryFrame(parentFrame);
|
2003-04-21 23:57:47 +00:00
|
|
|
if (frameset) {
|
1999-03-10 06:13:35 +00:00
|
|
|
mTopLevelFrameset = frameset;
|
2003-07-05 15:30:50 +00:00
|
|
|
parentFrame = parentFrame->GetParent();
|
1999-03-10 06:13:35 +00:00
|
|
|
} else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
|
2009-03-11 15:43:08 +00:00
|
|
|
nsPresContext* presContext = PresContext();
|
|
|
|
nsIPresShell* shell = presContext->PresShell();
|
1999-11-19 15:33:29 +00:00
|
|
|
|
2001-12-07 19:40:07 +00:00
|
|
|
nsFrameborder frameborder = GetFrameBorder();
|
2011-10-17 14:59:28 +00:00
|
|
|
PRInt32 borderWidth = GetBorderWidth(presContext, false);
|
2001-10-07 00:19:01 +00:00
|
|
|
nscolor borderColor = GetBorderColor();
|
|
|
|
|
2002-08-06 01:06:50 +00:00
|
|
|
// Get the rows= cols= data
|
2011-06-08 19:04:10 +00:00
|
|
|
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
2002-08-06 01:06:50 +00:00
|
|
|
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
|
|
|
const nsFramesetSpec* rowSpecs = nsnull;
|
|
|
|
const nsFramesetSpec* colSpecs = nsnull;
|
2004-11-04 15:06:50 +00:00
|
|
|
nsresult result = ourContent->GetRowSpec(&mNumRows, &rowSpecs);
|
2002-08-06 01:06:50 +00:00
|
|
|
NS_ENSURE_SUCCESS(result, result);
|
|
|
|
result = ourContent->GetColSpec(&mNumCols, &colSpecs);
|
|
|
|
NS_ENSURE_SUCCESS(result, result);
|
2011-01-25 01:38:07 +00:00
|
|
|
|
|
|
|
// Maximum value of mNumRows and mNumCols is NS_MAX_FRAMESET_SPEC_COUNT
|
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(nscoord));
|
2001-10-07 00:19:01 +00:00
|
|
|
mRowSizes = new nscoord[mNumRows];
|
|
|
|
mColSizes = new nscoord[mNumCols];
|
2004-12-30 22:05:22 +00:00
|
|
|
if (!mRowSizes || !mColSizes)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2001-10-07 00:19:01 +00:00
|
|
|
|
2011-01-25 01:38:07 +00:00
|
|
|
// Ensure we can't overflow numCells
|
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < PR_INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT);
|
2001-10-07 00:19:01 +00:00
|
|
|
PRInt32 numCells = mNumRows*mNumCols;
|
|
|
|
|
2011-01-25 01:38:07 +00:00
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(nsHTMLFramesetBorderFrame*));
|
2001-10-07 00:19:01 +00:00
|
|
|
mVerBorders = new nsHTMLFramesetBorderFrame*[mNumCols]; // 1 more than number of ver borders
|
2004-12-30 22:05:22 +00:00
|
|
|
if (!mVerBorders)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2001-10-07 00:19:01 +00:00
|
|
|
for (int verX = 0; verX < mNumCols; verX++)
|
|
|
|
mVerBorders[verX] = nsnull;
|
|
|
|
|
|
|
|
mHorBorders = new nsHTMLFramesetBorderFrame*[mNumRows]; // 1 more than number of hor borders
|
2004-12-30 22:05:22 +00:00
|
|
|
if (!mHorBorders)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2001-10-07 00:19:01 +00:00
|
|
|
for (int horX = 0; horX < mNumRows; horX++)
|
|
|
|
mHorBorders[horX] = nsnull;
|
2011-01-25 01:38:07 +00:00
|
|
|
|
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT
|
|
|
|
< UINT_MAX / sizeof(PRInt32) / NS_MAX_FRAMESET_SPEC_COUNT);
|
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT
|
|
|
|
< UINT_MAX / sizeof(nsFrameborder) / NS_MAX_FRAMESET_SPEC_COUNT);
|
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT
|
|
|
|
< UINT_MAX / sizeof(nsBorderColor) / NS_MAX_FRAMESET_SPEC_COUNT);
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildTypes = new PRInt32[numCells];
|
2011-01-25 01:38:07 +00:00
|
|
|
mChildFrameborder = new nsFrameborder[numCells];
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildBorderColors = new nsBorderColor[numCells];
|
2004-12-30 22:05:22 +00:00
|
|
|
if (!mChildTypes || !mChildFrameborder || !mChildBorderColors)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2001-10-07 00:19:01 +00:00
|
|
|
|
|
|
|
// create the children frames; skip content which isn't <frameset> or <frame>
|
|
|
|
mChildCount = 0; // number of <frame> or <frameset> children
|
|
|
|
nsIFrame* frame;
|
2003-09-27 04:18:26 +00:00
|
|
|
|
|
|
|
// number of any type of children
|
|
|
|
PRUint32 numChildren = mContent->GetChildCount();
|
|
|
|
|
|
|
|
for (PRUint32 childX = 0; childX < numChildren; childX++) {
|
2001-10-07 00:19:01 +00:00
|
|
|
if (mChildCount == numCells) { // we have more <frame> or <frameset> than cells
|
2011-03-04 15:27:02 +00:00
|
|
|
// Clear the lazy bits in the remaining children. Also clear
|
|
|
|
// the restyle flags, like nsCSSFrameConstructor::ProcessChildren does.
|
2010-05-12 00:30:42 +00:00
|
|
|
for (PRUint32 i = childX; i < numChildren; i++) {
|
2011-03-04 15:27:02 +00:00
|
|
|
nsIContent *child = mContent->GetChildAt(i);
|
|
|
|
child->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
|
|
|
|
if (child->IsElement()) {
|
|
|
|
child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
|
|
|
|
}
|
2010-05-12 00:30:42 +00:00
|
|
|
}
|
2001-10-07 00:19:01 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-09-27 04:18:26 +00:00
|
|
|
nsIContent *child = mContent->GetChildAt(childX);
|
2010-05-12 00:30:42 +00:00
|
|
|
child->UnsetFlags(NODE_DESCENDANTS_NEED_FRAMES | NODE_NEEDS_FRAME);
|
2011-03-04 15:27:02 +00:00
|
|
|
// Also clear the restyle flags in the child like
|
|
|
|
// nsCSSFrameConstructor::ProcessChildren does.
|
|
|
|
if (child->IsElement()) {
|
|
|
|
child->UnsetFlags(ELEMENT_ALL_RESTYLE_FLAGS);
|
|
|
|
}
|
2003-09-27 04:18:26 +00:00
|
|
|
|
2007-03-05 00:11:23 +00:00
|
|
|
// IMPORTANT: This must match the conditions in
|
|
|
|
// nsCSSFrameConstructor::ContentAppended/Inserted/Removed
|
2009-08-24 20:02:07 +00:00
|
|
|
if (!child->IsHTML())
|
2001-10-07 00:19:01 +00:00
|
|
|
continue;
|
2003-09-27 04:18:26 +00:00
|
|
|
|
2003-11-19 01:20:56 +00:00
|
|
|
nsIAtom *tag = child->Tag();
|
2006-12-26 17:47:52 +00:00
|
|
|
if (tag == nsGkAtoms::frameset || tag == nsGkAtoms::frame) {
|
2003-02-22 00:32:13 +00:00
|
|
|
nsRefPtr<nsStyleContext> kidSC;
|
2002-05-23 00:00:34 +00:00
|
|
|
nsresult result;
|
2001-10-07 00:19:01 +00:00
|
|
|
|
2010-04-30 13:12:06 +00:00
|
|
|
kidSC = shell->StyleSet()->ResolveStyleFor(child->AsElement(),
|
|
|
|
mStyleContext);
|
2006-12-26 17:47:52 +00:00
|
|
|
if (tag == nsGkAtoms::frameset) {
|
2006-03-26 21:30:36 +00:00
|
|
|
frame = NS_NewHTMLFramesetFrame(shell, kidSC);
|
2005-11-01 20:40:54 +00:00
|
|
|
if (NS_UNLIKELY(!frame))
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2001-10-07 00:19:01 +00:00
|
|
|
|
|
|
|
mChildTypes[mChildCount] = FRAMESET;
|
|
|
|
nsHTMLFramesetFrame* childFrame = (nsHTMLFramesetFrame*)frame;
|
|
|
|
childFrame->SetParentFrameborder(frameborder);
|
|
|
|
childFrame->SetParentBorderWidth(borderWidth);
|
|
|
|
childFrame->SetParentBorderColor(borderColor);
|
2006-03-26 21:30:36 +00:00
|
|
|
result = frame->Init(child, this, nsnull);
|
2004-12-30 22:05:22 +00:00
|
|
|
if (NS_FAILED(result)) {
|
2006-04-10 00:16:29 +00:00
|
|
|
frame->Destroy();
|
2004-12-30 22:05:22 +00:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildBorderColors[mChildCount].Set(childFrame->GetBorderColor());
|
|
|
|
} else { // frame
|
2006-03-26 21:30:36 +00:00
|
|
|
frame = NS_NewSubDocumentFrame(shell, kidSC);
|
2005-10-26 21:46:39 +00:00
|
|
|
if (NS_UNLIKELY(!frame))
|
2004-12-30 22:05:22 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
result = frame->Init(child, this, nsnull);
|
2004-12-30 22:05:22 +00:00
|
|
|
if (NS_FAILED(result)) {
|
2006-04-10 00:16:29 +00:00
|
|
|
frame->Destroy();
|
2004-12-30 22:05:22 +00:00
|
|
|
return result;
|
|
|
|
}
|
2001-10-07 00:19:01 +00:00
|
|
|
|
|
|
|
mChildTypes[mChildCount] = FRAME;
|
|
|
|
|
2001-12-07 19:40:07 +00:00
|
|
|
mChildFrameborder[mChildCount] = GetFrameBorder(child);
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildBorderColors[mChildCount].Set(GetBorderColor(child));
|
|
|
|
}
|
2009-12-24 21:20:05 +00:00
|
|
|
child->SetPrimaryFrame(frame);
|
2001-10-07 00:19:01 +00:00
|
|
|
|
|
|
|
if (NS_FAILED(result))
|
|
|
|
return result;
|
|
|
|
|
2009-09-18 11:09:35 +00:00
|
|
|
mFrames.AppendFrame(nsnull, frame);
|
|
|
|
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildCount++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mNonBlankChildCount = mChildCount;
|
|
|
|
// add blank frames for frameset cells that had no content provided
|
|
|
|
for (int blankX = mChildCount; blankX < numCells; blankX++) {
|
2003-02-22 00:32:13 +00:00
|
|
|
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
2006-03-26 21:30:36 +00:00
|
|
|
pseudoStyleContext = shell->StyleSet()->
|
2009-12-11 07:37:40 +00:00
|
|
|
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::framesetBlank, mStyleContext);
|
2004-12-30 22:05:22 +00:00
|
|
|
if (!pseudoStyleContext) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
// XXX the blank frame is using the content of its parent - at some point it
|
|
|
|
// should just have null content, if we support that
|
|
|
|
nsHTMLFramesetBlankFrame* blankFrame = new (shell) nsHTMLFramesetBlankFrame(pseudoStyleContext);
|
|
|
|
if (!blankFrame)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
result = blankFrame->Init(mContent, this, nsnull);
|
2004-12-30 22:05:22 +00:00
|
|
|
if (NS_FAILED(result)) {
|
2006-04-10 00:16:29 +00:00
|
|
|
blankFrame->Destroy();
|
2004-12-30 22:05:22 +00:00
|
|
|
return result;
|
|
|
|
}
|
2001-10-07 00:19:01 +00:00
|
|
|
|
2009-09-18 11:09:35 +00:00
|
|
|
mFrames.AppendFrame(nsnull, blankFrame);
|
|
|
|
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildTypes[mChildCount] = BLANK;
|
|
|
|
mChildBorderColors[mChildCount].Set(NO_COLOR);
|
|
|
|
mChildCount++;
|
|
|
|
}
|
|
|
|
|
|
|
|
mNonBorderChildCount = mChildCount;
|
1999-03-10 06:13:35 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2009-01-19 18:31:31 +00:00
|
|
|
NS_IMETHODIMP
|
2011-08-24 20:54:30 +00:00
|
|
|
nsHTMLFramesetFrame::SetInitialChildList(ChildListID aListID,
|
2009-07-28 12:53:20 +00:00
|
|
|
nsFrameList& aChildList)
|
2009-01-19 18:31:31 +00:00
|
|
|
{
|
|
|
|
// We do this weirdness where we create our child frames in Init(). On the
|
2009-07-28 12:53:20 +00:00
|
|
|
// other hand, we're going to get a SetInitialChildList() with an empty list
|
|
|
|
// and null list name after the frame constructor is done creating us. So
|
|
|
|
// just ignore that call.
|
2011-08-24 20:54:30 +00:00
|
|
|
if (aListID == kPrincipalList && aChildList.IsEmpty()) {
|
2009-01-19 18:31:31 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-12-27 20:18:48 +00:00
|
|
|
return nsContainerFrame::SetInitialChildList(aListID, aChildList);
|
2009-01-19 18:31:31 +00:00
|
|
|
}
|
|
|
|
|
1998-11-28 18:59:38 +00:00
|
|
|
// XXX should this try to allocate twips based on an even pixel boundary?
|
1999-03-10 06:13:35 +00:00
|
|
|
void nsHTMLFramesetFrame::Scale(nscoord aDesired,
|
|
|
|
PRInt32 aNumIndicies,
|
|
|
|
PRInt32* aIndicies,
|
2000-01-07 05:49:20 +00:00
|
|
|
PRInt32 aNumItems,
|
1999-03-10 06:13:35 +00:00
|
|
|
PRInt32* aItems)
|
1998-11-28 18:59:38 +00:00
|
|
|
{
|
|
|
|
PRInt32 actual = 0;
|
|
|
|
PRInt32 i, j;
|
|
|
|
// get the actual total
|
|
|
|
for (i = 0; i < aNumIndicies; i++) {
|
|
|
|
j = aIndicies[i];
|
|
|
|
actual += aItems[j];
|
|
|
|
}
|
|
|
|
|
2003-09-13 19:42:43 +00:00
|
|
|
if (actual > 0) {
|
|
|
|
float factor = (float)aDesired / (float)actual;
|
|
|
|
actual = 0;
|
|
|
|
// scale the items up or down
|
|
|
|
for (i = 0; i < aNumIndicies; i++) {
|
|
|
|
j = aIndicies[i];
|
|
|
|
aItems[j] = NSToCoordRound((float)aItems[j] * factor);
|
|
|
|
actual += aItems[j];
|
|
|
|
}
|
|
|
|
} else if (aNumIndicies != 0) {
|
|
|
|
// All the specs say zero width, but we have to fill up space
|
|
|
|
// somehow. Distribute it equally.
|
|
|
|
nscoord width = NSToCoordRound((float)aDesired / (float)aNumIndicies);
|
|
|
|
actual = width * aNumIndicies;
|
|
|
|
for (i = 0; i < aNumIndicies; i++) {
|
|
|
|
aItems[aIndicies[i]] = width;
|
|
|
|
}
|
1998-11-28 18:59:38 +00:00
|
|
|
}
|
|
|
|
|
2003-09-13 19:42:43 +00:00
|
|
|
if (aNumIndicies > 0 && aDesired != actual) {
|
1998-11-28 18:59:38 +00:00
|
|
|
PRInt32 unit = (aDesired > actual) ? 1 : -1;
|
2000-01-07 05:49:20 +00:00
|
|
|
for (i=0; (i < aNumIndicies) && (aDesired != actual); i++) {
|
1998-11-28 18:59:38 +00:00
|
|
|
j = aIndicies[i];
|
2000-01-07 05:49:20 +00:00
|
|
|
if (j < aNumItems) {
|
|
|
|
aItems[j] += unit;
|
|
|
|
actual += unit;
|
|
|
|
}
|
1998-11-28 18:59:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
/**
|
|
|
|
* Translate the rows/cols specs into an array of integer sizes for
|
1998-11-28 18:59:38 +00:00
|
|
|
* each cell in the frameset. Sizes are allocated based on the priorities of the
|
|
|
|
* specifier - fixed sizes have the highest priority, percentage sizes have the next
|
|
|
|
* highest priority and relative sizes have the lowest.
|
1998-07-15 23:42:14 +00:00
|
|
|
*/
|
2004-07-31 23:15:21 +00:00
|
|
|
void nsHTMLFramesetFrame::CalculateRowCol(nsPresContext* aPresContext,
|
2002-08-06 01:06:50 +00:00
|
|
|
nscoord aSize,
|
|
|
|
PRInt32 aNumSpecs,
|
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues)
|
1998-07-15 23:42:14 +00:00
|
|
|
{
|
2011-01-25 01:38:07 +00:00
|
|
|
// aNumSpecs maximum value is NS_MAX_FRAMESET_SPEC_COUNT
|
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(PRInt32));
|
|
|
|
|
1998-11-28 18:59:38 +00:00
|
|
|
PRInt32 fixedTotal = 0;
|
|
|
|
PRInt32 numFixed = 0;
|
2006-10-07 08:53:06 +00:00
|
|
|
nsAutoArrayPtr<PRInt32> fixed(new PRInt32[aNumSpecs]);
|
1998-11-28 18:59:38 +00:00
|
|
|
PRInt32 numPercent = 0;
|
2006-10-07 08:53:06 +00:00
|
|
|
nsAutoArrayPtr<PRInt32> percent(new PRInt32[aNumSpecs]);
|
1998-11-28 18:59:38 +00:00
|
|
|
PRInt32 relativeSums = 0;
|
|
|
|
PRInt32 numRelative = 0;
|
2006-10-07 08:53:06 +00:00
|
|
|
nsAutoArrayPtr<PRInt32> relative(new PRInt32[aNumSpecs]);
|
|
|
|
|
|
|
|
if (NS_UNLIKELY(!fixed || !percent || !relative)) {
|
|
|
|
return; // NS_ERROR_OUT_OF_MEMORY
|
|
|
|
}
|
1998-11-28 18:59:38 +00:00
|
|
|
|
|
|
|
PRInt32 i, j;
|
|
|
|
|
|
|
|
// initialize the fixed, percent, relative indices, allocate the fixed sizes and zero the others
|
|
|
|
for (i = 0; i < aNumSpecs; i++) {
|
|
|
|
aValues[i] = 0;
|
1998-07-15 23:42:14 +00:00
|
|
|
switch (aSpecs[i].mUnit) {
|
1998-11-28 18:59:38 +00:00
|
|
|
case eFramesetUnit_Fixed:
|
2007-02-07 07:46:44 +00:00
|
|
|
aValues[i] = nsPresContext::CSSPixelsToAppUnits(aSpecs[i].mValue);
|
1998-11-28 18:59:38 +00:00
|
|
|
fixedTotal += aValues[i];
|
|
|
|
fixed[numFixed] = i;
|
|
|
|
numFixed++;
|
1998-07-15 23:42:14 +00:00
|
|
|
break;
|
|
|
|
case eFramesetUnit_Percent:
|
1998-11-28 18:59:38 +00:00
|
|
|
percent[numPercent] = i;
|
|
|
|
numPercent++;
|
1998-07-15 23:42:14 +00:00
|
|
|
break;
|
1998-11-28 18:59:38 +00:00
|
|
|
case eFramesetUnit_Relative:
|
|
|
|
relative[numRelative] = i;
|
|
|
|
numRelative++;
|
|
|
|
relativeSums += aSpecs[i].mValue;
|
1998-07-15 23:42:14 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-28 18:59:38 +00:00
|
|
|
// scale the fixed sizes if they total too much (or too little and there aren't any percent or relative)
|
|
|
|
if ((fixedTotal > aSize) || ((fixedTotal < aSize) && (0 == numPercent) && (0 == numRelative))) {
|
2000-01-07 05:49:20 +00:00
|
|
|
Scale(aSize, numFixed, fixed, aNumSpecs, aValues);
|
1998-11-28 18:59:38 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 percentMax = aSize - fixedTotal;
|
|
|
|
PRInt32 percentTotal = 0;
|
|
|
|
// allocate the percentage sizes from what is left over from the fixed allocation
|
|
|
|
for (i = 0; i < numPercent; i++) {
|
|
|
|
j = percent[i];
|
1999-06-11 00:28:00 +00:00
|
|
|
aValues[j] = NSToCoordRound((float)aSpecs[j].mValue * (float)aSize / 100.0f);
|
1998-11-28 18:59:38 +00:00
|
|
|
percentTotal += aValues[j];
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
|
1998-11-28 18:59:38 +00:00
|
|
|
// scale the percent sizes if they total too much (or too little and there aren't any relative)
|
|
|
|
if ((percentTotal > percentMax) || ((percentTotal < percentMax) && (0 == numRelative))) {
|
2000-01-07 05:49:20 +00:00
|
|
|
Scale(percentMax, numPercent, percent, aNumSpecs, aValues);
|
1998-11-28 18:59:38 +00:00
|
|
|
return;
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
1998-11-28 18:59:38 +00:00
|
|
|
|
|
|
|
PRInt32 relativeMax = percentMax - percentTotal;
|
|
|
|
PRInt32 relativeTotal = 0;
|
|
|
|
// allocate the relative sizes from what is left over from the percent allocation
|
|
|
|
for (i = 0; i < numRelative; i++) {
|
|
|
|
j = relative[i];
|
|
|
|
aValues[j] = NSToCoordRound((float)aSpecs[j].mValue * (float)relativeMax / (float)relativeSums);
|
|
|
|
relativeTotal += aValues[j];
|
|
|
|
}
|
|
|
|
|
|
|
|
// scale the relative sizes if they take up too much or too little
|
|
|
|
if (relativeTotal != relativeMax) {
|
2000-01-07 05:49:20 +00:00
|
|
|
Scale(relativeMax, numRelative, relative, aNumSpecs, aValues);
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-11-28 18:59:38 +00:00
|
|
|
|
1999-06-11 00:51:05 +00:00
|
|
|
/**
|
|
|
|
* Translate the rows/cols integer sizes into an array of specs for
|
|
|
|
* each cell in the frameset. Reverse of CalculateRowCol() behaviour.
|
|
|
|
* This allows us to maintain the user size info through reflows.
|
|
|
|
*/
|
2004-07-31 23:15:21 +00:00
|
|
|
void nsHTMLFramesetFrame::GenerateRowCol(nsPresContext* aPresContext,
|
2002-08-06 01:06:50 +00:00
|
|
|
nscoord aSize,
|
|
|
|
PRInt32 aNumSpecs,
|
|
|
|
const nsFramesetSpec* aSpecs,
|
|
|
|
nscoord* aValues,
|
|
|
|
nsString& aNewAttr)
|
1999-06-11 00:51:05 +00:00
|
|
|
{
|
|
|
|
PRInt32 i;
|
|
|
|
|
2002-08-06 01:06:50 +00:00
|
|
|
for (i = 0; i < aNumSpecs; i++) {
|
|
|
|
if (!aNewAttr.IsEmpty())
|
|
|
|
aNewAttr.Append(PRUnichar(','));
|
|
|
|
|
1999-06-11 00:51:05 +00:00
|
|
|
switch (aSpecs[i].mUnit) {
|
|
|
|
case eFramesetUnit_Fixed:
|
2007-02-07 07:46:44 +00:00
|
|
|
aNewAttr.AppendInt(nsPresContext::AppUnitsToIntCSSPixels(aValues[i]));
|
1999-06-11 00:51:05 +00:00
|
|
|
break;
|
|
|
|
case eFramesetUnit_Percent: // XXX Only accurate to 1%, need 1 pixel
|
|
|
|
case eFramesetUnit_Relative:
|
2002-08-06 01:06:50 +00:00
|
|
|
// Add 0.5 to the percentage to make rounding work right.
|
|
|
|
aNewAttr.AppendInt(PRUint32((100.0*aValues[i])/aSize + 0.5));
|
|
|
|
aNewAttr.Append(PRUnichar('%'));
|
1999-06-11 00:51:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
PRInt32 nsHTMLFramesetFrame::GetBorderWidth(nsPresContext* aPresContext,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aTakeForcingIntoAccount)
|
1998-07-27 05:59:37 +00:00
|
|
|
{
|
2011-09-29 06:19:26 +00:00
|
|
|
bool forcing = mForceFrameResizability && aTakeForcingIntoAccount;
|
2001-11-06 00:44:25 +00:00
|
|
|
|
|
|
|
if (!forcing) {
|
2001-12-07 19:40:07 +00:00
|
|
|
nsFrameborder frameborder = GetFrameBorder();
|
2001-11-02 02:19:49 +00:00
|
|
|
if (frameborder == eFrameborder_No) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
2005-01-12 19:45:38 +00:00
|
|
|
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
|
2002-05-23 00:00:34 +00:00
|
|
|
|
|
|
|
if (content) {
|
2006-12-26 17:47:52 +00:00
|
|
|
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::border);
|
2005-01-25 00:02:58 +00:00
|
|
|
if (attr) {
|
1998-11-30 18:19:21 +00:00
|
|
|
PRInt32 intVal = 0;
|
2005-01-25 00:02:58 +00:00
|
|
|
if (attr->Type() == nsAttrValue::eInteger) {
|
|
|
|
intVal = attr->GetIntegerValue();
|
|
|
|
if (intVal < 0) {
|
|
|
|
intVal = 0;
|
|
|
|
}
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
2002-05-23 00:00:34 +00:00
|
|
|
|
2001-11-06 00:44:25 +00:00
|
|
|
if (forcing && intVal == 0) {
|
2001-11-02 02:19:49 +00:00
|
|
|
intVal = DEFAULT_BORDER_WIDTH_PX;
|
|
|
|
}
|
2007-02-07 07:46:44 +00:00
|
|
|
return nsPresContext::CSSPixelsToAppUnits(intVal);
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-11-02 02:19:49 +00:00
|
|
|
if (mParentBorderWidth > 0 ||
|
2001-11-06 00:44:25 +00:00
|
|
|
(mParentBorderWidth == 0 && !forcing)) {
|
1998-08-06 19:40:37 +00:00
|
|
|
return mParentBorderWidth;
|
|
|
|
}
|
|
|
|
|
2007-02-07 07:46:44 +00:00
|
|
|
return nsPresContext::CSSPixelsToAppUnits(DEFAULT_BORDER_WIDTH_PX);
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
PRIntn
|
|
|
|
nsHTMLFramesetFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetFrame::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
|
|
|
{
|
|
|
|
nsHTMLFramesetFrame* framesetParent = GetFramesetParent(this);
|
|
|
|
if (nsnull == framesetParent) {
|
2006-11-24 08:12:17 +00:00
|
|
|
if (aPresContext->IsPaginated()) {
|
|
|
|
// XXX This needs to be changed when framesets paginate properly
|
|
|
|
aDesiredSize.width = aReflowState.availableWidth;
|
|
|
|
aDesiredSize.height = aReflowState.availableHeight;
|
|
|
|
} else {
|
|
|
|
nsRect area = aPresContext->GetVisibleArea();
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2006-11-24 08:12:17 +00:00
|
|
|
aDesiredSize.width = area.width;
|
|
|
|
aDesiredSize.height= area.height;
|
|
|
|
}
|
1998-07-15 23:42:14 +00:00
|
|
|
} else {
|
1998-07-21 23:20:04 +00:00
|
|
|
nsSize size;
|
|
|
|
framesetParent->GetSizeOfChild(this, size);
|
|
|
|
aDesiredSize.width = size.width;
|
|
|
|
aDesiredSize.height = size.height;
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
nsHTMLFramesetFrame* nsHTMLFramesetFrame::GetFramesetParent(nsIFrame* aChild)
|
|
|
|
{
|
|
|
|
nsHTMLFramesetFrame* parent = nsnull;
|
2003-07-05 15:30:50 +00:00
|
|
|
nsIContent* content = aChild->GetContent();
|
2002-05-23 00:00:34 +00:00
|
|
|
|
|
|
|
if (content) {
|
2003-07-28 21:25:13 +00:00
|
|
|
nsCOMPtr<nsIContent> contentParent = content->GetParent();
|
2002-05-23 00:00:34 +00:00
|
|
|
|
2009-08-24 20:02:07 +00:00
|
|
|
if (contentParent && contentParent->IsHTML() &&
|
2006-12-26 17:47:52 +00:00
|
|
|
contentParent->Tag() == nsGkAtoms::frameset) {
|
2003-11-19 01:20:56 +00:00
|
|
|
nsIFrame* fptr = aChild->GetParent();
|
|
|
|
parent = (nsHTMLFramesetFrame*) fptr;
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
// only valid for non border children
|
1999-03-10 06:13:35 +00:00
|
|
|
void nsHTMLFramesetFrame::GetSizeOfChildAt(PRInt32 aIndexInParent,
|
|
|
|
nsSize& aSize,
|
2009-01-15 03:27:09 +00:00
|
|
|
nsIntPoint& aCellIndex)
|
1998-07-20 18:52:40 +00:00
|
|
|
{
|
|
|
|
PRInt32 row = aIndexInParent / mNumCols;
|
|
|
|
PRInt32 col = aIndexInParent - (row * mNumCols); // remainder from dividing index by mNumCols
|
|
|
|
if ((row < mNumRows) && (col < mNumCols)) {
|
|
|
|
aSize.width = mColSizes[col];
|
|
|
|
aSize.height = mRowSizes[row];
|
|
|
|
aCellIndex.x = col;
|
|
|
|
aCellIndex.y = row;
|
|
|
|
} else {
|
2009-01-15 03:27:09 +00:00
|
|
|
aSize.width = aSize.height = 0;
|
|
|
|
aCellIndex.x = aCellIndex.y = 0;
|
1998-07-20 18:52:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
// only valid for non border children
|
1998-07-15 23:42:14 +00:00
|
|
|
void nsHTMLFramesetFrame::GetSizeOfChild(nsIFrame* aChild,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsSize& aSize)
|
1998-07-15 23:42:14 +00:00
|
|
|
{
|
1998-07-20 18:52:40 +00:00
|
|
|
// Reflow only creates children frames for <frameset> and <frame> content.
|
|
|
|
// this assumption is used here
|
1998-07-15 23:42:14 +00:00
|
|
|
int i = 0;
|
1999-01-15 22:53:39 +00:00
|
|
|
for (nsIFrame* child = mFrames.FirstChild(); child;
|
2003-07-05 15:30:50 +00:00
|
|
|
child = child->GetNextSibling()) {
|
1998-07-15 23:42:14 +00:00
|
|
|
if (aChild == child) {
|
2009-01-15 03:27:09 +00:00
|
|
|
nsIntPoint ignore;
|
1998-07-20 18:52:40 +00:00
|
|
|
GetSizeOfChildAt(i, aSize, ignore);
|
1998-07-27 05:59:37 +00:00
|
|
|
return;
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
1998-07-20 18:52:40 +00:00
|
|
|
aSize.width = 0;
|
|
|
|
aSize.height = 0;
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
NS_METHOD nsHTMLFramesetFrame::HandleEvent(nsPresContext* aPresContext,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aEventStatus);
|
1998-11-25 18:11:26 +00:00
|
|
|
if (mDragger) {
|
|
|
|
// the nsFramesetBorderFrame has captured NS_MOUSE_DOWN
|
|
|
|
switch (aEvent->message) {
|
|
|
|
case NS_MOUSE_MOVE:
|
|
|
|
MouseDrag(aPresContext, aEvent);
|
|
|
|
break;
|
2006-11-16 21:35:39 +00:00
|
|
|
case NS_MOUSE_BUTTON_UP:
|
|
|
|
if (aEvent->eventStructType == NS_MOUSE_EVENT &&
|
2007-07-08 07:08:04 +00:00
|
|
|
static_cast<nsMouseEvent*>(aEvent)->button ==
|
2006-11-16 21:35:39 +00:00
|
|
|
nsMouseEvent::eLeftButton) {
|
|
|
|
EndMouseDrag(aPresContext);
|
|
|
|
}
|
1998-11-25 18:11:26 +00:00
|
|
|
break;
|
|
|
|
}
|
1999-11-24 06:03:41 +00:00
|
|
|
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
1998-11-25 18:11:26 +00:00
|
|
|
} else {
|
1999-11-24 06:03:41 +00:00
|
|
|
*aEventStatus = nsEventStatus_eIgnore;
|
1998-11-18 05:25:26 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-07-15 23:42:14 +00:00
|
|
|
NS_IMETHODIMP
|
2004-12-30 21:56:11 +00:00
|
|
|
nsHTMLFramesetFrame::GetCursor(const nsPoint& aPoint,
|
|
|
|
nsIFrame::Cursor& aCursor)
|
1999-03-10 06:13:35 +00:00
|
|
|
{
|
|
|
|
if (mDragger) {
|
2009-08-12 14:03:35 +00:00
|
|
|
aCursor.mCursor = (mDragger->mVertical) ? NS_STYLE_CURSOR_EW_RESIZE : NS_STYLE_CURSOR_NS_RESIZE;
|
1999-03-10 06:13:35 +00:00
|
|
|
} else {
|
2004-12-30 21:56:11 +00:00
|
|
|
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
|
1999-03-10 06:13:35 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2006-01-26 02:29:17 +00:00
|
|
|
nsHTMLFramesetFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
1998-07-15 23:42:14 +00:00
|
|
|
{
|
2011-12-27 20:18:48 +00:00
|
|
|
nsresult rv = BuildDisplayListForInline(aBuilder, aDirtyRect, aLists);
|
2006-01-26 02:29:17 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
if (mDragger && aBuilder->IsForEventDelivery()) {
|
2010-08-13 10:01:13 +00:00
|
|
|
rv = aLists.Content()->AppendNewToTop(
|
|
|
|
new (aBuilder) nsDisplayEventReceiver(aBuilder, this));
|
2006-01-26 02:29:17 +00:00
|
|
|
}
|
|
|
|
return rv;
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
void
|
1998-10-02 04:10:00 +00:00
|
|
|
nsHTMLFramesetFrame::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)
|
1998-07-27 05:59:37 +00:00
|
|
|
{
|
2000-03-24 04:42:40 +00:00
|
|
|
// reflow the child
|
1999-10-30 02:52:11 +00:00
|
|
|
nsHTMLReflowState reflowState(aPresContext, aReflowState, aChild, aSize);
|
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
|
|
|
nsHTMLReflowMetrics metrics;
|
1999-10-30 02:52:11 +00:00
|
|
|
metrics.width = aSize.width;
|
|
|
|
metrics.height= aSize.height;
|
|
|
|
nsReflowStatus status;
|
1999-03-10 06:13:35 +00:00
|
|
|
|
1999-11-19 15:33:29 +00:00
|
|
|
ReflowChild(aChild, aPresContext, metrics, reflowState, aOffset.x,
|
|
|
|
aOffset.y, 0, status);
|
1999-10-30 02:52:11 +00:00
|
|
|
NS_ASSERTION(NS_FRAME_IS_COMPLETE(status), "bad status");
|
1998-07-27 05:59:37 +00:00
|
|
|
|
1999-10-30 02:52:11 +00:00
|
|
|
// Place and size the child
|
1999-11-19 15:33:29 +00:00
|
|
|
metrics.width = aSize.width;
|
|
|
|
metrics.height = aSize.height;
|
2001-12-07 14:51:12 +00:00
|
|
|
FinishReflowChild(aChild, aPresContext, nsnull, metrics, aOffset.x, aOffset.y, 0);
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
|
1999-02-25 15:38:29 +00:00
|
|
|
static
|
2005-01-12 19:45:38 +00:00
|
|
|
nsFrameborder GetFrameBorderHelper(nsGenericHTMLElement* aContent)
|
1998-08-06 19:40:37 +00:00
|
|
|
{
|
1998-09-09 23:30:30 +00:00
|
|
|
if (nsnull != aContent) {
|
2006-12-26 17:47:52 +00:00
|
|
|
const nsAttrValue* attr = aContent->GetParsedAttr(nsGkAtoms::frameborder);
|
2005-01-25 00:02:58 +00:00
|
|
|
if (attr && attr->Type() == nsAttrValue::eEnum) {
|
|
|
|
switch (attr->GetEnumValue())
|
|
|
|
{
|
|
|
|
case NS_STYLE_FRAME_YES:
|
|
|
|
case NS_STYLE_FRAME_1:
|
|
|
|
return eFrameborder_Yes;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_FRAME_NO:
|
|
|
|
case NS_STYLE_FRAME_0:
|
|
|
|
return eFrameborder_No;
|
|
|
|
break;
|
|
|
|
}
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
|
|
|
}
|
1998-09-09 23:30:30 +00:00
|
|
|
return eFrameborder_Notset;
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
|
|
|
|
2001-12-07 19:40:07 +00:00
|
|
|
nsFrameborder nsHTMLFramesetFrame::GetFrameBorder()
|
1998-07-30 21:25:35 +00:00
|
|
|
{
|
1998-09-09 23:30:30 +00:00
|
|
|
nsFrameborder result = eFrameborder_Notset;
|
2005-01-12 19:45:38 +00:00
|
|
|
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
|
2002-05-23 00:00:34 +00:00
|
|
|
|
2001-12-07 19:40:07 +00:00
|
|
|
if (content) {
|
|
|
|
result = GetFrameBorderHelper(content);
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
|
|
|
if (eFrameborder_Notset == result) {
|
|
|
|
return mParentFrameborder;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2001-12-07 19:40:07 +00:00
|
|
|
nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent)
|
1998-09-09 23:30:30 +00:00
|
|
|
{
|
|
|
|
nsFrameborder result = eFrameborder_Notset;
|
2002-05-23 00:00:34 +00:00
|
|
|
|
2005-01-12 19:45:38 +00:00
|
|
|
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(aContent);
|
2002-05-23 00:00:34 +00:00
|
|
|
|
|
|
|
if (content) {
|
2001-12-07 19:40:07 +00:00
|
|
|
result = GetFrameBorderHelper(content);
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
|
|
|
if (eFrameborder_Notset == result) {
|
2001-12-07 19:40:07 +00:00
|
|
|
return GetFrameBorder();
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-09 23:30:30 +00:00
|
|
|
return result;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-07-27 05:59:37 +00:00
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
nscolor nsHTMLFramesetFrame::GetBorderColor()
|
|
|
|
{
|
2005-01-12 19:45:38 +00:00
|
|
|
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(mContent);
|
2002-05-23 00:00:34 +00:00
|
|
|
|
|
|
|
if (content) {
|
2006-12-26 17:47:52 +00:00
|
|
|
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::bordercolor);
|
2005-01-25 00:02:58 +00:00
|
|
|
if (attr) {
|
2004-02-11 00:38:12 +00:00
|
|
|
nscolor color;
|
2005-01-25 00:02:58 +00:00
|
|
|
if (attr->GetColorValue(color)) {
|
2004-02-11 00:38:12 +00:00
|
|
|
return color;
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
2004-02-11 00:38:12 +00:00
|
|
|
|
|
|
|
return mParentBorderColor;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
|
1998-09-09 23:30:30 +00:00
|
|
|
nscolor nsHTMLFramesetFrame::GetBorderColor(nsIContent* aContent)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
2005-01-12 19:45:38 +00:00
|
|
|
nsGenericHTMLElement *content = nsGenericHTMLElement::FromContent(aContent);
|
2002-05-23 00:00:34 +00:00
|
|
|
|
|
|
|
if (content) {
|
2006-12-26 17:47:52 +00:00
|
|
|
const nsAttrValue* attr = content->GetParsedAttr(nsGkAtoms::bordercolor);
|
2005-01-25 00:02:58 +00:00
|
|
|
if (attr) {
|
2004-02-11 00:38:12 +00:00
|
|
|
nscolor color;
|
2005-01-25 00:02:58 +00:00
|
|
|
if (attr->GetColorValue(color)) {
|
2004-02-11 00:38:12 +00:00
|
|
|
return color;
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
2004-02-11 00:38:12 +00:00
|
|
|
return GetBorderColor();
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
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
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame");
|
2001-11-14 13:40:03 +00:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
2003-12-21 05:36:36 +00:00
|
|
|
nsIPresShell *shell = aPresContext->PresShell();
|
2004-01-28 00:18:22 +00:00
|
|
|
nsStyleSet *styleSet = shell->StyleSet();
|
2003-12-21 05:36:36 +00:00
|
|
|
|
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
|
|
|
mParent->AddStateBits(NS_FRAME_CONTAINS_RELATIVE_HEIGHT);
|
|
|
|
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
|
1998-07-15 23:42:14 +00:00
|
|
|
// Always get the size so that the caller knows how big we are
|
1999-11-24 06:03:41 +00:00
|
|
|
GetDesiredSize(aPresContext, aReflowState, aDesiredSize);
|
2001-10-07 00:19:01 +00:00
|
|
|
|
1999-01-05 23:31:18 +00:00
|
|
|
nscoord width = (aDesiredSize.width <= aReflowState.availableWidth)
|
|
|
|
? aDesiredSize.width : aReflowState.availableWidth;
|
|
|
|
nscoord height = (aDesiredSize.height <= aReflowState.availableHeight)
|
|
|
|
? aDesiredSize.height : aReflowState.availableHeight;
|
2001-11-02 02:19:49 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool firstTime = (GetStateBits() & NS_FRAME_FIRST_REFLOW) != 0;
|
2001-11-02 02:19:49 +00:00
|
|
|
if (firstTime) {
|
2011-05-28 23:42:57 +00:00
|
|
|
Preferences::RegisterCallback(FrameResizePrefCallback,
|
|
|
|
kFrameResizePref, this);
|
2011-05-25 06:31:59 +00:00
|
|
|
mForceFrameResizability = Preferences::GetBool(kFrameResizePref);
|
2001-11-02 02:19:49 +00:00
|
|
|
}
|
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
// subtract out the width of all of the potential borders. There are
|
|
|
|
// only borders between <frame>s. There are none on the edges (e.g the
|
|
|
|
// leftmost <frame> has no left border).
|
2011-10-17 14:59:28 +00:00
|
|
|
PRInt32 borderWidth = GetBorderWidth(aPresContext, true);
|
2000-09-21 05:07:06 +00:00
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
width -= (mNumCols - 1) * borderWidth;
|
2000-09-21 05:07:06 +00:00
|
|
|
if (width < 0) width = 0;
|
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
height -= (mNumRows - 1) * borderWidth;
|
2000-09-21 05:07:06 +00:00
|
|
|
if (height < 0) height = 0;
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2011-06-08 19:04:10 +00:00
|
|
|
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
2007-03-22 23:57:55 +00:00
|
|
|
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
|
|
|
const nsFramesetSpec* rowSpecs = nsnull;
|
|
|
|
const nsFramesetSpec* colSpecs = nsnull;
|
|
|
|
PRInt32 rows = 0;
|
|
|
|
PRInt32 cols = 0;
|
|
|
|
ourContent->GetRowSpec(&rows, &rowSpecs);
|
|
|
|
ourContent->GetColSpec(&cols, &colSpecs);
|
|
|
|
// If the number of cols or rows has changed, the frame for the frameset
|
|
|
|
// will be re-created.
|
2007-04-10 19:08:21 +00:00
|
|
|
if (mNumRows != rows || mNumCols != cols) {
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
mDrag.UnSet();
|
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2007-03-22 23:57:55 +00:00
|
|
|
|
2011-01-26 05:41:52 +00:00
|
|
|
CalculateRowCol(aPresContext, width, mNumCols, colSpecs, mColSizes);
|
|
|
|
CalculateRowCol(aPresContext, height, mNumRows, rowSpecs, mRowSizes);
|
1998-07-20 18:52:40 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
nsAutoArrayPtr<bool> verBordersVis; // vertical borders visibility
|
2006-10-07 08:53:06 +00:00
|
|
|
nsAutoArrayPtr<nscolor> verBorderColors;
|
2011-09-29 06:19:26 +00:00
|
|
|
nsAutoArrayPtr<bool> horBordersVis; // horizontal borders visibility
|
2006-10-07 08:53:06 +00:00
|
|
|
nsAutoArrayPtr<nscolor> horBorderColors;
|
|
|
|
nscolor borderColor = GetBorderColor();
|
|
|
|
nsFrameborder frameborder = GetFrameBorder();
|
2001-04-11 07:56:13 +00:00
|
|
|
|
1998-07-30 21:25:35 +00:00
|
|
|
if (firstTime) {
|
2011-01-25 01:38:07 +00:00
|
|
|
// Check for overflow in memory allocations using mNumCols and mNumRows
|
|
|
|
// which have a maxium value of NS_MAX_FRAMESET_SPEC_COUNT.
|
2011-09-29 06:19:26 +00:00
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(bool));
|
2011-01-25 01:38:07 +00:00
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < UINT_MAX / sizeof(nscolor));
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
verBordersVis = new bool[mNumCols];
|
2006-10-07 08:53:06 +00:00
|
|
|
NS_ENSURE_TRUE(verBordersVis, NS_ERROR_OUT_OF_MEMORY);
|
1998-09-03 01:16:27 +00:00
|
|
|
verBorderColors = new nscolor[mNumCols];
|
2006-10-07 08:53:06 +00:00
|
|
|
NS_ENSURE_TRUE(verBorderColors, NS_ERROR_OUT_OF_MEMORY);
|
1998-07-30 21:25:35 +00:00
|
|
|
for (int verX = 0; verX < mNumCols; verX++) {
|
2011-10-17 14:59:28 +00:00
|
|
|
verBordersVis[verX] = false;
|
1998-09-03 01:16:27 +00:00
|
|
|
verBorderColors[verX] = NO_COLOR;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
2001-10-07 00:19:01 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
horBordersVis = new bool[mNumRows];
|
2006-10-07 08:53:06 +00:00
|
|
|
NS_ENSURE_TRUE(horBordersVis, NS_ERROR_OUT_OF_MEMORY);
|
1998-09-03 01:16:27 +00:00
|
|
|
horBorderColors = new nscolor[mNumRows];
|
2006-10-07 08:53:06 +00:00
|
|
|
NS_ENSURE_TRUE(horBorderColors, NS_ERROR_OUT_OF_MEMORY);
|
1998-07-30 21:25:35 +00:00
|
|
|
for (int horX = 0; horX < mNumRows; horX++) {
|
2011-10-17 14:59:28 +00:00
|
|
|
horBordersVis[horX] = false;
|
1998-09-03 01:16:27 +00:00
|
|
|
horBorderColors[horX] = NO_COLOR;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-07-20 18:52:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// reflow the children
|
|
|
|
PRInt32 lastRow = 0;
|
1998-09-03 01:16:27 +00:00
|
|
|
PRInt32 lastCol = 0;
|
1998-07-30 21:25:35 +00:00
|
|
|
PRInt32 borderChildX = mNonBorderChildCount; // index of border children
|
|
|
|
nsHTMLFramesetBorderFrame* borderFrame = nsnull;
|
1998-07-20 18:52:40 +00:00
|
|
|
nsPoint offset(0,0);
|
1998-07-27 05:59:37 +00:00
|
|
|
nsSize size, lastSize;
|
1999-01-15 22:53:39 +00:00
|
|
|
nsIFrame* child = mFrames.FirstChild();
|
1998-07-30 21:25:35 +00:00
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
for (PRInt32 childX = 0; childX < mNonBorderChildCount; childX++) {
|
2009-01-15 03:27:09 +00:00
|
|
|
nsIntPoint cellIndex;
|
1998-07-27 05:59:37 +00:00
|
|
|
GetSizeOfChildAt(childX, size, cellIndex);
|
1998-07-20 18:52:40 +00:00
|
|
|
|
|
|
|
if (lastRow != cellIndex.y) { // changed to next row
|
|
|
|
offset.x = 0;
|
1998-07-27 05:59:37 +00:00
|
|
|
offset.y += lastSize.height;
|
2001-11-02 02:19:49 +00:00
|
|
|
if (firstTime) { // create horizontal border
|
2006-03-26 21:30:36 +00:00
|
|
|
|
2003-02-22 00:32:13 +00:00
|
|
|
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
2009-12-11 07:37:40 +00:00
|
|
|
pseudoStyleContext = styleSet->
|
|
|
|
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::horizontalFramesetBorder,
|
|
|
|
mStyleContext);
|
2006-03-26 21:30:36 +00:00
|
|
|
|
|
|
|
borderFrame = new (shell) nsHTMLFramesetBorderFrame(pseudoStyleContext,
|
|
|
|
borderWidth,
|
2011-10-17 14:59:28 +00:00
|
|
|
false,
|
|
|
|
false);
|
2006-10-07 08:53:06 +00:00
|
|
|
if (NS_LIKELY(borderFrame != nsnull)) {
|
|
|
|
borderFrame->Init(mContent, this, nsnull);
|
|
|
|
mChildCount++;
|
2009-09-18 11:09:35 +00:00
|
|
|
mFrames.AppendFrame(nsnull, borderFrame);
|
2006-10-07 08:53:06 +00:00
|
|
|
mHorBorders[cellIndex.y-1] = borderFrame;
|
|
|
|
// set the neighbors for determining drag boundaries
|
|
|
|
borderFrame->mPrevNeighbor = lastRow;
|
|
|
|
borderFrame->mNextNeighbor = cellIndex.y;
|
|
|
|
}
|
2001-11-02 02:19:49 +00:00
|
|
|
} else {
|
|
|
|
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
|
2006-10-07 08:53:06 +00:00
|
|
|
if (NS_LIKELY(borderFrame != nsnull)) {
|
|
|
|
borderFrame->mWidth = borderWidth;
|
|
|
|
borderChildX++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (NS_LIKELY(borderFrame != nsnull)) {
|
|
|
|
nsSize borderSize(aDesiredSize.width, borderWidth);
|
|
|
|
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
|
|
|
borderFrame = nsnull;
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
2001-11-02 02:19:49 +00:00
|
|
|
offset.y += borderWidth;
|
1998-07-27 05:59:37 +00:00
|
|
|
} else {
|
2001-11-02 02:19:49 +00:00
|
|
|
if (cellIndex.x > 0) { // moved to next col in same row
|
1998-07-27 05:59:37 +00:00
|
|
|
if (0 == cellIndex.y) { // in 1st row
|
|
|
|
if (firstTime) { // create vertical border
|
2006-03-26 21:30:36 +00:00
|
|
|
|
2003-02-22 00:32:13 +00:00
|
|
|
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
2009-12-11 07:37:40 +00:00
|
|
|
pseudoStyleContext = styleSet->
|
|
|
|
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::verticalFramesetBorder,
|
|
|
|
mStyleContext);
|
2006-03-26 21:30:36 +00:00
|
|
|
|
|
|
|
borderFrame = new (shell) nsHTMLFramesetBorderFrame(pseudoStyleContext,
|
|
|
|
borderWidth,
|
2011-10-17 14:59:28 +00:00
|
|
|
true,
|
|
|
|
false);
|
2006-10-07 08:53:06 +00:00
|
|
|
if (NS_LIKELY(borderFrame != nsnull)) {
|
|
|
|
borderFrame->Init(mContent, this, nsnull);
|
|
|
|
mChildCount++;
|
2009-09-18 11:09:35 +00:00
|
|
|
mFrames.AppendFrame(nsnull, borderFrame);
|
2006-10-07 08:53:06 +00:00
|
|
|
mVerBorders[cellIndex.x-1] = borderFrame;
|
|
|
|
// set the neighbors for determining drag boundaries
|
|
|
|
borderFrame->mPrevNeighbor = lastCol;
|
|
|
|
borderFrame->mNextNeighbor = cellIndex.x;
|
|
|
|
}
|
1998-07-27 05:59:37 +00:00
|
|
|
} else {
|
1999-01-15 22:53:39 +00:00
|
|
|
borderFrame = (nsHTMLFramesetBorderFrame*)mFrames.FrameAt(borderChildX);
|
2006-10-07 08:53:06 +00:00
|
|
|
if (NS_LIKELY(borderFrame != nsnull)) {
|
|
|
|
borderFrame->mWidth = borderWidth;
|
|
|
|
borderChildX++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (NS_LIKELY(borderFrame != nsnull)) {
|
|
|
|
nsSize borderSize(borderWidth, aDesiredSize.height);
|
|
|
|
ReflowPlaceChild(borderFrame, aPresContext, aReflowState, offset, borderSize);
|
|
|
|
borderFrame = nsnull;
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
offset.x += borderWidth;
|
|
|
|
}
|
1998-07-20 18:52:40 +00:00
|
|
|
}
|
1998-07-27 05:59:37 +00:00
|
|
|
|
1999-03-10 06:13:35 +00:00
|
|
|
ReflowPlaceChild(child, aPresContext, aReflowState, offset, size, &cellIndex);
|
1998-07-27 05:59:37 +00:00
|
|
|
|
1998-07-30 21:25:35 +00:00
|
|
|
if (firstTime) {
|
|
|
|
PRInt32 childVis;
|
2001-10-07 00:19:01 +00:00
|
|
|
if (FRAMESET == mChildTypes[childX]) {
|
1998-09-03 01:16:27 +00:00
|
|
|
nsHTMLFramesetFrame* childFS = (nsHTMLFramesetFrame*)child;
|
|
|
|
childVis = childFS->mEdgeVisibility;
|
2001-10-07 00:19:01 +00:00
|
|
|
mChildBorderColors[childX] = childFS->mEdgeColors;
|
|
|
|
} else if (FRAME == mChildTypes[childX]) {
|
|
|
|
if (eFrameborder_Yes == mChildFrameborder[childX]) {
|
1998-09-03 01:16:27 +00:00
|
|
|
childVis = ALL_VIS;
|
2001-10-07 00:19:01 +00:00
|
|
|
} else if (eFrameborder_No == mChildFrameborder[childX]) {
|
1998-09-03 01:16:27 +00:00
|
|
|
childVis = NONE_VIS;
|
1998-08-06 19:40:37 +00:00
|
|
|
} else { // notset
|
1998-09-03 01:16:27 +00:00
|
|
|
childVis = (eFrameborder_No == frameborder) ? NONE_VIS : ALL_VIS;
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
1998-08-05 22:24:56 +00:00
|
|
|
} else { // blank
|
1998-09-03 01:16:27 +00:00
|
|
|
childVis = NONE_VIS;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
2001-10-07 00:19:01 +00:00
|
|
|
nsBorderColor childColors = mChildBorderColors[childX];
|
1998-09-03 01:16:27 +00:00
|
|
|
// set the visibility, color of our edge borders based on children
|
|
|
|
if (0 == cellIndex.x) {
|
|
|
|
if (!(mEdgeVisibility & LEFT_VIS)) {
|
|
|
|
mEdgeVisibility |= (LEFT_VIS & childVis);
|
|
|
|
}
|
|
|
|
if (NO_COLOR == mEdgeColors.mLeft) {
|
|
|
|
mEdgeColors.mLeft = childColors.mLeft;
|
|
|
|
}
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
if (0 == cellIndex.y) {
|
|
|
|
if (!(mEdgeVisibility & TOP_VIS)) {
|
|
|
|
mEdgeVisibility |= (TOP_VIS & childVis);
|
|
|
|
}
|
|
|
|
if (NO_COLOR == mEdgeColors.mTop) {
|
|
|
|
mEdgeColors.mTop = childColors.mTop;
|
|
|
|
}
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
if (mNumCols-1 == cellIndex.x) {
|
|
|
|
if (!(mEdgeVisibility & RIGHT_VIS)) {
|
|
|
|
mEdgeVisibility |= (RIGHT_VIS & childVis);
|
|
|
|
}
|
|
|
|
if (NO_COLOR == mEdgeColors.mRight) {
|
|
|
|
mEdgeColors.mRight = childColors.mRight;
|
|
|
|
}
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
if (mNumRows-1 == cellIndex.y) {
|
|
|
|
if (!(mEdgeVisibility & BOTTOM_VIS)) {
|
|
|
|
mEdgeVisibility |= (BOTTOM_VIS & childVis);
|
|
|
|
}
|
|
|
|
if (NO_COLOR == mEdgeColors.mBottom) {
|
|
|
|
mEdgeColors.mBottom = childColors.mBottom;
|
|
|
|
}
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
|
|
|
// set the visibility of borders that the child may affect
|
1998-09-03 01:16:27 +00:00
|
|
|
if (childVis & RIGHT_VIS) {
|
2011-10-17 14:59:28 +00:00
|
|
|
verBordersVis[cellIndex.x] = true;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
if (childVis & BOTTOM_VIS) {
|
2011-10-17 14:59:28 +00:00
|
|
|
horBordersVis[cellIndex.y] = true;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
if ((cellIndex.x > 0) && (childVis & LEFT_VIS)) {
|
2011-10-17 14:59:28 +00:00
|
|
|
verBordersVis[cellIndex.x-1] = true;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
if ((cellIndex.y > 0) && (childVis & TOP_VIS)) {
|
2011-10-17 14:59:28 +00:00
|
|
|
horBordersVis[cellIndex.y-1] = true;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
// set the colors of borders that the child may affect
|
|
|
|
if (NO_COLOR == verBorderColors[cellIndex.x]) {
|
2001-10-07 00:19:01 +00:00
|
|
|
verBorderColors[cellIndex.x] = mChildBorderColors[childX].mRight;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
if (NO_COLOR == horBorderColors[cellIndex.y]) {
|
2001-10-07 00:19:01 +00:00
|
|
|
horBorderColors[cellIndex.y] = mChildBorderColors[childX].mBottom;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
if ((cellIndex.x > 0) && (NO_COLOR == verBorderColors[cellIndex.x-1])) {
|
2001-10-07 00:19:01 +00:00
|
|
|
verBorderColors[cellIndex.x-1] = mChildBorderColors[childX].mLeft;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
if ((cellIndex.y > 0) && (NO_COLOR == horBorderColors[cellIndex.y-1])) {
|
2001-10-07 00:19:01 +00:00
|
|
|
horBorderColors[cellIndex.y-1] = mChildBorderColors[childX].mTop;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
1998-07-27 05:59:37 +00:00
|
|
|
lastRow = cellIndex.y;
|
1998-09-03 01:16:27 +00:00
|
|
|
lastCol = cellIndex.x;
|
1998-07-27 05:59:37 +00:00
|
|
|
lastSize = size;
|
|
|
|
offset.x += size.width;
|
2003-07-05 15:30:50 +00:00
|
|
|
child = child->GetNextSibling();
|
1998-07-20 18:52:40 +00:00
|
|
|
}
|
|
|
|
|
1998-07-30 21:25:35 +00:00
|
|
|
if (firstTime) {
|
1998-09-03 01:16:27 +00:00
|
|
|
nscolor childColor;
|
|
|
|
// set the visibility, color, mouse sensitivity of borders
|
1998-07-30 21:25:35 +00:00
|
|
|
for (int verX = 0; verX < mNumCols-1; verX++) {
|
2001-04-12 08:16:54 +00:00
|
|
|
if (mVerBorders[verX]) {
|
|
|
|
mVerBorders[verX]->SetVisibility(verBordersVis[verX]);
|
2001-11-02 02:19:49 +00:00
|
|
|
if (mForceFrameResizability) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mVerBorders[verX]->mVisibilityOverride = true;
|
2001-11-02 02:19:49 +00:00
|
|
|
} else {
|
|
|
|
SetBorderResize(mChildTypes, mVerBorders[verX]);
|
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
childColor = (NO_COLOR == verBorderColors[verX]) ? borderColor : verBorderColors[verX];
|
2001-04-12 08:16:54 +00:00
|
|
|
mVerBorders[verX]->SetColor(childColor);
|
1998-07-31 17:47:50 +00:00
|
|
|
}
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
|
|
|
for (int horX = 0; horX < mNumRows-1; horX++) {
|
2001-04-12 08:16:54 +00:00
|
|
|
if (mHorBorders[horX]) {
|
|
|
|
mHorBorders[horX]->SetVisibility(horBordersVis[horX]);
|
2001-11-02 02:19:49 +00:00
|
|
|
if (mForceFrameResizability) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mHorBorders[horX]->mVisibilityOverride = true;
|
2001-11-02 02:19:49 +00:00
|
|
|
} else {
|
|
|
|
SetBorderResize(mChildTypes, mHorBorders[horX]);
|
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
childColor = (NO_COLOR == horBorderColors[horX]) ? borderColor : horBorderColors[horX];
|
2001-04-12 08:16:54 +00:00
|
|
|
mHorBorders[horX]->SetColor(childColor);
|
1998-07-31 17:47:50 +00:00
|
|
|
}
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
|
|
|
|
2001-10-07 00:19:01 +00:00
|
|
|
delete[] mChildTypes;
|
|
|
|
delete[] mChildFrameborder;
|
|
|
|
delete[] mChildBorderColors;
|
2004-12-30 22:05:22 +00:00
|
|
|
|
|
|
|
mChildTypes = nsnull;
|
|
|
|
mChildFrameborder = nsnull;
|
|
|
|
mChildBorderColors = nsnull;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
|
|
|
|
1998-07-20 18:52:40 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
1999-03-10 06:13:35 +00:00
|
|
|
mDrag.UnSet();
|
2002-05-28 22:50:43 +00:00
|
|
|
|
2010-10-07 04:25:46 +00:00
|
|
|
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
2007-06-27 16:37:50 +00:00
|
|
|
|
2002-05-28 22:50:43 +00:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
1998-07-15 23:42:14 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-09-06 02:14:36 +00:00
|
|
|
nsIAtom*
|
|
|
|
nsHTMLFramesetFrame::GetType() const
|
|
|
|
{
|
2006-12-26 17:47:52 +00:00
|
|
|
return nsGkAtoms::frameSetFrame;
|
2005-09-06 02:14:36 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
#ifdef DEBUG
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFramesetFrame::GetFrameName(nsAString& aResult) const
|
|
|
|
{
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("Frameset"), aResult);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2005-08-16 22:52:48 +00:00
|
|
|
nsHTMLFramesetFrame::IsLeaf() const
|
|
|
|
{
|
|
|
|
// We handle constructing our kids manually
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2005-08-16 22:52:48 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
1998-09-03 01:16:27 +00:00
|
|
|
nsHTMLFramesetFrame::ChildIsFrameset(nsIFrame* aChild)
|
|
|
|
{
|
2009-01-12 19:20:59 +00:00
|
|
|
nsHTMLFramesetFrame* childFrame = do_QueryFrame(aChild);
|
1998-09-03 01:16:27 +00:00
|
|
|
if (childFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
|
|
|
nsHTMLFramesetFrame::CanResize(bool aVertical,
|
|
|
|
bool aLeft)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
|
|
|
nsIFrame* child;
|
|
|
|
PRInt32 childX;
|
|
|
|
PRInt32 startX;
|
|
|
|
if (aVertical) {
|
|
|
|
startX = (aLeft) ? 0 : mNumCols-1;
|
|
|
|
for (childX = startX; childX < mNonBorderChildCount; childX += mNumCols) {
|
1999-01-15 22:53:39 +00:00
|
|
|
child = mFrames.FrameAt(childX);
|
1998-09-03 01:16:27 +00:00
|
|
|
if (!CanChildResize(aVertical, aLeft, childX, ChildIsFrameset(child))) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
startX = (aLeft) ? 0 : (mNumRows - 1) * mNumCols;
|
|
|
|
PRInt32 endX = startX + mNumCols;
|
|
|
|
for (childX = startX; childX < endX; childX++) {
|
1999-01-15 22:53:39 +00:00
|
|
|
child = mFrames.FrameAt(childX);
|
1998-09-03 01:16:27 +00:00
|
|
|
if (!CanChildResize(aVertical, aLeft, childX, ChildIsFrameset(child))) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
1998-09-09 23:30:30 +00:00
|
|
|
nsHTMLFramesetFrame::GetNoResize(nsIFrame* aChildFrame)
|
|
|
|
{
|
2003-07-05 15:30:50 +00:00
|
|
|
nsIContent* content = aChildFrame->GetContent();
|
2002-05-23 00:00:34 +00:00
|
|
|
|
2006-12-26 17:47:52 +00:00
|
|
|
return content && content->HasAttr(kNameSpaceID_None, nsGkAtoms::noresize);
|
1998-09-09 23:30:30 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
|
|
|
nsHTMLFramesetFrame::CanChildResize(bool aVertical,
|
|
|
|
bool aLeft,
|
1999-03-10 06:13:35 +00:00
|
|
|
PRInt32 aChildX,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aFrameset)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
1999-01-15 22:53:39 +00:00
|
|
|
nsIFrame* child = mFrames.FrameAt(aChildX);
|
1998-09-03 01:16:27 +00:00
|
|
|
if (aFrameset) {
|
2007-03-27 05:30:14 +00:00
|
|
|
NS_ASSERTION(ChildIsFrameset(child), "Child frame is not a frameset!");
|
1998-09-03 01:16:27 +00:00
|
|
|
return ((nsHTMLFramesetFrame*)child)->CanResize(aVertical, aLeft);
|
|
|
|
} else {
|
1998-09-09 23:30:30 +00:00
|
|
|
return !GetNoResize(child);
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-04-12 08:16:54 +00:00
|
|
|
// This calculates and sets the resizability of all border frames
|
|
|
|
|
|
|
|
void
|
|
|
|
nsHTMLFramesetFrame::RecalculateBorderResize()
|
|
|
|
{
|
|
|
|
if (!mContent) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-01-25 01:38:07 +00:00
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT < PR_INT32_MAX / NS_MAX_FRAMESET_SPEC_COUNT);
|
2001-04-12 08:16:54 +00:00
|
|
|
PRInt32 numCells = mNumRows * mNumCols; // max number of cells
|
2011-01-25 01:38:07 +00:00
|
|
|
PR_STATIC_ASSERT(NS_MAX_FRAMESET_SPEC_COUNT
|
|
|
|
< UINT_MAX / sizeof(PRInt32) / NS_MAX_FRAMESET_SPEC_COUNT);
|
2006-10-07 08:53:06 +00:00
|
|
|
nsAutoArrayPtr<PRInt32> childTypes(new PRInt32[numCells]);
|
|
|
|
if (NS_UNLIKELY(!childTypes)) {
|
|
|
|
return;
|
|
|
|
}
|
2011-09-25 20:17:43 +00:00
|
|
|
PRInt32 childTypeIndex = 0;
|
2003-09-27 04:18:26 +00:00
|
|
|
|
2011-09-25 20:17:43 +00:00
|
|
|
for (nsIContent *child = mContent->GetFirstChild(); child;
|
|
|
|
child = child->GetNextSibling()) {
|
2009-08-24 20:02:07 +00:00
|
|
|
if (child->IsHTML()) {
|
2005-09-24 18:43:15 +00:00
|
|
|
nsINodeInfo *ni = child->NodeInfo();
|
2003-09-27 04:18:26 +00:00
|
|
|
|
2006-12-26 17:47:52 +00:00
|
|
|
if (ni->Equals(nsGkAtoms::frameset)) {
|
2007-03-27 05:30:14 +00:00
|
|
|
childTypes[childTypeIndex++] = FRAMESET;
|
2006-12-26 17:47:52 +00:00
|
|
|
} else if (ni->Equals(nsGkAtoms::frame)) {
|
2007-03-27 05:30:14 +00:00
|
|
|
childTypes[childTypeIndex++] = FRAME;
|
2001-04-12 08:16:54 +00:00
|
|
|
}
|
|
|
|
// Don't overflow childTypes array
|
2007-03-27 05:30:14 +00:00
|
|
|
if (((PRInt32)childTypeIndex) >= numCells) {
|
2001-04-12 08:16:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-03-27 05:30:14 +00:00
|
|
|
for (; childTypeIndex < numCells; ++childTypeIndex) {
|
|
|
|
childTypes[childTypeIndex] = BLANK;
|
|
|
|
}
|
2001-04-12 08:16:54 +00:00
|
|
|
|
2001-11-02 02:19:49 +00:00
|
|
|
// set the visibility and mouse sensitivity of borders
|
2001-04-12 08:16:54 +00:00
|
|
|
PRInt32 verX;
|
|
|
|
for (verX = 0; verX < mNumCols-1; verX++) {
|
|
|
|
if (mVerBorders[verX]) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mVerBorders[verX]->mCanResize = true;
|
2001-11-02 02:19:49 +00:00
|
|
|
if (mForceFrameResizability) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mVerBorders[verX]->mVisibilityOverride = true;
|
2001-11-02 02:19:49 +00:00
|
|
|
} else {
|
2011-10-17 14:59:28 +00:00
|
|
|
mVerBorders[verX]->mVisibilityOverride = false;
|
2001-11-02 02:19:49 +00:00
|
|
|
SetBorderResize(childTypes, mVerBorders[verX]);
|
|
|
|
}
|
2001-04-12 08:16:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
PRInt32 horX;
|
|
|
|
for (horX = 0; horX < mNumRows-1; horX++) {
|
|
|
|
if (mHorBorders[horX]) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mHorBorders[horX]->mCanResize = true;
|
2001-11-02 02:19:49 +00:00
|
|
|
if (mForceFrameResizability) {
|
2011-10-17 14:59:28 +00:00
|
|
|
mHorBorders[horX]->mVisibilityOverride = true;
|
2001-11-02 02:19:49 +00:00
|
|
|
} else {
|
2011-10-17 14:59:28 +00:00
|
|
|
mHorBorders[horX]->mVisibilityOverride = false;
|
2001-11-02 02:19:49 +00:00
|
|
|
SetBorderResize(childTypes, mHorBorders[horX]);
|
|
|
|
}
|
2001-04-12 08:16:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
void
|
1999-03-10 06:13:35 +00:00
|
|
|
nsHTMLFramesetFrame::SetBorderResize(PRInt32* aChildTypes,
|
|
|
|
nsHTMLFramesetBorderFrame* aBorderFrame)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
|
|
|
if (aBorderFrame->mVertical) {
|
|
|
|
for (int rowX = 0; rowX < mNumRows; rowX++) {
|
|
|
|
PRInt32 childX = aBorderFrame->mPrevNeighbor + (rowX * mNumCols);
|
2011-10-17 14:59:28 +00:00
|
|
|
if (!CanChildResize(true, false, childX, (FRAMESET == aChildTypes[childX])) ||
|
|
|
|
!CanChildResize(true, true, childX+1,(FRAMESET == aChildTypes[childX+1]))) {
|
|
|
|
aBorderFrame->mCanResize = false;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
PRInt32 childX = aBorderFrame->mPrevNeighbor * mNumCols;
|
|
|
|
PRInt32 endX = childX + mNumCols;
|
|
|
|
for (; childX < endX; childX++) {
|
2011-10-17 14:59:28 +00:00
|
|
|
if (!CanChildResize(false, false, childX, (FRAMESET == aChildTypes[childX]))) {
|
|
|
|
aBorderFrame->mCanResize = false;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
endX = endX + mNumCols;
|
|
|
|
for (; childX < endX; childX++) {
|
2011-10-17 14:59:28 +00:00
|
|
|
if (!CanChildResize(false, true, childX, (FRAMESET == aChildTypes[childX]))) {
|
|
|
|
aBorderFrame->mCanResize = false;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetFrame::StartMouseDrag(nsPresContext* aPresContext,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsHTMLFramesetBorderFrame* aBorder,
|
|
|
|
nsGUIEvent* aEvent)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
1998-09-19 03:24:26 +00:00
|
|
|
#if 0
|
1998-09-03 01:16:27 +00:00
|
|
|
PRInt32 index;
|
|
|
|
IndexOf(aBorder, index);
|
|
|
|
NS_ASSERTION((nsnull != aBorder) && (index >= 0), "invalid dragger");
|
1998-09-19 03:24:26 +00:00
|
|
|
#endif
|
1999-02-26 17:12:16 +00:00
|
|
|
|
2009-09-13 13:13:16 +00:00
|
|
|
nsIPresShell::SetCapturingContent(GetContent(), CAPTURE_IGNOREALLOWED);
|
|
|
|
|
|
|
|
mDragger = aBorder;
|
|
|
|
|
|
|
|
mFirstDragPoint = aEvent->refPoint;
|
|
|
|
|
|
|
|
// Store the original frame sizes
|
|
|
|
if (mDragger->mVertical) {
|
|
|
|
mPrevNeighborOrigSize = mColSizes[mDragger->mPrevNeighbor];
|
|
|
|
mNextNeighborOrigSize = mColSizes[mDragger->mNextNeighbor];
|
|
|
|
} else {
|
|
|
|
mPrevNeighborOrigSize = mRowSizes[mDragger->mPrevNeighbor];
|
|
|
|
mNextNeighborOrigSize = mRowSizes[mDragger->mNextNeighbor];
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
2009-09-13 13:13:16 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
gDragInProgress = true;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetFrame::MouseDrag(nsPresContext* aPresContext,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsGUIEvent* aEvent)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
2009-09-28 14:17:01 +00:00
|
|
|
// if the capture ended, reset the drag state
|
|
|
|
if (nsIPresShell::GetCapturingContent() != GetContent()) {
|
|
|
|
mDragger = nsnull;
|
2011-10-17 14:59:28 +00:00
|
|
|
gDragInProgress = false;
|
2009-09-28 14:17:01 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
PRInt32 change; // measured positive from left-to-right or top-to-bottom
|
2006-11-02 18:34:55 +00:00
|
|
|
nsWeakFrame weakFrame(this);
|
1998-09-03 01:16:27 +00:00
|
|
|
if (mDragger->mVertical) {
|
2007-02-07 07:46:44 +00:00
|
|
|
change = aPresContext->DevPixelsToAppUnits(aEvent->refPoint.x - mFirstDragPoint.x);
|
1999-06-11 01:18:50 +00:00
|
|
|
if (change > mNextNeighborOrigSize - mMinDrag) {
|
|
|
|
change = mNextNeighborOrigSize - mMinDrag;
|
|
|
|
} else if (change <= mMinDrag - mPrevNeighborOrigSize) {
|
|
|
|
change = mMinDrag - mPrevNeighborOrigSize;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
1999-06-11 01:18:50 +00:00
|
|
|
mColSizes[mDragger->mPrevNeighbor] = mPrevNeighborOrigSize + change;
|
|
|
|
mColSizes[mDragger->mNextNeighbor] = mNextNeighborOrigSize - change;
|
1999-06-11 00:51:05 +00:00
|
|
|
|
2002-08-06 01:06:50 +00:00
|
|
|
if (change != 0) {
|
|
|
|
// Recompute the specs from the new sizes.
|
2011-10-17 14:59:28 +00:00
|
|
|
nscoord width = mRect.width - (mNumCols - 1) * GetBorderWidth(aPresContext, true);
|
2011-06-08 19:04:10 +00:00
|
|
|
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
2002-08-06 01:06:50 +00:00
|
|
|
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
|
|
|
const nsFramesetSpec* colSpecs = nsnull;
|
|
|
|
ourContent->GetColSpec(&mNumCols, &colSpecs);
|
|
|
|
nsAutoString newColAttr;
|
|
|
|
GenerateRowCol(aPresContext, width, mNumCols, colSpecs, mColSizes,
|
|
|
|
newColAttr);
|
|
|
|
// Setting the attr will trigger a reflow
|
2011-10-17 14:59:28 +00:00
|
|
|
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::cols, newColAttr, true);
|
2002-08-06 01:06:50 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
} else {
|
2007-02-07 07:46:44 +00:00
|
|
|
change = aPresContext->DevPixelsToAppUnits(aEvent->refPoint.y - mFirstDragPoint.y);
|
1999-06-11 01:18:50 +00:00
|
|
|
if (change > mNextNeighborOrigSize - mMinDrag) {
|
|
|
|
change = mNextNeighborOrigSize - mMinDrag;
|
|
|
|
} else if (change <= mMinDrag - mPrevNeighborOrigSize) {
|
|
|
|
change = mMinDrag - mPrevNeighborOrigSize;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
1999-06-11 01:18:50 +00:00
|
|
|
mRowSizes[mDragger->mPrevNeighbor] = mPrevNeighborOrigSize + change;
|
|
|
|
mRowSizes[mDragger->mNextNeighbor] = mNextNeighborOrigSize - change;
|
1999-06-11 00:51:05 +00:00
|
|
|
|
2002-08-06 01:06:50 +00:00
|
|
|
if (change != 0) {
|
|
|
|
// Recompute the specs from the new sizes.
|
2011-10-17 14:59:28 +00:00
|
|
|
nscoord height = mRect.height - (mNumRows - 1) * GetBorderWidth(aPresContext, true);
|
2011-06-08 19:04:10 +00:00
|
|
|
nsHTMLFrameSetElement* ourContent = nsHTMLFrameSetElement::FromContent(mContent);
|
2002-08-06 01:06:50 +00:00
|
|
|
NS_ASSERTION(ourContent, "Someone gave us a broken frameset element!");
|
|
|
|
const nsFramesetSpec* rowSpecs = nsnull;
|
|
|
|
ourContent->GetRowSpec(&mNumRows, &rowSpecs);
|
|
|
|
nsAutoString newRowAttr;
|
|
|
|
GenerateRowCol(aPresContext, height, mNumRows, rowSpecs, mRowSizes,
|
|
|
|
newRowAttr);
|
|
|
|
// Setting the attr will trigger a reflow
|
2011-10-17 14:59:28 +00:00
|
|
|
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::rows, newRowAttr, true);
|
2002-08-06 01:06:50 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
|
2006-11-02 18:34:55 +00:00
|
|
|
ENSURE_TRUE(weakFrame.IsAlive());
|
1998-09-03 01:16:27 +00:00
|
|
|
if (change != 0) {
|
1999-03-10 06:13:35 +00:00
|
|
|
mDrag.Reset(mDragger->mVertical, mDragger->mPrevNeighbor, change, this);
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetFrame::EndMouseDrag(nsPresContext* aPresContext)
|
1998-09-03 01:16:27 +00:00
|
|
|
{
|
2009-09-13 13:13:16 +00:00
|
|
|
nsIPresShell::SetCapturingContent(nsnull, 0);
|
|
|
|
mDragger = nsnull;
|
2011-10-17 14:59:28 +00:00
|
|
|
gDragInProgress = false;
|
2009-09-13 13:13:16 +00:00
|
|
|
}
|
1998-09-03 01:16:27 +00:00
|
|
|
|
2005-11-01 20:40:54 +00:00
|
|
|
nsIFrame*
|
2006-03-26 21:30:36 +00:00
|
|
|
NS_NewHTMLFramesetFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
|
1998-07-15 23:42:14 +00:00
|
|
|
{
|
2009-01-19 18:31:31 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
const nsStyleDisplay* disp = aContext->GetStyleDisplay();
|
|
|
|
NS_ASSERTION(!disp->IsAbsolutelyPositioned() && !disp->IsFloating(),
|
|
|
|
"Framesets should not be positioned and should not float");
|
|
|
|
#endif
|
|
|
|
|
2006-03-26 21:30:36 +00:00
|
|
|
return new (aPresShell) nsHTMLFramesetFrame(aContext);
|
1998-07-15 23:42:14 +00:00
|
|
|
}
|
|
|
|
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsHTMLFramesetFrame)
|
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetBorderFrame
|
|
|
|
******************************************************************************/
|
2006-03-26 21:30:36 +00:00
|
|
|
nsHTMLFramesetBorderFrame::nsHTMLFramesetBorderFrame(nsStyleContext* aContext,
|
|
|
|
PRInt32 aWidth,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aVertical,
|
|
|
|
bool aVisibility)
|
2006-03-26 21:30:36 +00:00
|
|
|
: nsLeafFrame(aContext), mWidth(aWidth), mVertical(aVertical), mVisibility(aVisibility)
|
1998-07-27 05:59:37 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
mVisibilityOverride = false;
|
|
|
|
mCanResize = true;
|
1999-04-13 00:56:23 +00:00
|
|
|
mColor = NO_COLOR;
|
|
|
|
mPrevNeighbor = 0;
|
|
|
|
mNextNeighbor = 0;
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsHTMLFramesetBorderFrame::~nsHTMLFramesetBorderFrame()
|
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("nsHTMLFramesetBorderFrame destructor %p \n", this);
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsHTMLFramesetBorderFrame)
|
|
|
|
|
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
|
|
|
nscoord nsHTMLFramesetBorderFrame::GetIntrinsicWidth()
|
1998-07-27 05:59:37 +00:00
|
|
|
{
|
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
|
|
|
// No intrinsic width
|
|
|
|
return 0;
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
|
2008-10-30 17:10:19 +00:00
|
|
|
nscoord nsHTMLFramesetBorderFrame::GetIntrinsicHeight()
|
|
|
|
{
|
|
|
|
// No intrinsic height
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
void nsHTMLFramesetBorderFrame::SetVisibility(bool aVisibility)
|
1998-07-30 21:25:35 +00:00
|
|
|
{
|
|
|
|
mVisibility = aVisibility;
|
|
|
|
}
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
void nsHTMLFramesetBorderFrame::SetColor(nscolor aColor)
|
|
|
|
{
|
|
|
|
mColor = aColor;
|
|
|
|
}
|
|
|
|
|
1998-07-30 21:25:35 +00:00
|
|
|
|
1998-07-27 05:59:37 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetBorderFrame::Reflow(nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-07-27 05:59:37 +00:00
|
|
|
{
|
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
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetBorderFrame");
|
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
|
|
|
|
|
|
|
// Override Reflow(), since we don't want to deal with what our
|
|
|
|
// computed values are.
|
|
|
|
SizeToAvailSize(aReflowState, aDesiredSize);
|
|
|
|
|
2010-10-07 04:25:46 +00:00
|
|
|
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
1998-07-27 05:59:37 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
1998-07-15 23:42:14 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
class nsDisplayFramesetBorder : public nsDisplayItem {
|
|
|
|
public:
|
2010-08-13 10:01:13 +00:00
|
|
|
nsDisplayFramesetBorder(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsHTMLFramesetBorderFrame* aFrame)
|
|
|
|
: nsDisplayItem(aBuilder, aFrame) {
|
2006-01-29 18:48:58 +00:00
|
|
|
MOZ_COUNT_CTOR(nsDisplayFramesetBorder);
|
|
|
|
}
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
|
|
virtual ~nsDisplayFramesetBorder() {
|
|
|
|
MOZ_COUNT_DTOR(nsDisplayFramesetBorder);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
// REVIEW: see old GetFrameForPoint
|
|
|
|
// Receives events in its bounds
|
2010-04-08 00:31:26 +00:00
|
|
|
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
|
|
|
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
|
|
|
|
aOutFrames->AppendElement(mFrame);
|
|
|
|
}
|
2009-09-07 00:35:14 +00:00
|
|
|
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext* aCtx);
|
2010-07-15 21:07:49 +00:00
|
|
|
NS_DISPLAY_DECL_NAME("FramesetBorder", TYPE_FRAMESET_BORDER)
|
2006-01-26 02:29:17 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void nsDisplayFramesetBorder::Paint(nsDisplayListBuilder* aBuilder,
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext* aCtx)
|
2006-01-26 02:29:17 +00:00
|
|
|
{
|
2007-07-08 07:08:04 +00:00
|
|
|
static_cast<nsHTMLFramesetBorderFrame*>(mFrame)->
|
2010-08-13 10:01:58 +00:00
|
|
|
PaintBorder(*aCtx, ToReferenceFrame());
|
2006-01-26 02:29:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFramesetBorderFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
2010-08-13 10:01:13 +00:00
|
|
|
return aLists.Content()->AppendNewToTop(
|
|
|
|
new (aBuilder) nsDisplayFramesetBorder(aBuilder, this));
|
2006-01-26 02:29:17 +00:00
|
|
|
}
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
void nsHTMLFramesetBorderFrame::PaintBorder(nsRenderingContext& aRenderingContext,
|
2006-01-26 02:29:17 +00:00
|
|
|
nsPoint aPt)
|
1998-07-27 05:59:37 +00:00
|
|
|
{
|
1998-12-04 18:05:30 +00:00
|
|
|
nscolor WHITE = NS_RGB(255, 255, 255);
|
2011-09-09 02:27:13 +00:00
|
|
|
|
|
|
|
nscolor bgColor =
|
|
|
|
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetBackground,
|
|
|
|
NS_RGB(200,200,200));
|
|
|
|
nscolor fgColor =
|
|
|
|
LookAndFeel::GetColor(LookAndFeel::eColorID_WidgetForeground,
|
|
|
|
NS_RGB(0,0,0));
|
|
|
|
nscolor hltColor =
|
|
|
|
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DHighlight,
|
|
|
|
NS_RGB(255,255,255));
|
|
|
|
nscolor sdwColor =
|
|
|
|
LookAndFeel::GetColor(LookAndFeel::eColorID_Widget3DShadow,
|
|
|
|
NS_RGB(128,128,128));
|
1998-12-04 18:05:30 +00:00
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext::AutoPushTranslation
|
2011-04-08 01:04:39 +00:00
|
|
|
translate(&aRenderingContext, aPt);
|
2006-01-26 02:29:17 +00:00
|
|
|
|
2007-02-07 07:46:44 +00:00
|
|
|
nscoord widthInPixels = nsPresContext::AppUnitsToIntCSSPixels(mWidth);
|
|
|
|
nscoord pixelWidth = nsPresContext::CSSPixelsToAppUnits(1);
|
1998-08-06 19:40:37 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
if (widthInPixels <= 0)
|
|
|
|
return;
|
1998-07-27 05:59:37 +00:00
|
|
|
|
2011-04-08 01:04:39 +00:00
|
|
|
nsPoint start(0,0);
|
|
|
|
nsPoint end((mVertical) ? 0 : mRect.width, (mVertical) ? mRect.height : 0);
|
1998-07-27 05:59:37 +00:00
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
nscolor color = WHITE;
|
2001-11-02 02:19:49 +00:00
|
|
|
if (mVisibility || mVisibilityOverride) {
|
1998-12-04 18:05:30 +00:00
|
|
|
color = (NO_COLOR == mColor) ? bgColor : mColor;
|
1998-09-03 01:16:27 +00:00
|
|
|
}
|
1998-08-06 19:40:37 +00:00
|
|
|
aRenderingContext.SetColor(color);
|
|
|
|
// draw grey or white first
|
|
|
|
for (int i = 0; i < widthInPixels; i++) {
|
2011-04-08 01:04:39 +00:00
|
|
|
aRenderingContext.DrawLine (start, end);
|
1998-07-27 05:59:37 +00:00
|
|
|
if (mVertical) {
|
2011-04-08 01:04:39 +00:00
|
|
|
start.x += pixelWidth;
|
|
|
|
end.x = start.x;
|
1998-07-27 05:59:37 +00:00
|
|
|
} else {
|
2011-04-08 01:04:39 +00:00
|
|
|
start.y += pixelWidth;
|
|
|
|
end.y = start.y;
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
}
|
1998-08-06 19:40:37 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
if (!mVisibility && !mVisibilityOverride)
|
|
|
|
return;
|
1998-08-06 19:40:37 +00:00
|
|
|
|
|
|
|
if (widthInPixels >= 5) {
|
1998-12-04 18:05:30 +00:00
|
|
|
aRenderingContext.SetColor(hltColor);
|
2011-04-08 01:04:39 +00:00
|
|
|
start.x = (mVertical) ? pixelWidth : 0;
|
|
|
|
start.y = (mVertical) ? 0 : pixelWidth;
|
|
|
|
end.x = (mVertical) ? start.x : mRect.width;
|
|
|
|
end.y = (mVertical) ? mRect.height : start.y;
|
|
|
|
aRenderingContext.DrawLine(start, end);
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (widthInPixels >= 2) {
|
1998-12-04 18:05:30 +00:00
|
|
|
aRenderingContext.SetColor(sdwColor);
|
2011-04-08 01:04:39 +00:00
|
|
|
start.x = (mVertical) ? mRect.width - (2 * pixelWidth) : 0;
|
|
|
|
start.y = (mVertical) ? 0 : mRect.height - (2 * pixelWidth);
|
|
|
|
end.x = (mVertical) ? start.x : mRect.width;
|
|
|
|
end.y = (mVertical) ? mRect.height : start.y;
|
|
|
|
aRenderingContext.DrawLine(start, end);
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (widthInPixels >= 1) {
|
1998-12-04 18:05:30 +00:00
|
|
|
aRenderingContext.SetColor(fgColor);
|
2011-04-08 01:04:39 +00:00
|
|
|
start.x = (mVertical) ? mRect.width - pixelWidth : 0;
|
|
|
|
start.y = (mVertical) ? 0 : mRect.height - pixelWidth;
|
|
|
|
end.x = (mVertical) ? start.x : mRect.width;
|
|
|
|
end.y = (mVertical) ? mRect.height : start.y;
|
|
|
|
aRenderingContext.DrawLine(start, end);
|
1998-08-06 19:40:37 +00:00
|
|
|
}
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
|
|
|
|
1998-09-03 01:16:27 +00:00
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetBorderFrame::HandleEvent(nsPresContext* aPresContext,
|
1999-03-10 06:13:35 +00:00
|
|
|
nsGUIEvent* aEvent,
|
1999-11-24 06:03:41 +00:00
|
|
|
nsEventStatus* aEventStatus)
|
1998-07-30 21:25:35 +00:00
|
|
|
{
|
1999-11-24 06:03:41 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aEventStatus);
|
|
|
|
*aEventStatus = nsEventStatus_eIgnore;
|
1998-11-18 05:25:26 +00:00
|
|
|
|
|
|
|
//XXX Mouse setting logic removed. The remaining logic should also move.
|
1998-09-03 01:16:27 +00:00
|
|
|
if (!mCanResize) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-11-16 21:35:39 +00:00
|
|
|
if (aEvent->eventStructType == NS_MOUSE_EVENT &&
|
|
|
|
aEvent->message == NS_MOUSE_BUTTON_DOWN &&
|
2007-07-08 07:08:04 +00:00
|
|
|
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) {
|
2006-11-16 21:35:39 +00:00
|
|
|
nsHTMLFramesetFrame* parentFrame;
|
|
|
|
nsIFrame* fptr = GetParent();
|
|
|
|
parentFrame = (nsHTMLFramesetFrame*) fptr;
|
|
|
|
parentFrame->StartMouseDrag(aPresContext, this, aEvent);
|
|
|
|
*aEventStatus = nsEventStatus_eConsumeNoDefault;
|
1998-07-30 21:25:35 +00:00
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-11-18 05:25:26 +00:00
|
|
|
NS_IMETHODIMP
|
2004-12-30 21:56:11 +00:00
|
|
|
nsHTMLFramesetBorderFrame::GetCursor(const nsPoint& aPoint,
|
|
|
|
nsIFrame::Cursor& aCursor)
|
1998-11-18 05:25:26 +00:00
|
|
|
{
|
|
|
|
if (!mCanResize) {
|
2004-12-30 21:56:11 +00:00
|
|
|
aCursor.mCursor = NS_STYLE_CURSOR_DEFAULT;
|
1999-03-10 06:13:35 +00:00
|
|
|
} else {
|
2009-08-12 14:03:35 +00:00
|
|
|
aCursor.mCursor = (mVertical) ? NS_STYLE_CURSOR_EW_RESIZE : NS_STYLE_CURSOR_NS_RESIZE;
|
1999-03-10 06:13:35 +00:00
|
|
|
}
|
1998-11-18 05:25:26 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
2001-11-14 01:33:42 +00:00
|
|
|
NS_IMETHODIMP nsHTMLFramesetBorderFrame::GetFrameName(nsAString& aResult) const
|
1998-07-27 05:59:37 +00:00
|
|
|
{
|
2001-11-14 01:33:42 +00:00
|
|
|
return MakeFrameName(NS_LITERAL_STRING("FramesetBorder"), aResult);
|
1998-07-27 05:59:37 +00:00
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
1998-07-15 23:42:14 +00:00
|
|
|
|
1998-08-05 22:24:56 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* nsHTMLFramesetBlankFrame
|
|
|
|
******************************************************************************/
|
|
|
|
|
2009-09-12 16:49:24 +00:00
|
|
|
NS_IMPL_FRAMEARENA_HELPERS(nsHTMLFramesetBlankFrame)
|
|
|
|
|
1998-08-05 22:24:56 +00:00
|
|
|
nsHTMLFramesetBlankFrame::~nsHTMLFramesetBlankFrame()
|
|
|
|
{
|
2000-10-28 22:17:53 +00:00
|
|
|
//printf("nsHTMLFramesetBlankFrame destructor %p \n", this);
|
1998-08-05 22:24:56 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
nscoord nsHTMLFramesetBlankFrame::GetIntrinsicWidth()
|
1998-08-05 22:24:56 +00:00
|
|
|
{
|
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
|
|
|
// No intrinsic width
|
|
|
|
return 0;
|
1998-08-05 22:24:56 +00:00
|
|
|
}
|
|
|
|
|
2008-10-30 17:10:19 +00:00
|
|
|
nscoord nsHTMLFramesetBlankFrame::GetIntrinsicHeight()
|
|
|
|
{
|
|
|
|
// No intrinsic height
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1998-08-05 22:24:56 +00:00
|
|
|
NS_IMETHODIMP
|
2004-07-31 23:15:21 +00:00
|
|
|
nsHTMLFramesetBlankFrame::Reflow(nsPresContext* aPresContext,
|
1998-10-02 04:10:00 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
1998-08-05 22:24:56 +00:00
|
|
|
{
|
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
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetBlankFrame");
|
|
|
|
|
|
|
|
// Override Reflow(), since we don't want to deal with what our
|
|
|
|
// computed values are.
|
|
|
|
SizeToAvailSize(aReflowState, aDesiredSize);
|
|
|
|
|
2010-10-07 04:25:46 +00:00
|
|
|
aDesiredSize.SetOverflowAreasToDesiredBounds();
|
1998-08-05 22:24:56 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
class nsDisplayFramesetBlank : public nsDisplayItem {
|
|
|
|
public:
|
2010-08-13 10:01:13 +00:00
|
|
|
nsDisplayFramesetBlank(nsDisplayListBuilder* aBuilder,
|
|
|
|
nsIFrame* aFrame) :
|
|
|
|
nsDisplayItem(aBuilder, aFrame) {
|
2006-01-29 18:48:58 +00:00
|
|
|
MOZ_COUNT_CTOR(nsDisplayFramesetBlank);
|
|
|
|
}
|
|
|
|
#ifdef NS_BUILD_REFCNT_LOGGING
|
|
|
|
virtual ~nsDisplayFramesetBlank() {
|
|
|
|
MOZ_COUNT_DTOR(nsDisplayFramesetBlank);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2011-04-08 01:04:40 +00:00
|
|
|
virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
|
2010-07-15 21:07:49 +00:00
|
|
|
NS_DISPLAY_DECL_NAME("FramesetBlank", TYPE_FRAMESET_BLANK)
|
2006-01-26 02:29:17 +00:00
|
|
|
};
|
2010-08-13 10:01:58 +00:00
|
|
|
|
2006-01-26 02:29:17 +00:00
|
|
|
void nsDisplayFramesetBlank::Paint(nsDisplayListBuilder* aBuilder,
|
2011-04-08 01:04:40 +00:00
|
|
|
nsRenderingContext* aCtx)
|
1998-08-05 22:24:56 +00:00
|
|
|
{
|
|
|
|
nscolor white = NS_RGB(255,255,255);
|
2009-09-07 00:35:14 +00:00
|
|
|
aCtx->SetColor(white);
|
|
|
|
aCtx->FillRect(mVisibleRect);
|
1998-08-05 22:24:56 +00:00
|
|
|
}
|
|
|
|
|
1999-11-01 22:12:45 +00:00
|
|
|
#ifdef DEBUG
|
2005-09-06 21:34:50 +00:00
|
|
|
NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(FILE* out,
|
1999-03-10 06:13:35 +00:00
|
|
|
PRInt32 aIndent) const
|
1998-08-05 22:24:56 +00:00
|
|
|
{
|
|
|
|
for (PRInt32 i = aIndent; --i >= 0; ) fputs(" ", out); // Indent
|
2006-01-26 02:29:17 +00:00
|
|
|
fprintf(out, "%p BLANK \n", (void*)this);
|
2005-09-06 21:34:50 +00:00
|
|
|
return nsLeafFrame::List(out, aIndent);
|
1998-08-05 22:24:56 +00:00
|
|
|
}
|
1999-11-01 22:12:45 +00:00
|
|
|
#endif
|
2006-01-26 02:29:17 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsHTMLFramesetBlankFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
const nsDisplayListSet& aLists)
|
|
|
|
{
|
2010-08-13 10:01:13 +00:00
|
|
|
return aLists.Content()->AppendNewToTop(
|
|
|
|
new (aBuilder) nsDisplayFramesetBlank(aBuilder, this));
|
2006-01-26 02:29:17 +00:00
|
|
|
}
|