2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:30:37 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-10-08 08:38:41 +04:00
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1998-10-08 08:38:41 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1998-10-08 08:38:41 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:30:37 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:30:37 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 18:30:37 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 18:30:37 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1998-10-08 08:38:41 +04:00
|
|
|
|
|
|
|
// YY need to pass isMultiple before create called
|
|
|
|
|
|
|
|
//#include "nsFormControlFrame.h"
|
|
|
|
#include "nsHTMLContainerFrame.h"
|
|
|
|
#include "nsLegendFrame.h"
|
|
|
|
#include "nsIDOMNode.h"
|
|
|
|
#include "nsIDOMHTMLFieldSetElement.h"
|
|
|
|
#include "nsIDOMHTMLLegendElement.h"
|
|
|
|
#include "nsCSSRendering.h"
|
|
|
|
//#include "nsIDOMHTMLCollection.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIFrame.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsIAtom.h"
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2005-01-25 03:06:38 +03:00
|
|
|
#include "nsFrameManager.h"
|
1998-10-08 08:38:41 +04:00
|
|
|
#include "nsHTMLParts.h"
|
1998-11-03 23:33:43 +03:00
|
|
|
#include "nsHTMLAtoms.h"
|
2002-12-03 19:02:42 +03:00
|
|
|
#include "nsLayoutAtoms.h"
|
1998-10-08 08:38:41 +04:00
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsFont.h"
|
1999-06-02 01:52:11 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2002-02-16 04:34:42 +03:00
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
#include "nsIAccessibilityService.h"
|
|
|
|
#endif
|
|
|
|
#include "nsIServiceManager.h"
|
2003-05-23 00:56:35 +04:00
|
|
|
#include "nsSpaceManager.h"
|
1998-10-08 08:38:41 +04:00
|
|
|
|
|
|
|
class nsLegendFrame;
|
|
|
|
|
|
|
|
class nsFieldSetFrame : public nsHTMLContainerFrame {
|
|
|
|
public:
|
|
|
|
|
1998-12-03 09:31:43 +03:00
|
|
|
nsFieldSetFrame();
|
1998-10-08 08:38:41 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
NS_IMETHOD SetInitialChildList(nsPresContext* aPresContext,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList);
|
1998-10-08 08:38:41 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
NS_IMETHOD Reflow(nsPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-08 08:38:41 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsReflowStatus& aStatus);
|
1998-10-08 08:38:41 +04:00
|
|
|
|
2005-02-02 03:32:11 +03:00
|
|
|
NS_IMETHOD Paint(nsPresContext* aPresContext,
|
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags);
|
1998-11-19 20:22:29 +03:00
|
|
|
|
2005-02-02 03:32:11 +03:00
|
|
|
virtual PRBool CanPaintBackground();
|
2005-01-25 03:06:38 +03:00
|
|
|
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD AppendFrames(nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList);
|
|
|
|
NS_IMETHOD InsertFrames(nsIAtom* aListName,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD RemoveFrame(nsIAtom* aListName,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* aOldFrame);
|
2005-02-07 04:58:25 +03:00
|
|
|
NS_IMETHOD ReplaceFrame(nsIAtom* aListName,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame);
|
|
|
|
|
2005-01-01 20:26:29 +03:00
|
|
|
NS_IMETHOD GetFrameForPoint(const nsPoint& aPoint,
|
2002-01-31 08:09:13 +03:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame);
|
2005-01-25 03:06:38 +03:00
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
virtual nsIAtom* GetType() const;
|
2005-06-13 00:33:35 +04:00
|
|
|
virtual PRBool IsContainingBlock() const;
|
2002-12-03 19:02:42 +03:00
|
|
|
|
2002-02-16 06:23:18 +03:00
|
|
|
#ifdef ACCESSIBILITY
|
2002-02-16 04:34:42 +03:00
|
|
|
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
2002-02-16 06:23:18 +03:00
|
|
|
#endif
|
2002-02-16 04:34:42 +03:00
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
2001-11-14 04:33:42 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsAString& aResult) const {
|
|
|
|
return MakeFrameName(NS_LITERAL_STRING("FieldSet"), aResult);
|
1998-11-19 20:22:29 +03:00
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
1998-11-19 20:22:29 +03:00
|
|
|
|
1998-10-08 08:38:41 +04:00
|
|
|
protected:
|
|
|
|
|
|
|
|
virtual PRIntn GetSkipSides() const;
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* MaybeSetLegend(nsIFrame* aFrameList, nsIAtom* aListName);
|
|
|
|
void ReParentFrameList(nsIFrame* aFrameList);
|
1998-10-08 08:38:41 +04:00
|
|
|
|
|
|
|
nsIFrame* mLegendFrame;
|
|
|
|
nsIFrame* mContentFrame;
|
1999-06-02 01:52:11 +04:00
|
|
|
nsRect mLegendRect;
|
|
|
|
nscoord mLegendSpace;
|
1998-10-08 08:38:41 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
2005-01-25 03:06:38 +03:00
|
|
|
NS_NewFieldSetFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame, PRUint32 aStateFlags)
|
1998-10-08 08:38:41 +04:00
|
|
|
{
|
1999-05-12 02:03:29 +04:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-12-05 02:49:50 +03:00
|
|
|
nsFieldSetFrame* it = new (aPresShell) nsFieldSetFrame;
|
1999-05-12 02:03:29 +04:00
|
|
|
if (!it) {
|
1998-10-08 08:38:41 +04:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2000-01-18 18:42:45 +03:00
|
|
|
|
|
|
|
// set the state flags (if any are provided)
|
2003-07-04 16:50:32 +04:00
|
|
|
it->AddStateBits(aStateFlags);
|
2000-01-18 18:42:45 +03:00
|
|
|
|
1999-05-12 02:03:29 +04:00
|
|
|
*aNewFrame = it;
|
1998-10-08 08:38:41 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1998-12-03 09:31:43 +03:00
|
|
|
nsFieldSetFrame::nsFieldSetFrame()
|
|
|
|
: nsHTMLContainerFrame()
|
1998-10-08 08:38:41 +04:00
|
|
|
{
|
2005-01-25 03:06:38 +03:00
|
|
|
mContentFrame = nsnull;
|
|
|
|
mLegendFrame = nsnull;
|
|
|
|
mLegendSpace = 0;
|
1998-10-08 08:38:41 +04:00
|
|
|
}
|
|
|
|
|
2003-10-31 23:19:18 +03:00
|
|
|
nsIAtom*
|
|
|
|
nsFieldSetFrame::GetType() const
|
2002-12-03 19:02:42 +03:00
|
|
|
{
|
2003-10-31 23:19:18 +03:00
|
|
|
return nsLayoutAtoms::fieldSetFrame;
|
2002-12-03 19:02:42 +03:00
|
|
|
}
|
|
|
|
|
2005-06-13 00:33:35 +04:00
|
|
|
PRBool
|
|
|
|
nsFieldSetFrame::IsContainingBlock() const
|
|
|
|
{
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
1998-10-08 08:38:41 +04:00
|
|
|
NS_IMETHODIMP
|
2004-08-01 03:15:21 +04:00
|
|
|
nsFieldSetFrame::SetInitialChildList(nsPresContext* aPresContext,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1998-10-08 08:38:41 +04:00
|
|
|
{
|
2005-01-02 17:30:24 +03:00
|
|
|
// Get the content and legend frames.
|
|
|
|
if (aChildList->GetNextSibling()) {
|
|
|
|
mContentFrame = aChildList->GetNextSibling();
|
|
|
|
mLegendFrame = aChildList;
|
|
|
|
} else {
|
|
|
|
mContentFrame = aChildList;
|
|
|
|
mLegendFrame = nsnull;
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
// Queue up the frames for the content frame
|
|
|
|
return nsHTMLContainerFrame::SetInitialChildList(aPresContext, nsnull, aChildList);
|
1998-10-08 08:38:41 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// this is identical to nsHTMLContainerFrame::Paint except for the background and border.
|
|
|
|
NS_IMETHODIMP
|
2005-01-25 03:06:38 +03:00
|
|
|
nsFieldSetFrame::Paint(nsPresContext* aPresContext,
|
1998-10-08 08:38:41 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
2001-09-19 16:35:19 +04:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
PRUint32 aFlags)
|
1998-10-08 08:38:41 +04:00
|
|
|
{
|
1999-03-26 03:39:35 +03:00
|
|
|
if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) {
|
1998-12-18 18:54:23 +03:00
|
|
|
// Paint our background and border
|
2001-01-27 17:09:34 +03:00
|
|
|
PRBool isVisible;
|
|
|
|
if (NS_SUCCEEDED(IsVisibleForPainting(aPresContext, aRenderingContext, PR_TRUE, &isVisible)) &&
|
|
|
|
isVisible && mRect.width && mRect.height) {
|
1998-12-18 18:54:23 +03:00
|
|
|
PRIntn skipSides = GetSkipSides();
|
2003-05-15 07:42:21 +04:00
|
|
|
const nsStyleBorder* borderStyle = GetStyleBorder();
|
|
|
|
const nsStylePadding* paddingStyle = GetStylePadding();
|
1999-10-20 04:46:21 +04:00
|
|
|
|
2005-04-29 19:44:38 +04:00
|
|
|
nscoord topBorder = borderStyle->GetBorderWidth(NS_SIDE_TOP);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
nscoord yoff = 0;
|
|
|
|
|
|
|
|
// if the border is smaller than the legend. Move the border down
|
|
|
|
// to be centered on the legend.
|
2005-04-29 19:44:38 +04:00
|
|
|
if (topBorder < mLegendRect.height)
|
|
|
|
yoff = (mLegendRect.height - topBorder)/2;
|
2005-01-25 03:06:38 +03:00
|
|
|
|
|
|
|
nsRect rect(0, yoff, mRect.width, mRect.height - yoff);
|
|
|
|
|
|
|
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *borderStyle,
|
|
|
|
*paddingStyle, PR_TRUE);
|
|
|
|
|
|
|
|
if (mLegendFrame) {
|
|
|
|
|
|
|
|
// Use the rect of the legend frame, not mLegendRect, so we draw our
|
|
|
|
// border under the legend's left and right margins.
|
|
|
|
const nsRect & legendRect = mLegendFrame->GetRect();
|
|
|
|
|
|
|
|
// we should probably use PaintBorderEdges to do this but for now just use clipping
|
|
|
|
// to achieve the same effect.
|
|
|
|
|
|
|
|
// draw left side
|
|
|
|
nsRect clipRect(rect);
|
|
|
|
clipRect.width = legendRect.x - rect.x;
|
2005-04-29 19:44:38 +04:00
|
|
|
clipRect.height = topBorder;
|
2005-01-25 03:06:38 +03:00
|
|
|
|
|
|
|
aRenderingContext.PushState();
|
|
|
|
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *borderStyle, mStyleContext, skipSides);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
aRenderingContext.PopState();
|
1999-06-02 01:52:11 +04:00
|
|
|
|
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// draw right side
|
|
|
|
clipRect = rect;
|
|
|
|
clipRect.x = legendRect.x + legendRect.width;
|
|
|
|
clipRect.width -= (legendRect.x + legendRect.width);
|
2005-04-29 19:44:38 +04:00
|
|
|
clipRect.height = topBorder;
|
1999-06-02 01:52:11 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
aRenderingContext.PushState();
|
|
|
|
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *borderStyle, mStyleContext, skipSides);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
aRenderingContext.PopState();
|
|
|
|
|
|
|
|
|
|
|
|
// draw bottom
|
|
|
|
clipRect = rect;
|
2005-04-29 19:44:38 +04:00
|
|
|
clipRect.y += topBorder;
|
|
|
|
clipRect.height = mRect.height - (yoff + topBorder);
|
2005-01-25 03:06:38 +03:00
|
|
|
|
|
|
|
aRenderingContext.PushState();
|
|
|
|
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect);
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, rect, *borderStyle, mStyleContext, skipSides);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
aRenderingContext.PopState();
|
|
|
|
} else {
|
1999-06-02 01:52:11 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect,
|
|
|
|
nsRect(0,0,mRect.width, mRect.height),
|
|
|
|
*borderStyle, mStyleContext, skipSides);
|
|
|
|
}
|
1998-12-18 18:54:23 +03:00
|
|
|
}
|
1998-10-08 08:38:41 +04:00
|
|
|
}
|
|
|
|
|
1998-12-18 18:54:23 +03:00
|
|
|
PaintChildren(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);
|
1998-10-08 08:38:41 +04:00
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1999-03-26 03:39:35 +03:00
|
|
|
if ((NS_FRAME_PAINT_LAYER_DEBUG == aWhichLayer) && GetShowFrameBorders()) {
|
2003-06-20 03:44:01 +04:00
|
|
|
if (HasView()) {
|
1998-10-08 08:38:41 +04:00
|
|
|
aRenderingContext.SetColor(NS_RGB(0,0,255));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
|
|
|
}
|
|
|
|
aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);
|
|
|
|
}
|
1999-11-02 01:12:45 +03:00
|
|
|
#endif
|
2001-03-13 04:47:22 +03:00
|
|
|
DO_GLOBAL_REFLOW_COUNT_DSP("nsFieldSetFrame", &aRenderingContext);
|
1998-10-08 08:38:41 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2005-02-02 03:32:11 +03:00
|
|
|
PRBool
|
|
|
|
nsFieldSetFrame::CanPaintBackground()
|
|
|
|
{
|
|
|
|
// If we have a legend, we won't be painting our background across our whole
|
|
|
|
// rect. So return false here, since we'll usually have a legend.
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
1999-02-23 06:48:01 +03:00
|
|
|
|
1998-10-08 08:38:41 +04:00
|
|
|
NS_IMETHODIMP
|
2005-01-25 03:06:38 +03:00
|
|
|
nsFieldSetFrame::Reflow(nsPresContext* aPresContext,
|
1999-02-23 06:48:01 +03:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
1998-10-08 08:38:41 +04:00
|
|
|
const nsHTMLReflowState& aReflowState,
|
1999-02-23 06:48:01 +03:00
|
|
|
nsReflowStatus& aStatus)
|
1998-10-08 08:38:41 +04:00
|
|
|
{
|
2000-04-22 01:51:35 +04:00
|
|
|
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame", aReflowState.reason);
|
2001-11-14 16:40:03 +03:00
|
|
|
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
2002-01-31 08:09:13 +03:00
|
|
|
|
2000-01-09 05:05:25 +03:00
|
|
|
// Initialize OUT parameter
|
2003-05-23 00:56:35 +04:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
|
|
|
|
// Should we create a space manager?
|
|
|
|
nsAutoSpaceManager autoSpaceManager(NS_CONST_CAST(nsHTMLReflowState &, aReflowState));
|
|
|
|
|
|
|
|
// XXXldb If we start storing the space manager in the frame rather
|
|
|
|
// than keeping it around only during reflow then we should create it
|
|
|
|
// only when there are actually floats to manage. Otherwise things
|
|
|
|
// like tables will gain significant bloat.
|
|
|
|
if (NS_BLOCK_SPACE_MGR & mState)
|
|
|
|
autoSpaceManager.CreateSpaceManagerFor(aPresContext, this);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2002-01-31 08:09:13 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
//------------ Handle Incremental Reflow -----------------
|
|
|
|
PRBool reflowContent = PR_TRUE;
|
|
|
|
PRBool reflowLegend = PR_TRUE;
|
|
|
|
nsReflowReason reason = aReflowState.reason;
|
|
|
|
|
|
|
|
if (reason == eReflowReason_Incremental) {
|
|
|
|
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
|
|
|
|
|
|
|
|
// See if it's targeted at us
|
|
|
|
if (command) {
|
|
|
|
nsReflowType reflowType;
|
|
|
|
command->GetType(reflowType);
|
|
|
|
|
|
|
|
switch (reflowType) {
|
|
|
|
case eReflowType_StyleChanged:
|
|
|
|
reason = eReflowReason_StyleChange;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eReflowType_ReflowDirty:
|
|
|
|
reason = eReflowReason_Dirty;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
NS_ERROR("Unexpected Reflow Type");
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
}
|
2005-01-25 03:06:38 +03:00
|
|
|
} else {
|
|
|
|
reflowContent = PR_FALSE;
|
|
|
|
reflowLegend = PR_FALSE;
|
|
|
|
|
|
|
|
nsReflowPath::iterator iter = aReflowState.path->FirstChild();
|
|
|
|
nsReflowPath::iterator end = aReflowState.path->EndChildren();
|
|
|
|
|
|
|
|
for ( ; iter != end; ++iter) {
|
|
|
|
if (*iter == mLegendFrame)
|
|
|
|
reflowLegend = PR_TRUE;
|
|
|
|
else if (*iter == mContentFrame)
|
|
|
|
reflowContent = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2005-08-02 18:58:55 +04:00
|
|
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
|
|
|
reflowLegend = PR_TRUE;
|
|
|
|
reflowContent = PR_TRUE;
|
|
|
|
} else if (reason == eReflowReason_Dirty) {
|
|
|
|
// if dirty then check dirty flags
|
2005-01-25 03:06:38 +03:00
|
|
|
if (GetStateBits() & NS_FRAME_IS_DIRTY) {
|
|
|
|
reflowLegend = PR_TRUE;
|
|
|
|
reflowContent = PR_TRUE;
|
|
|
|
} else {
|
2003-07-04 16:50:32 +04:00
|
|
|
if (reflowContent) {
|
2004-10-27 20:11:08 +04:00
|
|
|
reflowContent = mContentFrame ?
|
2003-07-04 16:50:32 +04:00
|
|
|
(mContentFrame->GetStateBits()
|
2004-10-27 20:11:08 +04:00
|
|
|
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0 : PR_FALSE;
|
2003-07-04 16:50:32 +04:00
|
|
|
}
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2003-07-04 16:50:32 +04:00
|
|
|
if (reflowLegend) {
|
2004-10-27 20:11:08 +04:00
|
|
|
reflowLegend = mLegendFrame ?
|
2003-07-04 16:50:32 +04:00
|
|
|
(mLegendFrame->GetStateBits()
|
2004-10-27 20:11:08 +04:00
|
|
|
& (NS_FRAME_IS_DIRTY | NS_FRAME_HAS_DIRTY_CHILDREN)) != 0 : PR_FALSE;
|
2003-07-04 16:50:32 +04:00
|
|
|
}
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
}
|
2005-01-25 03:06:38 +03:00
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// availSize could have unconstrained values, don't perform any addition on them
|
|
|
|
nsSize availSize(aReflowState.mComputedWidth, aReflowState.availableHeight);
|
2002-01-31 08:09:13 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// get our border and padding
|
|
|
|
const nsMargin &borderPadding = aReflowState.mComputedBorderPadding;
|
|
|
|
const nsMargin &padding = aReflowState.mComputedPadding;
|
|
|
|
nsMargin border = borderPadding - padding;
|
|
|
|
if (aDesiredSize.mComputeMEW) {
|
|
|
|
aDesiredSize.mMaxElementWidth = borderPadding.left + borderPadding.right;
|
|
|
|
}
|
|
|
|
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// Figure out how big the legend is if there is one.
|
|
|
|
// get the legend's margin
|
|
|
|
nsMargin legendMargin(0,0,0,0);
|
|
|
|
// reflow the legend only if needed
|
|
|
|
if (mLegendFrame) {
|
|
|
|
const nsStyleMargin* marginStyle = mLegendFrame->GetStyleMargin();
|
|
|
|
marginStyle->GetMargin(legendMargin);
|
2000-07-06 17:22:12 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
if (reflowLegend) {
|
|
|
|
nsHTMLReflowState legendReflowState(aPresContext, aReflowState,
|
|
|
|
mLegendFrame, nsSize(NS_INTRINSICSIZE,NS_INTRINSICSIZE),
|
|
|
|
reason);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// always give the legend as much size as it needs
|
|
|
|
legendReflowState.mComputedWidth = NS_INTRINSICSIZE;
|
|
|
|
legendReflowState.mComputedHeight = NS_INTRINSICSIZE;
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
nsHTMLReflowMetrics legendDesiredSize(0,0);
|
2000-02-11 00:36:28 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
ReflowChild(mLegendFrame, aPresContext, legendDesiredSize, legendReflowState,
|
|
|
|
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
2000-05-16 02:51:42 +04:00
|
|
|
#ifdef NOISY_REFLOW
|
2005-01-25 03:06:38 +03:00
|
|
|
printf(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height);
|
|
|
|
if (legendDesiredSize.mComputeMEW)
|
|
|
|
printf(" and maxEW %d\n",
|
|
|
|
legendDesiredSize.mMaxElementWidth);
|
2000-05-16 02:51:42 +04:00
|
|
|
#endif
|
2005-01-25 03:06:38 +03:00
|
|
|
// figure out the legend's rectangle
|
|
|
|
mLegendRect.width = legendDesiredSize.width + legendMargin.left + legendMargin.right;
|
|
|
|
mLegendRect.height = legendDesiredSize.height + legendMargin.top + legendMargin.bottom;
|
|
|
|
mLegendRect.x = borderPadding.left;
|
|
|
|
mLegendRect.y = 0;
|
|
|
|
|
|
|
|
nscoord oldSpace = mLegendSpace;
|
|
|
|
mLegendSpace = 0;
|
|
|
|
if (mLegendRect.height > border.top) {
|
|
|
|
// center the border on the legend
|
|
|
|
mLegendSpace = mLegendRect.height - border.top;
|
|
|
|
} else {
|
|
|
|
mLegendRect.y = (border.top - mLegendRect.height)/2;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if the legend space changes then we need to reflow the
|
|
|
|
// content area as well.
|
|
|
|
if (mLegendSpace != oldSpace) {
|
|
|
|
if (reflowContent == PR_FALSE || reason == eReflowReason_Dirty) {
|
|
|
|
reflowContent = PR_TRUE;
|
|
|
|
reason = eReflowReason_Resize;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// if we are contrained then remove the legend from our available height.
|
|
|
|
if (NS_INTRINSICSIZE != availSize.height) {
|
|
|
|
if (availSize.height >= mLegendSpace)
|
|
|
|
availSize.height -= mLegendSpace;
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// don't get any smaller than the legend
|
|
|
|
if (NS_INTRINSICSIZE != availSize.width) {
|
|
|
|
if (availSize.width < mLegendRect.width)
|
|
|
|
availSize.width = mLegendRect.width;
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
FinishReflowChild(mLegendFrame, aPresContext, &legendReflowState,
|
|
|
|
legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
|
2000-05-16 02:51:42 +04:00
|
|
|
|
2000-01-09 05:05:25 +03:00
|
|
|
}
|
2005-01-25 03:06:38 +03:00
|
|
|
} else {
|
|
|
|
mLegendRect.Empty();
|
|
|
|
mLegendSpace = 0;
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
nsRect contentRect;
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// reflow the content frame only if needed
|
|
|
|
if (mContentFrame) {
|
|
|
|
if (reflowContent) {
|
|
|
|
availSize.width = aReflowState.mComputedWidth;
|
2002-08-14 06:28:23 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, mContentFrame,
|
|
|
|
availSize, reason);
|
2002-01-31 08:09:13 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags);
|
|
|
|
// Reflow the frame
|
|
|
|
ReflowChild(mContentFrame, aPresContext, kidDesiredSize, kidReflowState,
|
|
|
|
borderPadding.left + kidReflowState.mComputedMargin.left,
|
|
|
|
borderPadding.top + mLegendSpace + kidReflowState.mComputedMargin.top,
|
|
|
|
0, aStatus);
|
|
|
|
|
|
|
|
// set the rect. make sure we add the margin back in.
|
|
|
|
contentRect.SetRect(borderPadding.left,borderPadding.top + mLegendSpace,kidDesiredSize.width ,kidDesiredSize.height);
|
|
|
|
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE &&
|
|
|
|
borderPadding.top + mLegendSpace+kidDesiredSize.height > aReflowState.mComputedHeight) {
|
|
|
|
kidDesiredSize.height = aReflowState.mComputedHeight-(borderPadding.top + mLegendSpace);
|
2000-01-11 23:40:06 +03:00
|
|
|
}
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
FinishReflowChild(mContentFrame, aPresContext, &kidReflowState,
|
|
|
|
kidDesiredSize, contentRect.x, contentRect.y, 0);
|
|
|
|
if (aDesiredSize.mComputeMEW) {
|
|
|
|
aDesiredSize.mMaxElementWidth = kidDesiredSize.mMaxElementWidth;
|
|
|
|
if (eStyleUnit_Coord == aReflowState.mStylePosition->mWidth.GetUnit() &&
|
|
|
|
NS_INTRINSICSIZE != aReflowState.mComputedWidth)
|
|
|
|
aDesiredSize.mMaxElementWidth = aReflowState.mComputedWidth;
|
|
|
|
if (eStyleUnit_Percent == aReflowState.mStylePosition->mWidth.GetUnit())
|
|
|
|
aDesiredSize.mMaxElementWidth = 0;
|
|
|
|
aDesiredSize.mMaxElementWidth += borderPadding.left + borderPadding.right;
|
|
|
|
}
|
|
|
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
|
|
|
aDesiredSize.mMaximumWidth = kidDesiredSize.mMaximumWidth +
|
|
|
|
borderPadding.left + borderPadding.right;
|
|
|
|
}
|
|
|
|
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
} else {
|
|
|
|
// if we don't need to reflow just get the old size
|
|
|
|
contentRect = mContentFrame->GetRect();
|
|
|
|
const nsStyleMargin* marginStyle = mContentFrame->GetStyleMargin();
|
2001-09-21 04:53:29 +04:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
nsMargin m(0,0,0,0);
|
|
|
|
marginStyle->GetMargin(m);
|
|
|
|
contentRect.Inflate(m);
|
2000-01-09 05:05:25 +03:00
|
|
|
}
|
2005-01-25 03:06:38 +03:00
|
|
|
}
|
1) implememted box reflow coelescing.
2) implemented gfx scrollbars for list boxes
3) fixed progess meter to be an animated gif
4) fixed bugs 23521, 24721, 19114, 20546, 24385, 24457, 23156, 20226, 22543
-r hyatt, troy, rod
2000-02-10 01:02:40 +03:00
|
|
|
|
2005-01-25 03:06:38 +03:00
|
|
|
// use the computed width if the inner content does not fill it
|
|
|
|
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE &&
|
|
|
|
aReflowState.mComputedWidth > contentRect.width) {
|
|
|
|
contentRect.width = aReflowState.mComputedWidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mLegendFrame) {
|
|
|
|
// if the content rect is larger then the legend we can align the legend
|
|
|
|
if (contentRect.width > mLegendRect.width) {
|
|
|
|
PRInt32 align = ((nsLegendFrame*)mLegendFrame)->GetAlign();
|
|
|
|
|
|
|
|
switch(align) {
|
|
|
|
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
|
|
|
mLegendRect.x = contentRect.width - mLegendRect.width + borderPadding.left;
|
|
|
|
break;
|
|
|
|
case NS_STYLE_TEXT_ALIGN_CENTER:
|
|
|
|
float p2t;
|
|
|
|
p2t = aPresContext->PixelsToTwips();
|
|
|
|
mLegendRect.x = NSIntPixelsToTwips((nscoord) NSToIntRound((float)(contentRect.width/2 - mLegendRect.width/2 + borderPadding.left) / p2t),p2t);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2000-01-09 05:05:25 +03:00
|
|
|
} else {
|
2005-01-25 03:06:38 +03:00
|
|
|
//otherwise make place for the legend
|
|
|
|
contentRect.width = mLegendRect.width;
|
2000-01-09 05:05:25 +03:00
|
|
|
}
|
2005-01-25 03:06:38 +03:00
|
|
|
// place the legend
|
|
|
|
nsRect actualLegendRect(mLegendRect);
|
|
|
|
actualLegendRect.Deflate(legendMargin);
|
|
|
|
|
|
|
|
nsPoint curOrigin = mLegendFrame->GetPosition();
|
|
|
|
|
|
|
|
// only if the origin changed
|
|
|
|
if ((curOrigin.x != mLegendRect.x) || (curOrigin.y != mLegendRect.y)) {
|
|
|
|
mLegendFrame->SetPosition(nsPoint(actualLegendRect.x , actualLegendRect.y));
|
|
|
|
nsContainerFrame::PositionFrameView(mLegendFrame);
|
|
|
|
|
|
|
|
// We need to recursively process the legend frame's
|
|
|
|
// children since we're moving the frame after Reflow.
|
|
|
|
nsContainerFrame::PositionChildViews(mLegendFrame);
|
2004-10-14 21:37:54 +04:00
|
|
|
}
|
2005-01-25 03:06:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Return our size and our result
|
|
|
|
if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
|
|
|
|
aDesiredSize.height = mLegendSpace +
|
|
|
|
borderPadding.top +
|
|
|
|
contentRect.height +
|
|
|
|
borderPadding.bottom;
|
|
|
|
} else {
|
|
|
|
nscoord min = borderPadding.top + borderPadding.bottom + mLegendRect.height;
|
|
|
|
aDesiredSize.height = aReflowState.mComputedHeight + borderPadding.top + borderPadding.bottom;
|
|
|
|
if (aDesiredSize.height < min)
|
|
|
|
aDesiredSize.height = min;
|
|
|
|
}
|
|
|
|
aDesiredSize.width = contentRect.width + borderPadding.left + borderPadding.right;
|
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
|
|
|
if (aDesiredSize.mComputeMEW) {
|
|
|
|
// if the legend is wider use it
|
|
|
|
if (aDesiredSize.mMaxElementWidth < mLegendRect.width + borderPadding.left + borderPadding.right)
|
|
|
|
aDesiredSize.mMaxElementWidth = mLegendRect.width + borderPadding.left + borderPadding.right;
|
|
|
|
}
|
|
|
|
aDesiredSize.mOverflowArea = nsRect(0, 0, aDesiredSize.width, aDesiredSize.height);
|
|
|
|
// make the mMaximumWidth large enough if the legendframe determines the size
|
|
|
|
if ((aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) && mLegendFrame) {
|
|
|
|
aDesiredSize.mMaximumWidth = PR_MAX(aDesiredSize.mMaximumWidth, mLegendRect.width +
|
|
|
|
borderPadding.left + borderPadding.right);
|
|
|
|
}
|
|
|
|
if (mLegendFrame)
|
|
|
|
ConsiderChildOverflow(aDesiredSize.mOverflowArea, mLegendFrame);
|
|
|
|
if (mContentFrame)
|
|
|
|
ConsiderChildOverflow(aDesiredSize.mOverflowArea, mContentFrame);
|
|
|
|
FinishAndStoreOverflow(&aDesiredSize);
|
|
|
|
|
|
|
|
Invalidate(aDesiredSize.mOverflowArea);
|
|
|
|
|
2002-05-29 02:50:43 +04:00
|
|
|
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
|
1998-10-08 08:38:41 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRIntn
|
|
|
|
nsFieldSetFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:58:25 +03:00
|
|
|
nsFieldSetFrame::AppendFrames(nsIAtom* aListName,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* aFrameList)
|
2000-05-15 08:12:31 +04:00
|
|
|
{
|
2005-01-25 03:06:38 +03:00
|
|
|
aFrameList = MaybeSetLegend(aFrameList, aListName);
|
|
|
|
if (aFrameList) {
|
|
|
|
ReParentFrameList(aFrameList);
|
2005-02-07 04:58:25 +03:00
|
|
|
return mContentFrame->AppendFrames(aListName, aFrameList);
|
2005-01-25 03:06:38 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
2000-05-15 08:12:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:58:25 +03:00
|
|
|
nsFieldSetFrame::InsertFrames(nsIAtom* aListName,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
2000-05-15 08:12:31 +04:00
|
|
|
{
|
2005-01-25 03:06:38 +03:00
|
|
|
aFrameList = MaybeSetLegend(aFrameList, aListName);
|
|
|
|
if (aFrameList) {
|
|
|
|
ReParentFrameList(aFrameList);
|
2005-02-07 04:58:25 +03:00
|
|
|
return mContentFrame->InsertFrames(aListName, aPrevFrame, aFrameList);
|
2005-01-25 03:06:38 +03:00
|
|
|
}
|
|
|
|
return NS_OK;
|
2000-05-15 08:12:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:58:25 +03:00
|
|
|
nsFieldSetFrame::RemoveFrame(nsIAtom* aListName,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* aOldFrame)
|
2000-05-15 08:12:31 +04:00
|
|
|
{
|
2005-01-25 03:06:38 +03:00
|
|
|
// For reference, see bug 70648, bug 276104 and bug 236071.
|
|
|
|
if (aOldFrame == mLegendFrame) {
|
|
|
|
NS_ASSERTION(!aListName, "Unexpected frame list when removing legend frame");
|
2003-07-04 16:50:32 +04:00
|
|
|
NS_ASSERTION(mLegendFrame->GetParent() == this, "Legend Parent has wrong parent");
|
2005-01-02 17:30:24 +03:00
|
|
|
NS_ASSERTION(mLegendFrame->GetNextSibling() == mContentFrame, "mContentFrame is not next sibling");
|
2005-02-07 04:58:25 +03:00
|
|
|
nsPresContext* presContext = GetPresContext();
|
|
|
|
mFrames.DestroyFrame(presContext, mLegendFrame);
|
2001-05-11 18:26:04 +04:00
|
|
|
mLegendFrame = nsnull;
|
2005-01-25 03:06:38 +03:00
|
|
|
AddStateBits(NS_FRAME_IS_DIRTY);
|
|
|
|
if (GetParent()) {
|
2005-02-07 04:58:25 +03:00
|
|
|
GetParent()->ReflowDirtyChild(presContext->GetPresShell(), this);
|
2005-01-25 03:06:38 +03:00
|
|
|
}
|
2001-05-11 18:26:04 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2005-02-07 04:58:25 +03:00
|
|
|
return mContentFrame->RemoveFrame(aListName, aOldFrame);
|
2000-05-15 08:12:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2005-02-07 04:58:25 +03:00
|
|
|
nsFieldSetFrame::ReplaceFrame(nsIAtom* aListName,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame)
|
2000-05-15 08:12:31 +04:00
|
|
|
{
|
2005-01-25 03:06:38 +03:00
|
|
|
if (aOldFrame == mLegendFrame) {
|
|
|
|
mLegendFrame = aNewFrame;
|
2005-02-07 04:58:25 +03:00
|
|
|
return nsContainerFrame::ReplaceFrame(aListName, aOldFrame, aNewFrame);
|
2005-01-25 03:06:38 +03:00
|
|
|
}
|
2005-02-07 04:58:25 +03:00
|
|
|
return mContentFrame->ReplaceFrame(aListName, aOldFrame, aNewFrame);
|
2000-05-15 08:12:31 +04:00
|
|
|
}
|
|
|
|
|
2002-01-31 08:09:13 +03:00
|
|
|
NS_IMETHODIMP
|
2005-01-01 20:26:29 +03:00
|
|
|
nsFieldSetFrame::GetFrameForPoint(const nsPoint& aPoint,
|
2005-01-25 03:06:38 +03:00
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame)
|
2002-01-31 08:09:13 +03:00
|
|
|
{
|
|
|
|
// this should act like a block, so we need to override
|
2005-01-01 20:26:29 +03:00
|
|
|
return GetFrameForPointUsing(aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame);
|
2002-01-31 08:09:13 +03:00
|
|
|
}
|
2002-02-16 04:34:42 +03:00
|
|
|
|
|
|
|
#ifdef ACCESSIBILITY
|
|
|
|
NS_IMETHODIMP nsFieldSetFrame::GetAccessible(nsIAccessible** aAccessible)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIAccessibilityService> accService = do_GetService("@mozilla.org/accessibilityService;1");
|
|
|
|
|
|
|
|
if (accService) {
|
|
|
|
return accService->CreateHTMLGroupboxAccessible(NS_STATIC_CAST(nsIFrame*, this), aAccessible);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
#endif
|
2005-01-25 03:06:38 +03:00
|
|
|
|
|
|
|
nsIFrame*
|
|
|
|
nsFieldSetFrame::MaybeSetLegend(nsIFrame* aFrameList, nsIAtom* aListName)
|
|
|
|
{
|
|
|
|
if (!mLegendFrame && aFrameList->GetType() == nsLayoutAtoms::legendFrame) {
|
|
|
|
NS_ASSERTION(!aListName, "Unexpected frame list when adding legend frame");
|
|
|
|
mLegendFrame = aFrameList;
|
|
|
|
aFrameList = mLegendFrame->GetNextSibling();
|
|
|
|
mLegendFrame->SetNextSibling(mContentFrame);
|
|
|
|
mFrames.SetFrames(mLegendFrame);
|
|
|
|
AddStateBits(NS_FRAME_IS_DIRTY);
|
|
|
|
if (GetParent()) {
|
|
|
|
GetParent()->ReflowDirtyChild(mLegendFrame->GetPresContext()->GetPresShell(), this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aFrameList;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsFieldSetFrame::ReParentFrameList(nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
nsFrameManager* frameManager = mContentFrame->GetPresContext()->FrameManager();
|
|
|
|
nsStyleContext* newParentContext = mContentFrame->GetStyleContext();
|
|
|
|
for (nsIFrame* frame = aFrameList; frame; frame = frame->GetNextSibling()) {
|
|
|
|
frame->SetParent(mContentFrame);
|
|
|
|
frameManager->ReParentStyleContext(frame, newParentContext);
|
|
|
|
}
|
|
|
|
mContentFrame->AddStateBits(GetStateBits() & NS_FRAME_HAS_CHILD_WITH_VIEW);
|
|
|
|
}
|