2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1998-10-08 08:38:41 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
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.
|
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* 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
|
|
|
|
* either 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"),
|
|
|
|
* 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
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* 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
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** 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"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsIHTMLContent.h"
|
|
|
|
#include "nsHTMLParts.h"
|
1998-11-03 23:33:43 +03:00
|
|
|
#include "nsHTMLAtoms.h"
|
1998-10-08 08:38:41 +04:00
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsStyleConsts.h"
|
|
|
|
#include "nsStyleUtil.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"
|
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
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-10 09:05:32 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList);
|
1998-10-08 08:38:41 +04:00
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_IMETHOD Reflow(nsIPresContext* aPresContext,
|
1998-10-08 08:38:41 +04:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus);
|
|
|
|
|
2001-09-19 16:35:19 +04:00
|
|
|
NS_METHOD Paint(nsIPresContext* 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-11-19 20:22:29 +03:00
|
|
|
|
2000-05-15 08:12:31 +04:00
|
|
|
NS_IMETHOD AppendFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList);
|
|
|
|
NS_IMETHOD InsertFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList);
|
|
|
|
NS_IMETHOD RemoveFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame);
|
|
|
|
NS_IMETHOD ReplaceFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame);
|
2002-01-31 08:09:13 +03:00
|
|
|
NS_IMETHOD GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame);
|
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;
|
|
|
|
|
|
|
|
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
|
2000-01-18 18:42:45 +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)
|
2000-01-20 20:14:34 +03:00
|
|
|
nsFrameState state;
|
|
|
|
it->GetFrameState( &state );
|
|
|
|
state |= aStateFlags;
|
|
|
|
it->SetFrameState( state );
|
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
|
|
|
{
|
1999-06-02 01:52:11 +04:00
|
|
|
mContentFrame = nsnull;
|
1998-10-08 08:38:41 +04:00
|
|
|
mLegendFrame = nsnull;
|
1999-06-02 01:52:11 +04:00
|
|
|
mLegendSpace = 0;
|
1998-10-08 08:38:41 +04:00
|
|
|
}
|
|
|
|
|
2000-01-09 05:05:25 +03:00
|
|
|
|
1998-10-08 08:38:41 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsFieldSetFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
1998-11-10 09:05:32 +03:00
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
1998-10-08 08:38:41 +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
|
|
|
|
|
|
|
// get the content and legend frames.
|
|
|
|
mContentFrame = aChildList;
|
|
|
|
mContentFrame->GetNextSibling(&mLegendFrame);
|
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
|
2001-09-19 16:35:19 +04:00
|
|
|
nsFieldSetFrame::Paint(nsIPresContext* 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();
|
2001-02-07 12:57:26 +03:00
|
|
|
const nsStyleBorder* borderStyle =
|
|
|
|
(const nsStyleBorder*)mStyleContext->GetStyleData(eStyleStruct_Border);
|
1999-10-20 04:46:21 +04:00
|
|
|
|
1999-06-02 01:52:11 +04:00
|
|
|
nsMargin border;
|
2001-02-07 12:57:26 +03:00
|
|
|
if (!borderStyle->GetBorder(border)) {
|
1999-07-28 08:48:34 +04:00
|
|
|
NS_NOTYETIMPLEMENTED("percentage border");
|
|
|
|
}
|
1999-06-02 01:52:11 +04:00
|
|
|
|
|
|
|
nscoord yoff = 0;
|
|
|
|
|
1999-08-06 04:48:26 +04:00
|
|
|
// if the border is smaller than the legend. Move the border down
|
1999-06-02 01:52:11 +04:00
|
|
|
// to be centered on the legend.
|
|
|
|
if (border.top < mLegendRect.height)
|
|
|
|
yoff = (mLegendRect.height - border.top)/2;
|
|
|
|
|
|
|
|
nsRect rect(0, yoff, mRect.width, mRect.height - yoff);
|
1998-12-18 18:54:23 +03:00
|
|
|
|
|
|
|
nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, this,
|
2002-01-08 02:46:07 +03:00
|
|
|
aDirtyRect, rect, *borderStyle, 0, 0);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
|
|
|
if (mLegendFrame) {
|
|
|
|
|
|
|
|
// we should probably use PaintBorderEdges to do this but for now just use clipping
|
|
|
|
// to achieve the same effect.
|
|
|
|
PRBool clipState;
|
|
|
|
|
|
|
|
// draw left side
|
|
|
|
nsRect clipRect(rect);
|
|
|
|
clipRect.width = mLegendRect.x - rect.x;
|
|
|
|
clipRect.height = border.top;
|
|
|
|
|
|
|
|
aRenderingContext.PushState();
|
|
|
|
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState);
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
2001-02-07 12:57:26 +03:00
|
|
|
aDirtyRect, rect, *borderStyle, mStyleContext, skipSides);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
|
|
|
aRenderingContext.PopState(clipState);
|
|
|
|
|
|
|
|
|
|
|
|
// draw right side
|
|
|
|
clipRect = rect;
|
|
|
|
clipRect.x = mLegendRect.x + mLegendRect.width;
|
|
|
|
clipRect.width -= (mLegendRect.x + mLegendRect.width);
|
|
|
|
clipRect.height = border.top;
|
|
|
|
|
|
|
|
aRenderingContext.PushState();
|
|
|
|
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState);
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
2001-02-07 12:57:26 +03:00
|
|
|
aDirtyRect, rect, *borderStyle, mStyleContext, skipSides);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
|
|
|
aRenderingContext.PopState(clipState);
|
|
|
|
|
|
|
|
|
|
|
|
// draw bottom
|
|
|
|
|
|
|
|
clipRect = rect;
|
|
|
|
clipRect.y += border.top;
|
|
|
|
clipRect.height = mRect.height - (yoff + border.top);
|
|
|
|
|
|
|
|
aRenderingContext.PushState();
|
|
|
|
aRenderingContext.SetClipRect(clipRect, nsClipCombine_kIntersect, clipState);
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
2001-02-07 12:57:26 +03:00
|
|
|
aDirtyRect, rect, *borderStyle, mStyleContext, skipSides);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
|
|
|
aRenderingContext.PopState(clipState);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
2002-01-08 02:46:07 +03:00
|
|
|
aDirtyRect,
|
|
|
|
nsRect(0,0,mRect.width, mRect.height),
|
|
|
|
*borderStyle, mStyleContext, skipSides);
|
1999-06-02 01:52:11 +04:00
|
|
|
}
|
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()) {
|
1998-10-08 08:38:41 +04:00
|
|
|
nsIView* view;
|
1999-11-24 09:03:41 +03:00
|
|
|
GetView(aPresContext, &view);
|
1998-10-08 08:38:41 +04:00
|
|
|
if (nsnull != view) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
1999-02-23 06:48:01 +03:00
|
|
|
|
1998-10-08 08:38:41 +04:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 09:03:41 +03:00
|
|
|
nsFieldSetFrame::Reflow(nsIPresContext* 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
|
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
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
|
2002-01-31 08:09:13 +03:00
|
|
|
if (nsnull != aDesiredSize.maxElementSize) {
|
|
|
|
aDesiredSize.maxElementSize->width = 0;
|
|
|
|
aDesiredSize.maxElementSize->height = 0;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
//------------ Handle Incremental Reflow -----------------
|
|
|
|
PRBool reflowContent = PR_TRUE;
|
|
|
|
PRBool reflowLegend = PR_TRUE;
|
|
|
|
nsReflowReason reason = aReflowState.reason;
|
|
|
|
|
|
|
|
if ( aReflowState.reason == eReflowReason_Incremental ) {
|
2002-05-10 22:22:41 +04:00
|
|
|
nsHTMLReflowCommand *command = aReflowState.path->mReflowCommand;
|
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
|
|
|
|
|
|
|
// See if it's targeted at us
|
2002-05-10 22:22:41 +04:00
|
|
|
if (command) {
|
|
|
|
nsReflowType reflowType;
|
|
|
|
command->GetType(reflowType);
|
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
|
|
|
|
|
|
|
switch (reflowType) {
|
|
|
|
|
2001-12-18 01:39:59 +03:00
|
|
|
case eReflowType_StyleChanged:
|
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
|
|
|
{
|
|
|
|
nsHTMLReflowState newState(aReflowState);
|
|
|
|
newState.reason = eReflowReason_StyleChange;
|
|
|
|
return Reflow(aPresContext, aDesiredSize, newState, aStatus);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
// if its a dirty type then reflow us with a dirty reflow
|
2001-12-18 01:39:59 +03:00
|
|
|
case eReflowType_ReflowDirty:
|
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
|
|
|
{
|
|
|
|
nsHTMLReflowState newState(aReflowState);
|
|
|
|
newState.reason = eReflowReason_Dirty;
|
|
|
|
return Reflow(aPresContext, aDesiredSize, newState, aStatus);
|
|
|
|
}
|
|
|
|
break;
|
2000-04-25 11:10:48 +04:00
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
} else {
|
|
|
|
reflowContent = PR_FALSE;
|
|
|
|
reflowLegend = PR_FALSE;
|
|
|
|
|
2002-05-10 22:22:41 +04:00
|
|
|
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;
|
|
|
|
}
|
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
|
|
|
}
|
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
|
|
|
// if dirty then check dirty flags
|
|
|
|
if (reason == eReflowReason_Dirty)
|
|
|
|
{
|
|
|
|
if (reflowContent) {
|
|
|
|
nsFrameState state;
|
|
|
|
mContentFrame->GetFrameState(&state);
|
|
|
|
reflowContent = (state & NS_FRAME_IS_DIRTY) || (state & NS_FRAME_HAS_DIRTY_CHILDREN);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (reflowLegend) {
|
|
|
|
nsFrameState state;
|
|
|
|
mLegendFrame->GetFrameState(&state);
|
|
|
|
reflowLegend = (state & NS_FRAME_IS_DIRTY) || (state & NS_FRAME_HAS_DIRTY_CHILDREN);
|
|
|
|
}
|
|
|
|
}
|
2000-01-09 05:05:25 +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
|
|
|
|
2000-01-09 05:05:25 +03:00
|
|
|
// get our border and padding
|
|
|
|
const nsMargin &borderPadding = aReflowState.mComputedBorderPadding;
|
|
|
|
const nsMargin &padding = aReflowState.mComputedPadding;
|
|
|
|
nsMargin border = borderPadding - padding;
|
|
|
|
|
|
|
|
// Figure out how big the legend is if there is one.
|
2000-07-06 17:22:12 +04:00
|
|
|
// get the legend's margin
|
2000-01-09 05:05:25 +03:00
|
|
|
nsMargin legendMargin(0,0,0,0);
|
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
|
|
|
// reflow the legend only if needed
|
2000-01-09 05:05:25 +03:00
|
|
|
if (mLegendFrame) {
|
2001-02-07 12:57:26 +03:00
|
|
|
const nsStyleMargin* marginStyle;
|
|
|
|
mLegendFrame->GetStyleData(eStyleStruct_Margin,
|
|
|
|
(const nsStyleStruct*&) marginStyle);
|
|
|
|
marginStyle->GetMargin(legendMargin);
|
2000-07-06 17:22:12 +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
|
|
|
if (reflowLegend) {
|
|
|
|
nsHTMLReflowState legendReflowState(aPresContext, aReflowState,
|
2002-05-10 22:22:41 +04:00
|
|
|
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
|
|
|
|
|
|
|
// always give the legend as much size as it needs
|
|
|
|
legendReflowState.mComputedWidth = NS_INTRINSICSIZE;
|
|
|
|
legendReflowState.mComputedHeight = NS_INTRINSICSIZE;
|
|
|
|
|
2000-02-11 00:36:28 +03:00
|
|
|
nsHTMLReflowMetrics legendDesiredSize(0,0);
|
|
|
|
|
|
|
|
ReflowChild(mLegendFrame, aPresContext, legendDesiredSize, legendReflowState,
|
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
|
|
|
0, 0, NS_FRAME_NO_MOVE_FRAME, aStatus);
|
2000-05-16 02:51:42 +04:00
|
|
|
#ifdef NOISY_REFLOW
|
2000-10-29 02:17:53 +04:00
|
|
|
printf(" returned (%d, %d)\n", legendDesiredSize.width, legendDesiredSize.height);
|
2000-05-16 02:51:42 +04:00
|
|
|
if (legendDesiredSize.maxElementSize)
|
2000-10-29 02:17:53 +04:00
|
|
|
printf(" and maxES (%d, %d)\n",
|
2000-05-16 02:51:42 +04:00
|
|
|
legendDesiredSize.maxElementSize->width, legendDesiredSize.maxElementSize->height);
|
|
|
|
#endif
|
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
|
|
|
// figure out the legend's rectangle
|
2000-02-11 00:36:28 +03:00
|
|
|
mLegendRect.width = legendDesiredSize.width + legendMargin.left + legendMargin.right;
|
|
|
|
mLegendRect.height = legendDesiredSize.height + legendMargin.top + legendMargin.bottom;
|
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
|
|
|
mLegendRect.x = borderPadding.left;
|
|
|
|
mLegendRect.y = 0;
|
|
|
|
|
|
|
|
nscoord oldSpace = mLegendSpace;
|
|
|
|
mLegendSpace = 0;
|
|
|
|
if (mLegendRect.height > border.top) {
|
|
|
|
// center the border on the legend
|
2002-01-31 08:09:13 +03:00
|
|
|
mLegendSpace = mLegendRect.height - border.top;
|
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
|
|
|
} 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
|
|
|
|
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
|
|
|
// 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
|
|
|
|
2001-12-07 17:51:12 +03:00
|
|
|
FinishReflowChild(mLegendFrame, aPresContext, &legendReflowState,
|
|
|
|
legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
|
2000-05-16 02:51:42 +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
|
|
|
}
|
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
|
|
|
nsRect contentRect;
|
|
|
|
|
|
|
|
// reflow the content frame only if needed
|
|
|
|
if (mContentFrame) {
|
|
|
|
if (reflowContent) {
|
|
|
|
availSize.width = aReflowState.mComputedWidth;
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2000-01-11 23:40:06 +03:00
|
|
|
#if 0
|
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
|
|
|
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE) {
|
|
|
|
availSize.height = aReflowState.mComputedHeight - mLegendSpace;
|
|
|
|
} else {
|
|
|
|
availSize.height = NS_INTRINSICSIZE;
|
|
|
|
}
|
2000-01-11 23:40:06 +03:00
|
|
|
#endif
|
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
|
|
|
nsHTMLReflowState kidReflowState(aPresContext, aReflowState, mContentFrame,
|
2002-05-10 22:22:41 +04:00
|
|
|
availSize, reason);
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2002-01-31 08:09:13 +03:00
|
|
|
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.maxElementSize, aDesiredSize.mFlags);
|
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
|
|
|
// Reflow the frame
|
2000-02-11 00:36:28 +03:00
|
|
|
ReflowChild(mContentFrame, aPresContext, kidDesiredSize, kidReflowState,
|
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
|
|
|
kidReflowState.mComputedMargin.left, kidReflowState.mComputedMargin.top,
|
|
|
|
0, aStatus);
|
2000-05-16 02:51:42 +04:00
|
|
|
#ifdef NOISY_REFLOW
|
2000-10-29 02:17:53 +04:00
|
|
|
printf(" returned (%d, %d)\n", kidDesiredSize.width, kidDesiredSize.height);
|
2000-05-16 02:51:42 +04:00
|
|
|
if (kidDesiredSize.maxElementSize)
|
2000-10-29 02:17:53 +04:00
|
|
|
printf(" and maxES (%d, %d)\n",
|
2000-05-16 02:51:42 +04:00
|
|
|
kidDesiredSize.maxElementSize->width, kidDesiredSize.maxElementSize->height);
|
|
|
|
#endif
|
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
|
|
|
|
2000-02-11 00:36:28 +03:00
|
|
|
/*
|
2000-10-29 02:17:53 +04:00
|
|
|
printf("*** %p computedHgt: %d ", this, aReflowState.mComputedHeight);
|
|
|
|
printf("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
|
|
|
switch (aReflowState.reason) {
|
2000-10-29 02:17:53 +04:00
|
|
|
case eReflowReason_Initial:printf("Initil");break;
|
|
|
|
case eReflowReason_Incremental:printf("Increm");break;
|
|
|
|
case eReflowReason_Resize: printf("Resize"); break;
|
|
|
|
case eReflowReason_StyleChange:printf("eReflowReason_StyleChange");break;
|
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
|
|
|
}
|
2000-02-11 00:36:28 +03:00
|
|
|
*/
|
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
|
|
|
// set the rect. make sure we add the margin back in.
|
2000-02-11 00:36:28 +03:00
|
|
|
contentRect.SetRect(borderPadding.left,borderPadding.top + mLegendSpace,kidDesiredSize.width ,kidDesiredSize.height);
|
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
|
|
|
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE &&
|
2000-02-11 00:36:28 +03:00
|
|
|
borderPadding.top + mLegendSpace+kidDesiredSize.height > aReflowState.mComputedHeight) {
|
|
|
|
kidDesiredSize.height = aReflowState.mComputedHeight-(borderPadding.top + mLegendSpace);
|
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
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2001-12-07 17:51:12 +03:00
|
|
|
FinishReflowChild(mContentFrame, aPresContext, &kidReflowState,
|
|
|
|
kidDesiredSize, contentRect.x, contentRect.y, 0);
|
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
|
|
|
nsFrameState kidState;
|
|
|
|
mContentFrame->GetFrameState(&kidState);
|
|
|
|
|
2000-10-29 02:17:53 +04:00
|
|
|
// printf("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height);
|
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
|
|
|
|
2000-02-11 00:36:28 +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
|
|
|
if (kidState & NS_FRAME_OUTSIDE_CHILDREN) {
|
|
|
|
mState |= NS_FRAME_OUTSIDE_CHILDREN;
|
|
|
|
aDesiredSize.mOverflowArea.width += borderPadding.left + borderPadding.right;
|
|
|
|
aDesiredSize.mOverflowArea.height += borderPadding.top + borderPadding.bottom + mLegendSpace;
|
|
|
|
}
|
2000-02-11 00:36:28 +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
|
|
|
|
|
|
|
NS_FRAME_TRACE_REFLOW_OUT("FieldSet::Reflow", aStatus);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// if we don't need to reflow just get the old size
|
|
|
|
mContentFrame->GetRect(contentRect);
|
2001-02-07 12:57:26 +03:00
|
|
|
const nsStyleMargin* marginStyle;
|
|
|
|
mContentFrame->GetStyleData(eStyleStruct_Margin,
|
|
|
|
(const nsStyleStruct*&) marginStyle);
|
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
|
|
|
|
|
|
|
nsMargin m(0,0,0,0);
|
2001-02-07 12:57:26 +03:00
|
|
|
marginStyle->GetMargin(m);
|
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
|
|
|
contentRect.Inflate(m);
|
|
|
|
}
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
|
|
|
if (mLegendFrame) {
|
2002-01-31 08:09:13 +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 the content rect is larger then the legend we can align the legend
|
2000-01-11 23:40:06 +03:00
|
|
|
if (contentRect.width > mLegendRect.width) {
|
|
|
|
PRInt32 align = ((nsLegendFrame*)mLegendFrame)->GetAlign();
|
2002-01-31 08:09:13 +03:00
|
|
|
|
2000-01-11 23:40:06 +03:00
|
|
|
switch(align) {
|
|
|
|
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
|
|
|
mLegendRect.x = contentRect.width - mLegendRect.width + borderPadding.left;
|
|
|
|
break;
|
|
|
|
case NS_STYLE_TEXT_ALIGN_CENTER:
|
2002-01-31 08:09:13 +03:00
|
|
|
float p2t;
|
|
|
|
aPresContext->GetPixelsToTwips(&p2t);
|
|
|
|
mLegendRect.x = NSIntPixelsToTwips((nscoord) NSToIntRound((float)(contentRect.width/2 - mLegendRect.width/2 + borderPadding.left) / p2t),p2t);
|
2000-01-11 23:40:06 +03:00
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2000-01-11 23:40:06 +03:00
|
|
|
} else {
|
2002-01-31 08:09:13 +03:00
|
|
|
//otherwise make place for the legend
|
|
|
|
contentRect.width = mLegendRect.width;
|
2000-01-11 23:40:06 +03:00
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
// place the legend
|
|
|
|
nsRect actualLegendRect(mLegendRect);
|
|
|
|
actualLegendRect.Deflate(legendMargin);
|
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
|
|
|
|
|
|
|
nsPoint curOrigin;
|
|
|
|
mLegendFrame->GetOrigin(curOrigin);
|
|
|
|
|
|
|
|
// only if the origin changed
|
|
|
|
if ((curOrigin.x != mLegendRect.x) || (curOrigin.y != mLegendRect.y)) {
|
|
|
|
mLegendFrame->MoveTo(aPresContext, actualLegendRect.x , actualLegendRect.y);
|
2001-09-06 00:27:19 +04:00
|
|
|
nsContainerFrame::PositionFrameView(aPresContext, mLegendFrame);
|
2001-09-21 04:53:29 +04:00
|
|
|
|
|
|
|
// We need to recursively process the legend frame's
|
|
|
|
// children since we're moving the frame after Reflow.
|
|
|
|
nsContainerFrame::PositionChildViews(aPresContext, mLegendFrame);
|
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
|
|
|
}
|
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
|
|
|
|
2000-01-09 05:05:25 +03:00
|
|
|
// Return our size and our result
|
|
|
|
if (aReflowState.mComputedHeight == NS_INTRINSICSIZE) {
|
|
|
|
aDesiredSize.height = mLegendSpace +
|
|
|
|
borderPadding.top +
|
2000-02-11 00:36:28 +03:00
|
|
|
contentRect.height +
|
2000-01-09 05:05:25 +03:00
|
|
|
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;
|
|
|
|
}
|
2002-01-31 08:09:13 +03:00
|
|
|
aDesiredSize.width = contentRect.width + borderPadding.left + borderPadding.right;
|
2000-01-09 05:05:25 +03:00
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
2000-05-16 02:51:42 +04:00
|
|
|
aDesiredSize.mMaximumWidth = aDesiredSize.width;
|
2000-01-09 05:05:25 +03:00
|
|
|
if (nsnull != aDesiredSize.maxElementSize) {
|
2000-05-16 02:51:42 +04:00
|
|
|
// if the legend is wider use it
|
2000-01-09 05:05:25 +03:00
|
|
|
if (aDesiredSize.maxElementSize->width < mLegendRect.width)
|
|
|
|
aDesiredSize.maxElementSize->width = mLegendRect.width;
|
|
|
|
|
|
|
|
// add in padding.
|
|
|
|
aDesiredSize.maxElementSize->width += borderPadding.left + borderPadding.right;
|
|
|
|
|
|
|
|
// height is border + legend
|
|
|
|
aDesiredSize.maxElementSize->height += borderPadding.top + borderPadding.bottom + mLegendRect.height;
|
|
|
|
}
|
2000-05-16 02:51:42 +04:00
|
|
|
#ifdef NOISY_REFLOW
|
2000-10-29 02:17:53 +04:00
|
|
|
printf("FIELDSET: w=%d, maxWidth=%d, MES=%d\n",
|
2000-05-16 02:51:42 +04:00
|
|
|
aDesiredSize.width, aDesiredSize.mMaximumWidth,
|
|
|
|
aDesiredSize.maxElementSize ? aDesiredSize.maxElementSize->width : -1);
|
|
|
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH)
|
2000-10-29 02:17:53 +04:00
|
|
|
printf(" and preferred size = %d\n", aDesiredSize.mMaximumWidth);
|
1999-06-02 01:52:11 +04:00
|
|
|
|
2000-05-16 02:51:42 +04:00
|
|
|
#endif
|
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
|
|
|
|
nsFieldSetFrame::AppendFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
return mContentFrame->AppendFrames(aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aFrameList);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFieldSetFrame::InsertFrames(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
return mContentFrame->InsertFrames(aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aPrevFrame,
|
|
|
|
aFrameList);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFieldSetFrame::RemoveFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
2001-05-11 18:26:04 +04:00
|
|
|
// XXX XXX
|
|
|
|
// XXX temporary fix for bug 70648
|
|
|
|
if (aOldFrame == mLegendFrame) {
|
|
|
|
nsIFrame* sibling;
|
|
|
|
mContentFrame->GetNextSibling(&sibling);
|
|
|
|
NS_ASSERTION(sibling == mLegendFrame, "legendFrame is not next sibling");
|
2001-05-11 19:19:28 +04:00
|
|
|
#ifdef DEBUG
|
2001-05-11 18:26:04 +04:00
|
|
|
nsIFrame* legendParent;
|
|
|
|
mLegendFrame->GetParent(&legendParent);
|
|
|
|
NS_ASSERTION(legendParent == this, "Legend Parent has wrong parent");
|
|
|
|
#endif
|
|
|
|
nsIFrame* legendSibling;
|
|
|
|
sibling->GetNextSibling(&legendSibling);
|
|
|
|
// replace the legend, which is the next sibling, with any siblings of the legend (XXX always null?)
|
|
|
|
mContentFrame->SetNextSibling(legendSibling);
|
|
|
|
// OK, the legend is now removed from the sibling list, but who has ownership of it?
|
|
|
|
mLegendFrame->Destroy(aPresContext);
|
|
|
|
mLegendFrame = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
} else {
|
|
|
|
return mContentFrame->RemoveFrame (aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aOldFrame);
|
|
|
|
}
|
2000-05-15 08:12:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFieldSetFrame::ReplaceFrame(nsIPresContext* aPresContext,
|
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame,
|
|
|
|
nsIFrame* aNewFrame)
|
|
|
|
{
|
|
|
|
return mContentFrame->ReplaceFrame (aPresContext,
|
|
|
|
aPresShell,
|
|
|
|
aListName,
|
|
|
|
aOldFrame,
|
|
|
|
aNewFrame);
|
|
|
|
}
|
|
|
|
|
2002-01-31 08:09:13 +03:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsFieldSetFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsFramePaintLayer aWhichLayer,
|
|
|
|
nsIFrame** aFrame)
|
|
|
|
{
|
|
|
|
// this should act like a block, so we need to override
|
|
|
|
return GetFrameForPointUsing(aPresContext, aPoint, nsnull, aWhichLayer, (aWhichLayer == NS_FRAME_PAINT_LAYER_BACKGROUND), aFrame);
|
|
|
|
}
|
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
|