1998-10-08 08:38:41 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:40:37 +03: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
|
|
|
*
|
1999-11-06 06:40:37 +03: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.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-10-08 08:38:41 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:40:37 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
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 "nsHTMLIIDs.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"
|
1998-10-08 08:38:41 +04:00
|
|
|
|
|
|
|
static NS_DEFINE_IID(kLegendFrameCID, NS_LEGEND_FRAME_CID);
|
|
|
|
static NS_DEFINE_IID(kIDOMHTMLFieldSetElementIID, NS_IDOMHTMLFIELDSETELEMENT_IID);
|
|
|
|
static NS_DEFINE_IID(kIDOMHTMLLegendElementIID, NS_IDOMHTMLLEGENDELEMENT_IID);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
1999-11-24 09:03:41 +03:00
|
|
|
NS_METHOD Paint(nsIPresContext* aPresContext,
|
1998-10-08 08:38:41 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer);
|
1998-11-19 20:22:29 +03:00
|
|
|
|
1999-11-02 01:12:45 +03:00
|
|
|
#ifdef DEBUG
|
1998-11-19 20:22:29 +03:00
|
|
|
NS_IMETHOD GetFrameName(nsString& aResult) const {
|
|
|
|
return MakeFrameName("FieldSet", aResult);
|
|
|
|
}
|
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
|
1999-11-24 09:03:41 +03:00
|
|
|
nsFieldSetFrame::Paint(nsIPresContext* aPresContext,
|
1998-10-08 08:38:41 +04:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
1998-12-18 18:54:23 +03:00
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
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
|
|
|
|
const nsStyleDisplay* disp =
|
|
|
|
(const nsStyleDisplay*)mStyleContext->GetStyleData(eStyleStruct_Display);
|
|
|
|
|
2000-03-17 13:15:13 +03:00
|
|
|
if (disp->IsVisible() && mRect.width && mRect.height) {
|
1998-12-18 18:54:23 +03:00
|
|
|
PRIntn skipSides = GetSkipSides();
|
|
|
|
const nsStyleColor* color =
|
|
|
|
(const nsStyleColor*)mStyleContext->GetStyleData(eStyleStruct_Color);
|
|
|
|
const nsStyleSpacing* spacing =
|
|
|
|
(const nsStyleSpacing*)mStyleContext->GetStyleData(eStyleStruct_Spacing);
|
1999-10-20 04:46:21 +04:00
|
|
|
|
1999-06-02 01:52:11 +04:00
|
|
|
nsMargin border;
|
1999-07-28 08:48:34 +04:00
|
|
|
if (!spacing->GetBorder(border)) {
|
|
|
|
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,
|
1999-01-15 21:25:58 +03:00
|
|
|
aDirtyRect, rect, *color, *spacing, 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,
|
|
|
|
aDirtyRect, rect, *spacing, mStyleContext, skipSides);
|
|
|
|
|
|
|
|
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,
|
|
|
|
aDirtyRect, rect, *spacing, mStyleContext, skipSides);
|
|
|
|
|
|
|
|
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,
|
|
|
|
aDirtyRect, rect, *spacing, mStyleContext, skipSides);
|
|
|
|
|
|
|
|
aRenderingContext.PopState(clipState);
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, this,
|
|
|
|
aDirtyRect, nsRect(0,0,mRect.width, mRect.height), *spacing, 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()) {
|
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
|
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);
|
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;
|
|
|
|
|
|
|
|
//------------ Handle Incremental Reflow -----------------
|
|
|
|
nsIFrame* incrementalChild = nsnull;
|
|
|
|
PRBool reflowContent = PR_TRUE;
|
|
|
|
PRBool reflowLegend = PR_TRUE;
|
|
|
|
nsReflowReason reason = aReflowState.reason;
|
|
|
|
|
|
|
|
if ( aReflowState.reason == eReflowReason_Incremental ) {
|
|
|
|
nsIReflowCommand::ReflowType reflowType;
|
|
|
|
aReflowState.reflowCommand->GetType(reflowType);
|
|
|
|
|
|
|
|
// See if it's targeted at us
|
|
|
|
nsIFrame* targetFrame;
|
|
|
|
aReflowState.reflowCommand->GetTarget(targetFrame);
|
|
|
|
|
|
|
|
if (this == targetFrame) {
|
|
|
|
switch (reflowType) {
|
|
|
|
|
|
|
|
case nsIReflowCommand::StyleChanged:
|
|
|
|
{
|
|
|
|
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
|
|
|
|
case nsIReflowCommand::ReflowDirty:
|
|
|
|
{
|
|
|
|
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 {
|
|
|
|
aReflowState.reflowCommand->GetNext(incrementalChild);
|
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
|
|
|
reflowContent = PR_FALSE;
|
|
|
|
reflowLegend = PR_FALSE;
|
|
|
|
|
|
|
|
if (incrementalChild == mLegendFrame)
|
|
|
|
reflowLegend = PR_TRUE;
|
|
|
|
else if (incrementalChild == mContentFrame)
|
|
|
|
reflowContent = PR_TRUE;
|
|
|
|
}
|
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);
|
|
|
|
|
|
|
|
// 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.
|
|
|
|
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) {
|
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,
|
|
|
|
mLegendFrame, nsSize(NS_INTRINSICSIZE,NS_INTRINSICSIZE));
|
|
|
|
|
|
|
|
// always give the legend as much size as it needs
|
|
|
|
legendReflowState.mComputedWidth = NS_INTRINSICSIZE;
|
|
|
|
legendReflowState.mComputedHeight = NS_INTRINSICSIZE;
|
|
|
|
legendReflowState.reason = reason;
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
// get the legend's margin
|
|
|
|
const nsStyleSpacing* legendSpacing;
|
|
|
|
mLegendFrame->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) legendSpacing);
|
|
|
|
|
|
|
|
legendSpacing->GetMargin(legendMargin);
|
|
|
|
|
|
|
|
// 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
|
|
|
|
mLegendSpace = mLegendRect.height - borderPadding.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
|
|
|
|
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
|
|
|
|
2000-02-11 00:36:28 +03:00
|
|
|
FinishReflowChild(mLegendFrame, aPresContext, legendDesiredSize, 0, 0, NS_FRAME_NO_MOVE_FRAME);
|
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,
|
|
|
|
availSize);
|
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
|
|
|
kidReflowState.reason = reason;
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2000-02-11 00:36:28 +03:00
|
|
|
nsHTMLReflowMetrics kidDesiredSize(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 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-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
|
|
|
printf("*** %p computedHgt: %d ", this, aReflowState.mComputedHeight);
|
|
|
|
printf("Reason: ");
|
|
|
|
switch (aReflowState.reason) {
|
|
|
|
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;
|
|
|
|
}
|
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);
|
|
|
|
printf(" areaHgt: %d", 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
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2000-02-11 00:36:28 +03:00
|
|
|
FinishReflowChild(mContentFrame, aPresContext, 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);
|
|
|
|
|
|
|
|
// printf("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height);
|
|
|
|
|
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);
|
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
mContentFrame->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
|
|
|
nsMargin m(0,0,0,0);
|
|
|
|
spacing->GetMargin(m);
|
|
|
|
contentRect.Inflate(m);
|
|
|
|
}
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
|
|
|
if (mLegendFrame) {
|
2000-01-11 23:40:06 +03:00
|
|
|
if (contentRect.width > mLegendRect.width) {
|
|
|
|
PRInt32 align = ((nsLegendFrame*)mLegendFrame)->GetAlign();
|
2000-01-09 05:05:25 +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:
|
|
|
|
mLegendRect.x = contentRect.width/2 - mLegendRect.width/2 + borderPadding.left;
|
|
|
|
}
|
2000-01-09 05:05:25 +03:00
|
|
|
|
2000-01-11 23:40:06 +03:00
|
|
|
} else {
|
|
|
|
contentRect.width = mLegendRect.width + borderPadding.left + borderPadding.right;
|
|
|
|
aDesiredSize.width = contentRect.width;
|
|
|
|
}
|
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);
|
|
|
|
|
|
|
|
nsIView* view;
|
|
|
|
mLegendFrame->GetView(aPresContext, &view);
|
|
|
|
if (view)
|
|
|
|
nsContainerFrame::PositionFrameView(aPresContext, mLegendFrame, view);
|
|
|
|
else
|
|
|
|
nsContainerFrame::PositionChildViews(aPresContext, 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
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aReflowState.mComputedWidth == NS_INTRINSICSIZE) {
|
|
|
|
aDesiredSize.width = borderPadding.left +
|
2000-02-11 00:36:28 +03:00
|
|
|
contentRect.width +
|
2000-01-09 05:05:25 +03:00
|
|
|
borderPadding.right;
|
|
|
|
} else {
|
|
|
|
nscoord min = borderPadding.left + borderPadding.right + mLegendRect.width;
|
|
|
|
aDesiredSize.width = aReflowState.mComputedWidth + borderPadding.left + borderPadding.right;
|
|
|
|
if (aDesiredSize.width < min)
|
|
|
|
aDesiredSize.width = min;
|
|
|
|
}
|
|
|
|
|
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
|
|
|
|
|
|
|
if (nsnull != aDesiredSize.maxElementSize) {
|
|
|
|
// if the legend it wider use it
|
|
|
|
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;
|
|
|
|
}
|
1999-06-02 01:52:11 +04:00
|
|
|
|
1998-10-08 08:38:41 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRIntn
|
|
|
|
nsFieldSetFrame::GetSkipSides() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|