1999-03-27 01:35:55 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 03:40:37 +00: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/
|
1999-03-27 01:35:55 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00: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.
|
1999-03-27 01:35:55 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
1999-11-06 03:40:37 +00:00
|
|
|
* Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2000-02-02 22:24:56 +00:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1999-03-27 01:35:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
//
|
|
|
|
// Eric Vaughan
|
|
|
|
// Netscape Communications
|
|
|
|
//
|
|
|
|
// See documentation in associated header file
|
|
|
|
//
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
// How boxes layout
|
|
|
|
// ----------------
|
|
|
|
// Boxes layout a bit differently than html. html does a bottom up layout. Where boxes do a top down.
|
|
|
|
// 1) First thing a box does it goes out and askes each child for its min, max, and preferred sizes.
|
|
|
|
// 2) It then adds them up to determine its size.
|
|
|
|
// 3) If the box was asked to layout it self intrinically it will layout its children at their preferred size
|
|
|
|
// otherwise it will layout the child at the size it was told to. It will squeeze or stretch its children if
|
|
|
|
// Necessary.
|
|
|
|
//
|
|
|
|
// However there is a catch. Some html components like block frames can not determine their preferred size.
|
|
|
|
// this is their size if they were layed out intrinsically. So the box will flow the child to determine this can
|
|
|
|
// cache the value.
|
|
|
|
|
|
|
|
// Boxes and Incremental Reflow
|
|
|
|
// ----------------------------
|
|
|
|
// Boxes layout out top down by adding up their childrens min, max, and preferred sizes. Only problem is if a incremental
|
|
|
|
// reflow occurs. The preferred size of a child deep in the hierarchy could change. And this could change
|
|
|
|
// any number of syblings around the box. Basically any children in the reflow chain must have their caches cleared
|
|
|
|
// so when asked for there current size they can relayout themselves. Thats where the Dirty method comes in. This
|
|
|
|
// moves down the reflow chain until it reaches something that is not a box marking each child as being dirty.
|
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
#include "nsBoxFrame.h"
|
|
|
|
#include "nsIStyleContext.h"
|
|
|
|
#include "nsIPresContext.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsHTMLIIDs.h"
|
|
|
|
#include "nsUnitConversion.h"
|
|
|
|
#include "nsINameSpaceManager.h"
|
|
|
|
#include "nsHTMLAtoms.h"
|
|
|
|
#include "nsXULAtoms.h"
|
1999-03-30 04:05:49 +00:00
|
|
|
#include "nsIReflowCommand.h"
|
1999-05-09 21:46:24 +00:00
|
|
|
#include "nsIContent.h"
|
1999-07-02 05:28:32 +00:00
|
|
|
#include "nsSpaceManager.h"
|
|
|
|
#include "nsHTMLParts.h"
|
1999-06-30 22:17:43 +00:00
|
|
|
#include "nsIViewManager.h"
|
2000-01-14 10:34:27 +00:00
|
|
|
#include "nsIView.h"
|
1999-08-19 03:51:25 +00:00
|
|
|
#include "nsIPresShell.h"
|
1999-09-05 20:46:59 +00:00
|
|
|
#include "nsGenericHTMLElement.h"
|
|
|
|
#include "nsFrameNavigator.h"
|
1999-09-10 00:57:01 +00:00
|
|
|
#include "nsCSSRendering.h"
|
2000-01-14 10:34:27 +00:00
|
|
|
#include "nsISelfScrollingFrame.h"
|
2000-02-14 01:42:09 +00:00
|
|
|
#include "nsIPref.h"
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
#define CONSTANT 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-09 22:02:40 +00:00
|
|
|
//#define DEBUG_REFLOW
|
2000-02-14 01:42:09 +00:00
|
|
|
//define DEBUG_REDRAW
|
1999-08-27 06:06:39 +00:00
|
|
|
#define DEBUG_SPRING_SIZE 8
|
|
|
|
#define DEBUG_BORDER_SIZE 2
|
|
|
|
#define COIL_SIZE 8
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
//#define TEST_SANITY
|
1999-12-02 01:07:27 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
#define NS_STATE_IS_HORIZONTAL 0x00400000
|
|
|
|
#define NS_STATE_AUTO_STRETCH 0x00800000
|
|
|
|
#define NS_STATE_IS_ROOT 0x01000000
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
/**
|
|
|
|
* Only created when the box is in debug mode
|
|
|
|
*/
|
1999-12-02 01:07:27 +00:00
|
|
|
class nsBoxDebugInner
|
1999-08-27 06:06:39 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
nsBoxDebugInner(nsBoxFrame* aThis)
|
|
|
|
{
|
|
|
|
mOuter = aThis;
|
|
|
|
}
|
1999-09-10 08:46:17 +00:00
|
|
|
virtual ~nsBoxDebugInner() {}
|
1999-09-10 00:57:01 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
nsBoxFrame* mOuter;
|
|
|
|
|
|
|
|
float mP2t;
|
|
|
|
static nsIFrame* mDebugChild;
|
|
|
|
void GetValue(const nsSize& a, const nsSize& b, char* value);
|
1999-12-02 01:07:27 +00:00
|
|
|
void GetValue(PRInt32 a, PRInt32 b, char* value);
|
|
|
|
void DrawSpring( nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, PRInt32 flex, nscoord x, nscoord y, nscoord size, nscoord springSize);
|
1999-11-24 06:03:41 +00:00
|
|
|
void PaintSprings(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect);
|
1999-09-10 00:57:01 +00:00
|
|
|
void DrawLine(nsIRenderingContext& aRenderingContext, nscoord x1, nscoord y1, nscoord x2, nscoord y2);
|
|
|
|
void FillRect(nsIRenderingContext& aRenderingContext, nscoord x, nscoord y, nscoord width, nscoord 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-09 22:02:40 +00:00
|
|
|
PRBool DisplayDebugInfoFor(nsIPresContext* aPresContext,
|
1999-10-12 00:16:06 +00:00
|
|
|
nsPoint& aPoint,
|
|
|
|
PRInt32& aCursor);
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
|
2000-02-17 04:10:02 +00:00
|
|
|
static nsIStyleContext* mHorizontalDebugStyle;
|
|
|
|
static nsIStyleContext* mVerticalDebugStyle;
|
|
|
|
static PRInt32 gDebug;
|
1999-09-10 00:57:01 +00:00
|
|
|
};
|
|
|
|
|
2000-02-17 04:10:02 +00:00
|
|
|
nsIStyleContext* nsBoxDebugInner::mHorizontalDebugStyle;
|
|
|
|
nsIStyleContext* nsBoxDebugInner::mVerticalDebugStyle;
|
|
|
|
|
|
|
|
PRInt32 nsBoxDebugInner::gDebug = 0;
|
2000-02-14 01:42:09 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
class nsInfoListImpl: public nsInfoList
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsInfoListImpl();
|
1999-11-29 20:40:39 +00:00
|
|
|
virtual ~nsInfoListImpl();
|
1999-11-18 21:05:43 +00:00
|
|
|
virtual nsCalculatedBoxInfo* GetFirst();
|
|
|
|
virtual nsCalculatedBoxInfo* GetLast();
|
|
|
|
virtual PRInt32 GetCount();
|
1999-12-02 01:07:27 +00:00
|
|
|
|
|
|
|
void Clear();
|
|
|
|
PRInt32 CreateInfosFor(nsIFrame* aList, nsCalculatedBoxInfo*& first, nsCalculatedBoxInfo*& last);
|
|
|
|
void RemoveAfter(nsCalculatedBoxInfo* aPrev);
|
|
|
|
void Remove(nsIFrame* aChild);
|
|
|
|
void Prepend(nsIFrame* aList);
|
|
|
|
void Append(nsIFrame* aList);
|
|
|
|
void Insert(nsIFrame* aPrevFrame, nsIFrame* aList);
|
|
|
|
void InsertAfter(nsCalculatedBoxInfo* aPrev, nsIFrame* aList);
|
|
|
|
void Init(nsIFrame* aList);
|
|
|
|
nsCalculatedBoxInfo* GetPrevious(nsIFrame* aChild);
|
|
|
|
nsCalculatedBoxInfo* GetInfo(nsIFrame* aChild);
|
|
|
|
void SanityCheck(nsFrameList& aFrameList);
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
|
|
|
|
nsCalculatedBoxInfo* mFirst;
|
|
|
|
nsCalculatedBoxInfo* mLast;
|
|
|
|
PRInt32 mCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsCalculatedBoxInfoImpl: public nsCalculatedBoxInfo
|
|
|
|
{
|
|
|
|
public:
|
1999-12-02 01:07:27 +00:00
|
|
|
nsCalculatedBoxInfoImpl(nsIFrame* aFrame);
|
1999-11-18 21:05:43 +00:00
|
|
|
virtual ~nsCalculatedBoxInfoImpl();
|
|
|
|
nsCalculatedBoxInfoImpl(const nsBoxInfo& aInfo);
|
1999-12-02 01:07:27 +00:00
|
|
|
virtual void Clear();
|
1999-11-18 21:05:43 +00:00
|
|
|
};
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
/**
|
|
|
|
* The boxes private implementation
|
|
|
|
*/
|
|
|
|
class nsBoxFrameInner
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsBoxFrameInner(nsBoxFrame* aThis)
|
|
|
|
{
|
|
|
|
mOuter = aThis;
|
1999-09-10 02:22:46 +00:00
|
|
|
mDebugInner = nsnull;
|
1999-11-18 21:05:43 +00:00
|
|
|
mInfoList = new nsInfoListImpl();
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
~nsBoxFrameInner()
|
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
delete mDebugInner;
|
1999-11-18 21:05:43 +00:00
|
|
|
delete mInfoList;
|
1999-09-10 00:57:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void GetDebugInset(nsMargin& inset);
|
1999-11-24 06:03:41 +00:00
|
|
|
void AdjustChildren(nsIPresContext* aPresContext, nsBoxFrame* aBox);
|
1999-10-12 00:16:06 +00:00
|
|
|
nsresult GetContentOf(nsIFrame* aFrame, nsIContent** aContent);
|
1999-12-02 01:07:27 +00:00
|
|
|
void SanityCheck();
|
1999-08-27 06:06:39 +00: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-09 22:02:40 +00:00
|
|
|
nsresult FlowChildren(nsIPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsIFrame*& aIncrementalChild,
|
2000-02-14 01:42:09 +00:00
|
|
|
nsRect& aRect,
|
|
|
|
nsSize& aActualSize,
|
|
|
|
nscoord& aMaxAscent);
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
nsresult FlowChildAt(nsIFrame* frame,
|
|
|
|
nsIPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsCalculatedBoxInfo& aInfo,
|
|
|
|
nscoord aX,
|
|
|
|
nscoord aY,
|
|
|
|
PRBool aMoveFrame,
|
|
|
|
nsIFrame*& aIncrementalChild,
|
|
|
|
PRBool& needsRedraw,
|
|
|
|
const nsString& aReason);
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
void PlaceChild(nsIPresContext* aPresContext, nsIFrame* aFrame, nscoord aX, nscoord aY);
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
void UpdatePseudoElements(nsIPresContext* aPresContext);
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
void TranslateEventCoords(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsPoint& aResult);
|
|
|
|
|
|
|
|
static void InvalidateCachesTo(nsIFrame* aTargetFrame);
|
|
|
|
static void InvalidateAllCachesBelow(nsIPresContext* aPresContext, nsIFrame* aTargetFrame);
|
|
|
|
static PRBool AdjustTargetToScope(nsIFrame* aParent, nsIFrame*& aTargetFrame);
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nsBoxFrame::Halignment GetHAlign();
|
|
|
|
nsBoxFrame::Valignment GetVAlign();
|
2000-02-16 23:00:52 +00:00
|
|
|
void InitializeReflowState(nsIPresContext* aPresContext, const nsCalculatedBoxInfo& aInfo, nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aParentReflowState, nsIFrame* aFrame, const nsSize& aAvailSize, nsReflowReason reason);
|
|
|
|
void CreateResizedArray(PRBool*& aResized, PRInt32 aCount);
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
void MakeReason(nsIFrame* aFrame, const nsString& aText, nsString& aReason);
|
|
|
|
void AddIndents();
|
|
|
|
#endif
|
|
|
|
|
1999-08-27 06:06:39 +00:00
|
|
|
nsCOMPtr<nsISpaceManager> mSpaceManager; // We own this [OWNER].
|
1999-09-10 00:57:01 +00:00
|
|
|
nsBoxFrame* mOuter;
|
1999-09-10 02:22:46 +00:00
|
|
|
nsBoxDebugInner* mDebugInner;
|
1999-11-18 21:05:43 +00:00
|
|
|
nsInfoListImpl* mInfoList;
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
// XXX make these flags!
|
|
|
|
nscoord mInnerSize;
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nsBoxFrame::Valignment mValign;
|
|
|
|
nsBoxFrame::Halignment mHalign;
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
PRInt32 reflowCount;
|
|
|
|
#endif
|
1999-08-27 06:06:39 +00: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-09 22:02:40 +00:00
|
|
|
#define GET_WIDTH(size) (IsHorizontal() ? size.width : size.height)
|
|
|
|
#define GET_HEIGHT(size) (IsHorizontal() ? size.height : size.width)
|
|
|
|
|
|
|
|
#define SET_WIDTH(size, coord) if (IsHorizontal()) { (size).width = (coord); } else { (size).height = (coord); }
|
|
|
|
#define SET_HEIGHT(size, coord) if (IsHorizontal()) { (size).height = (coord); } else { (size).width = (coord); }
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
nsIFrame* nsBoxDebugInner::mDebugChild = nsnull;
|
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
nsresult
|
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-09 22:02:40 +00:00
|
|
|
NS_NewBoxFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-05-11 22:03:29 +00:00
|
|
|
NS_PRECONDITION(aNewFrame, "null OUT ptr");
|
|
|
|
if (nsnull == aNewFrame) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
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-09 22:02:40 +00:00
|
|
|
nsBoxFrame* it = new (aPresShell) nsBoxFrame();
|
1999-03-27 01:35:55 +00:00
|
|
|
if (nsnull == it)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
1999-05-11 22:03:29 +00:00
|
|
|
*aNewFrame = it;
|
1999-03-27 01:35:55 +00:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
} // NS_NewBoxFrame
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
nsBoxFrame::nsBoxFrame()
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-09-10 00:57:01 +00:00
|
|
|
mInner = new nsBoxFrameInner(this);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// if not otherwise specified boxes by default are horizontal.
|
2000-02-14 01:42:09 +00:00
|
|
|
mState |= NS_STATE_IS_HORIZONTAL;
|
|
|
|
mState |= NS_STATE_AUTO_STRETCH;
|
2000-02-16 23:00:52 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
mInner->mValign = nsBoxFrame::vAlign_Top;
|
|
|
|
mInner->mHalign = nsBoxFrame::hAlign_Left;
|
|
|
|
mInner->mInnerSize = 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-09 22:02:40 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
mInner->reflowCount = 100;
|
|
|
|
#endif
|
1999-08-27 06:06:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsBoxFrame::~nsBoxFrame()
|
|
|
|
{
|
1999-09-10 00:57:01 +00:00
|
|
|
delete mInner;
|
1999-03-27 01:35:55 +00: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-09 22:02:40 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsBoxFrame::InvalidateCache(nsIFrame* aChild)
|
|
|
|
{
|
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
|
|
|
|
|
|
|
// if the child is null then blow away all caches. Otherwise just blow away the
|
|
|
|
// specified kids cache.
|
|
|
|
if (aChild == nsnull) {
|
|
|
|
while(info != nsnull) {
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_NEEDS_RECALC;
|
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-09 22:02:40 +00:00
|
|
|
info = info->next;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
while(info != nsnull) {
|
|
|
|
if (info->frame == aChild) {
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_NEEDS_RECALC;
|
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-09 22:02:40 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
info = info->next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsBoxFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aChildList)
|
|
|
|
{
|
|
|
|
mInner->SanityCheck();
|
|
|
|
|
|
|
|
nsresult r = nsHTMLContainerFrame::SetInitialChildList(aPresContext, aListName, aChildList);
|
|
|
|
|
|
|
|
// initialize our list of infos.
|
|
|
|
mInner->mInfoList->Init(aChildList);
|
|
|
|
|
|
|
|
mInner->SanityCheck();
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
PRBool nsBoxFrame::IsHorizontal() const
|
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
return mState & NS_STATE_IS_HORIZONTAL;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
/**
|
|
|
|
* Initialize us. This is a good time to get the alignment of the box
|
|
|
|
*/
|
1999-03-27 01:35:55 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::Init(nsIPresContext* aPresContext,
|
1999-03-27 01:35:55 +00:00
|
|
|
nsIContent* aContent,
|
|
|
|
nsIFrame* aParent,
|
|
|
|
nsIStyleContext* aContext,
|
|
|
|
nsIFrame* aPrevInFlow)
|
|
|
|
{
|
|
|
|
nsresult rv = nsHTMLContainerFrame::Init(aPresContext, aContent, aParent, aContext, aPrevInFlow);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
nsSpaceManager* spaceManager = new nsSpaceManager(this);
|
|
|
|
mInner->mSpaceManager = spaceManager;
|
2000-01-08 02:18:14 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
mInner->mValign = nsBoxFrame::vAlign_Top;
|
|
|
|
mInner->mHalign = nsBoxFrame::hAlign_Left;
|
|
|
|
|
|
|
|
GetInitialVAlignment(mInner->mValign);
|
|
|
|
GetInitialHAlignment(mInner->mHalign);
|
|
|
|
|
|
|
|
PRBool orient = mState & NS_STATE_IS_HORIZONTAL;
|
|
|
|
GetInitialOrientation(orient);
|
|
|
|
if (orient)
|
|
|
|
mState |= NS_STATE_IS_HORIZONTAL;
|
|
|
|
else
|
|
|
|
mState &= ~NS_STATE_IS_HORIZONTAL;
|
|
|
|
|
2000-01-08 02:18:14 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
PRBool autostretch = mState & NS_STATE_AUTO_STRETCH;
|
|
|
|
GetInitialAutoStretch(autostretch);
|
|
|
|
if (autostretch)
|
|
|
|
mState |= NS_STATE_AUTO_STRETCH;
|
|
|
|
else
|
|
|
|
mState &= ~NS_STATE_AUTO_STRETCH;
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsBoxFrame::GetDefaultFlex(PRInt32& aFlex)
|
|
|
|
{
|
|
|
|
aFlex = 0;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign)
|
|
|
|
{
|
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-09 22:02:40 +00:00
|
|
|
nsString value;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mInner->GetContentOf(this, getter_AddRefs(content));
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, value)) {
|
|
|
|
if (value.EqualsIgnoreCase("left")) {
|
|
|
|
aHalign = nsBoxFrame::hAlign_Left;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("center")) {
|
|
|
|
aHalign = nsBoxFrame::hAlign_Center;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("right")) {
|
|
|
|
aHalign = nsBoxFrame::hAlign_Right;
|
|
|
|
return 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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
// look at vertical alignment
|
|
|
|
const nsStyleText* textStyle =
|
|
|
|
(const nsStyleText*)mStyleContext->GetStyleData(eStyleStruct_Text);
|
|
|
|
|
|
|
|
switch (textStyle->mTextAlign)
|
|
|
|
{
|
|
|
|
|
|
|
|
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
|
|
|
aHalign = nsBoxFrame::hAlign_Right;
|
|
|
|
return PR_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_TEXT_ALIGN_CENTER:
|
|
|
|
aHalign = nsBoxFrame::hAlign_Center;
|
|
|
|
return PR_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
aHalign = nsBoxFrame::hAlign_Left;
|
|
|
|
return PR_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign)
|
|
|
|
{
|
|
|
|
|
|
|
|
nsString value;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mInner->GetContentOf(this, getter_AddRefs(content));
|
|
|
|
|
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::valign, value)) {
|
|
|
|
if (value.EqualsIgnoreCase("top")) {
|
|
|
|
aValign = nsBoxFrame::vAlign_Top;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("baseline")) {
|
|
|
|
aValign = nsBoxFrame::vAlign_BaseLine;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("middle")) {
|
|
|
|
aValign = nsBoxFrame::vAlign_Middle;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("bottom")) {
|
|
|
|
aValign = nsBoxFrame::vAlign_Bottom;
|
|
|
|
return 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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
// look at vertical alignment
|
|
|
|
const nsStyleText* textStyle =
|
|
|
|
(const nsStyleText*)mStyleContext->GetStyleData(eStyleStruct_Text);
|
|
|
|
|
|
|
|
if (textStyle->mVerticalAlign.GetUnit() == eStyleUnit_Enumerated) {
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
PRInt32 type = textStyle->mVerticalAlign.GetIntValue();
|
2000-02-14 01:42:09 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
switch (type)
|
2000-02-14 01:42:09 +00:00
|
|
|
{
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BASELINE:
|
|
|
|
aValign = nsBoxFrame::vAlign_BaseLine;
|
|
|
|
return PR_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_TOP:
|
|
|
|
aValign = nsBoxFrame::vAlign_Top;
|
|
|
|
return PR_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
|
|
|
aValign = nsBoxFrame::vAlign_Bottom;
|
|
|
|
return PR_TRUE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
|
|
|
aValign = nsBoxFrame::vAlign_Middle;
|
|
|
|
return PR_TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return PR_FALSE;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
/* Returns true if it was set.
|
1999-11-18 21:05:43 +00:00
|
|
|
*/
|
|
|
|
PRBool
|
2000-02-14 01:42:09 +00:00
|
|
|
nsBoxFrame::GetInitialOrientation(PRBool& aIsHorizontal)
|
1999-11-18 21:05:43 +00:00
|
|
|
{
|
|
|
|
// see if we are a vertical or horizontal box.
|
1999-03-27 01:35:55 +00:00
|
|
|
nsString value;
|
1999-10-12 00:16:06 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mInner->GetContentOf(this, getter_AddRefs(content));
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::orient, value))
|
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
if (value.EqualsIgnoreCase("vertical")) {
|
|
|
|
aIsHorizontal = PR_FALSE;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("horizontal")) {
|
|
|
|
aIsHorizontal = 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-09 22:02:40 +00:00
|
|
|
return PR_TRUE;
|
2000-02-14 01:42:09 +00: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-09 22:02:40 +00:00
|
|
|
} else {
|
|
|
|
// depricated, use align
|
2000-02-14 01:42:09 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, value)) {
|
|
|
|
if (value.EqualsIgnoreCase("vertical")) {
|
|
|
|
aIsHorizontal = PR_FALSE;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("horizontal")) {
|
|
|
|
aIsHorizontal = PR_TRUE;
|
|
|
|
return 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-09 22:02:40 +00:00
|
|
|
}
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Returns true if it was set.
|
|
|
|
*/
|
|
|
|
PRBool
|
|
|
|
nsBoxFrame::GetInitialAutoStretch(PRBool& aStretch)
|
|
|
|
{
|
|
|
|
nsString value;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mInner->GetContentOf(this, getter_AddRefs(content));
|
|
|
|
|
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::autostretch, value))
|
|
|
|
{
|
|
|
|
if (value.EqualsIgnoreCase("never")) {
|
|
|
|
aStretch = PR_FALSE;
|
|
|
|
return PR_TRUE;
|
|
|
|
} else if (value.EqualsIgnoreCase("always")) {
|
|
|
|
aStretch = PR_TRUE;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return PR_FALSE;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
1999-07-02 05:28:32 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
nsInfoList*
|
|
|
|
nsBoxFrame::GetInfoList()
|
|
|
|
{
|
|
|
|
return mInner->mInfoList;
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
void
|
|
|
|
nsBoxFrame::GetInnerRect(nsRect& aInner)
|
|
|
|
{
|
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
|
1999-10-20 00:46:21 +00:00
|
|
|
GetStyleData(eStyleStruct_Spacing,
|
1999-09-10 00:57:01 +00:00
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
|
|
|
nsMargin border(0,0,0,0);
|
|
|
|
spacing->GetBorderPadding(border);
|
|
|
|
|
|
|
|
aInner = mRect;
|
|
|
|
aInner.x = 0;
|
|
|
|
aInner.y = 0;
|
|
|
|
aInner.Deflate(border);
|
|
|
|
|
|
|
|
border.SizeTo(0,0,0,0);
|
|
|
|
mInner->GetDebugInset(border);
|
|
|
|
aInner.Deflate(border);
|
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
/**
|
|
|
|
* Looks at the given frame and sees if its redefined preferred, min, or max sizes
|
|
|
|
* if so it used those instead. Currently it gets its values from css
|
|
|
|
*/
|
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::GetRedefinedMinPrefMax(nsIPresContext* aPresContext, nsIFrame* aFrame, nsCalculatedBoxInfo& aSize)
|
1999-03-27 01:35:55 +00: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-09 22:02:40 +00:00
|
|
|
// add in the css min, max, pref
|
1999-05-09 21:46:24 +00:00
|
|
|
const nsStylePosition* position;
|
1999-10-20 00:46:21 +00:00
|
|
|
aFrame->GetStyleData(eStyleStruct_Position,
|
1999-05-09 21:46:24 +00:00
|
|
|
(const nsStyleStruct*&) position);
|
|
|
|
|
|
|
|
// see if the width or height was specifically set
|
|
|
|
if (position->mWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
aSize.prefSize.width = position->mWidth.GetCoordValue();
|
2000-02-14 01:42:09 +00:00
|
|
|
//aSize.prefWidthIntrinsic = PR_FALSE;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
if (position->mHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
aSize.prefSize.height = position->mHeight.GetCoordValue();
|
2000-02-14 01:42:09 +00:00
|
|
|
//aSize.prefHeightIntrinsic = PR_FALSE;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// same for min size. Unfortunately min size is always set to 0. So for now
|
|
|
|
// we will assume 0 means not set.
|
|
|
|
if (position->mMinWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinWidth.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
aSize.minSize.width = min;
|
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
if (position->mMinHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinHeight.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
aSize.minSize.height = min;
|
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// and max
|
|
|
|
if (position->mMaxWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord max = position->mMaxWidth.GetCoordValue();
|
|
|
|
aSize.maxSize.width = max;
|
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
if (position->mMaxHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord max = position->mMaxHeight.GetCoordValue();
|
|
|
|
aSize.maxSize.height = max;
|
|
|
|
}
|
1999-04-12 21:48:21 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// get the flexibility
|
|
|
|
nsCOMPtr<nsIContent> content;
|
2000-02-14 01:42:09 +00:00
|
|
|
aFrame->GetContent(getter_AddRefs(content));
|
1999-04-12 21:48:21 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (content) {
|
|
|
|
PRInt32 error;
|
|
|
|
nsAutoString value;
|
1999-04-12 21:48:21 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value))
|
|
|
|
{
|
|
|
|
value.Trim("%");
|
|
|
|
aSize.flex = value.ToInteger(&error);
|
|
|
|
}
|
1999-08-30 22:32:25 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, value))
|
|
|
|
{
|
|
|
|
float p2t;
|
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-09-13 20:24:20 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
value.Trim("%");
|
1999-09-13 20:24:20 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
aSize.prefSize.width = NSIntPixelsToTwips(value.ToInteger(&error), p2t);
|
|
|
|
}
|
1999-08-30 22:32:25 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, value))
|
|
|
|
{
|
|
|
|
float p2t;
|
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-09-13 20:24:20 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
value.Trim("%");
|
1999-09-13 20:24:20 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
aSize.prefSize.height = NSIntPixelsToTwips(value.ToInteger(&error), p2t);
|
|
|
|
}
|
1999-08-30 22:32:25 +00: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-09 22:02:40 +00:00
|
|
|
|
|
|
|
// make sure pref size is inside min and max values.
|
|
|
|
if (aSize.prefSize.width < aSize.minSize.width)
|
|
|
|
aSize.prefSize.width = aSize.minSize.width;
|
|
|
|
|
|
|
|
if (aSize.prefSize.height < aSize.minSize.height)
|
|
|
|
aSize.prefSize.height = aSize.minSize.height;
|
|
|
|
|
|
|
|
if (aSize.prefSize.width > aSize.maxSize.width)
|
|
|
|
aSize.prefSize.width = aSize.maxSize.width;
|
|
|
|
|
|
|
|
if (aSize.prefSize.height > aSize.maxSize.height)
|
|
|
|
aSize.prefSize.height = aSize.maxSize.height;
|
|
|
|
|
|
|
|
|
|
|
|
// if we are not flexible then our min, max, and pref sizes are all the same.
|
|
|
|
// if (aSize.flex == 0) {
|
|
|
|
// SET_WIDTH(aSize.minSize, GET_WIDTH(aSize.prefSize));
|
|
|
|
/// SET_WIDTH(aSize.maxSize, GET_WIDTH(aSize.prefSize));
|
|
|
|
/// }
|
|
|
|
|
1999-04-12 21:48:21 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
/**
|
|
|
|
* Given a frame gets its box info. If it does not have a box info then it will merely
|
|
|
|
* get the normally defined min, pref, max stuff.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
nsresult
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::GetChildBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsIFrame* aFrame, nsCalculatedBoxInfo& aSize)
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
aSize.Clear();
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
// see if the frame Innerements IBox interface
|
1999-07-02 04:02:48 +00:00
|
|
|
|
|
|
|
// since frames are not refCounted, don't use nsCOMPtr with them
|
1999-05-09 21:46:24 +00:00
|
|
|
// if it does ask it for its BoxSize and we are done
|
1999-12-23 23:44:56 +00:00
|
|
|
nsIBox* ibox = nsnull;
|
2000-02-02 22:24:56 +00:00
|
|
|
if (NS_SUCCEEDED(aFrame->QueryInterface(NS_GET_IID(nsIBox), (void**)&ibox)) && ibox) {
|
1999-05-09 21:46:24 +00:00
|
|
|
ibox->GetBoxInfo(aPresContext, aReflowState, aSize);
|
2000-02-16 23:00:52 +00:00
|
|
|
aSize.mFlags |= NS_FRAME_IS_BOX;
|
1999-05-09 21:46:24 +00:00
|
|
|
// add in the border, padding, width, min, max
|
1999-09-05 20:46:59 +00:00
|
|
|
GetRedefinedMinPrefMax(aPresContext, aFrame, aSize);
|
1999-05-09 21:46:24 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-03-31 08:04:37 +00: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-09 22:02:40 +00:00
|
|
|
// so the child is not a box. So we will have to be creative. We need to get its min, max, and preferred
|
|
|
|
// sizes. Min and Max are easy you get them for CSS. But preferred size? First we will see if they are set in
|
|
|
|
// css. If not we will have to flow the child intrinically.
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// start the preferred size as intrinsic
|
|
|
|
aSize.prefSize.width = NS_INTRINSICSIZE;
|
|
|
|
aSize.prefSize.height = NS_INTRINSICSIZE;
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// redefine anything depending on css
|
1999-09-05 20:46:59 +00:00
|
|
|
GetRedefinedMinPrefMax(aPresContext, aFrame, aSize);
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-07-23 23:30:17 +00:00
|
|
|
// if we are still intrinsically sized the flow to get the size otherwise
|
|
|
|
// we are done.
|
1999-07-27 19:06:44 +00:00
|
|
|
if (aSize.prefSize.width == NS_INTRINSICSIZE || aSize.prefSize.height == NS_INTRINSICSIZE)
|
1999-11-18 21:05:43 +00:00
|
|
|
{
|
|
|
|
// subtract out the childs margin and border
|
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
nsresult rv = aFrame->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
1999-07-23 23:30:17 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
NS_ASSERTION(rv == NS_OK,"failed to get spacing");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
1999-10-21 20:17:51 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
nsMargin margin(0,0,0,0);;
|
|
|
|
spacing->GetMargin(margin);
|
|
|
|
nsMargin border(0,0,0,0);
|
|
|
|
spacing->GetBorderPadding(border);
|
|
|
|
nsMargin total = margin + border;
|
1999-07-23 23:30:17 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// add in childs margin and border
|
|
|
|
if (aSize.prefSize.width != NS_INTRINSICSIZE)
|
|
|
|
aSize.prefSize.width += (total.left + total.right);
|
1999-07-23 23:30:17 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
if (aSize.prefSize.height != NS_INTRINSICSIZE)
|
|
|
|
aSize.prefSize.height += (total.top + total.bottom);
|
1999-07-23 23:30:17 +00: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-09 22:02:40 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// flow child at preferred size
|
|
|
|
nsHTMLReflowMetrics desiredSize(nsnull);
|
1999-07-23 23:30:17 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
aSize.calculatedSize = aSize.prefSize;
|
1999-07-23 23:30:17 +00: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-09 22:02:40 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
nsReflowStatus status;
|
|
|
|
PRBool redraw;
|
|
|
|
nsString reason("To get pref size");
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
nsHTMLReflowState state(aReflowState);
|
2000-02-10 21:36:28 +00:00
|
|
|
state.availableWidth = NS_INTRINSICSIZE;
|
|
|
|
state.availableHeight = NS_INTRINSICSIZE;
|
|
|
|
state.reason = eReflowReason_Resize;
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
nsIFrame* incrementalChild = nsnull;
|
|
|
|
|
|
|
|
mInner->FlowChildAt(aFrame, aPresContext, desiredSize, state, status, aSize, 0, 0, PR_FALSE, incrementalChild, redraw, reason);
|
1999-07-23 23:30:17 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// remove margin and border
|
|
|
|
desiredSize.height -= (total.top + total.bottom);
|
|
|
|
desiredSize.width -= (total.left + total.right);
|
1999-07-23 23:30:17 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// get the size returned and the it as the preferredsize.
|
|
|
|
aSize.prefSize.width = desiredSize.width;
|
|
|
|
aSize.prefSize.height = desiredSize.height;
|
2000-02-14 01:42:09 +00:00
|
|
|
aSize.ascent = desiredSize.ascent;
|
1999-11-18 21:05:43 +00: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-09 22:02:40 +00:00
|
|
|
// aSize.prefSize.width = 0;
|
|
|
|
// aSize.prefSize.height = 0;
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// redefine anything depending on css
|
|
|
|
GetRedefinedMinPrefMax(aPresContext, aFrame, aSize);
|
1999-07-23 23:30:17 +00:00
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
return NS_OK;
|
1999-03-27 01:35:55 +00: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-09 22:02:40 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsBoxFrame::ReflowDirtyChild(nsIPresShell* aPresShell, nsIFrame* aChild)
|
|
|
|
{
|
|
|
|
InvalidateCache(aChild);
|
|
|
|
|
|
|
|
// if we are not dirty mark ourselves dirty and tell our parent we are dirty too.
|
|
|
|
if (!(mState & NS_FRAME_IS_DIRTY)) {
|
|
|
|
// Mark yourself as dirty
|
|
|
|
mState |= NS_FRAME_IS_DIRTY;
|
|
|
|
return mParent->ReflowDirtyChild(aPresShell, this);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
|
|
|
|
PRInt32 gIndent = 0;
|
|
|
|
PRInt32 gReflows = 0;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
nsIBox::HandleRootBoxReflow(nsIPresContext* aPresContext,
|
|
|
|
nsIFrame* aBox,
|
|
|
|
const nsHTMLReflowState& aReflowState)
|
|
|
|
{
|
|
|
|
// if its an incremental reflow
|
|
|
|
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 (aBox != targetFrame) {
|
|
|
|
// clear the caches down the chain
|
|
|
|
nsBoxFrameInner::InvalidateCachesTo(targetFrame);
|
|
|
|
|
|
|
|
// if the type is style changed then make sure we
|
|
|
|
// invalidate all caches under the target
|
|
|
|
if (reflowType == nsIReflowCommand::StyleChanged)
|
|
|
|
nsBoxFrameInner::InvalidateAllCachesBelow(aPresContext, targetFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
/**
|
|
|
|
* Ok what we want to do here is get all the children, figure out
|
|
|
|
* their flexibility, preferred, min, max sizes and then stretch or
|
|
|
|
* shrink them to fit in the given space.
|
|
|
|
*
|
|
|
|
* So we will have 3 passes.
|
1999-05-09 21:46:24 +00:00
|
|
|
* 1) get our min,max,preferred size.
|
|
|
|
* 2) flow all our children to fit into the size we are given layout in
|
1999-03-27 01:35:55 +00:00
|
|
|
* 3) move all the children to the right locations.
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::Reflow(nsIPresContext* aPresContext,
|
1999-03-27 01:35:55 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus)
|
|
|
|
{
|
1999-07-23 00:11:21 +00: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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
gIndent++;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
|
|
|
|
1999-07-02 05:28:32 +00:00
|
|
|
// If we have a space manager, then set it in the reflow state
|
1999-09-10 00:57:01 +00:00
|
|
|
if (mInner->mSpaceManager) {
|
1999-07-02 05:28:32 +00:00
|
|
|
// Modify the reflow state and set the space manager
|
|
|
|
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
|
1999-09-10 00:57:01 +00:00
|
|
|
reflowState.mSpaceManager = mInner->mSpaceManager;
|
1999-07-02 05:28:32 +00:00
|
|
|
|
|
|
|
// Clear the spacemanager's regions.
|
1999-09-10 00:57:01 +00:00
|
|
|
mInner->mSpaceManager->ClearRegions();
|
1999-07-02 05:28:32 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
//--------------------------------------------------------------------
|
|
|
|
//-------------- figure out the rect we need to fit into -------------
|
|
|
|
//--------------------------------------------------------------------
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// this is the size of our box. Remember to subtract our our border. The size we are given
|
|
|
|
// does not include it. So we have to adjust our rect accordingly.
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
nscoord x = aReflowState.mComputedBorderPadding.left;
|
|
|
|
nscoord y = aReflowState.mComputedBorderPadding.top;
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-07-20 03:41:03 +00:00
|
|
|
nsRect rect(x,y,aReflowState.mComputedWidth,aReflowState.mComputedHeight);
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
//------- handle incremental reflow --------------------
|
|
|
|
//---------------------------------------------------------
|
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-09 22:02:40 +00:00
|
|
|
nsIFrame* incrementalChild = nsnull;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_FRAME_FIRST_REFLOW) {
|
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-09 22:02:40 +00:00
|
|
|
// on the initial reflow see if we are the root box.
|
|
|
|
// the root box.
|
2000-02-14 01:42:09 +00:00
|
|
|
mState |= NS_STATE_IS_ROOT;
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
// see if we are the root box
|
|
|
|
nsIFrame* parent = mParent;
|
|
|
|
while (parent) {
|
|
|
|
nsIBox* ibox = nsnull;
|
|
|
|
if (NS_SUCCEEDED(parent->QueryInterface(nsIBox::GetIID(), (void**)&ibox)) && ibox) {
|
2000-02-14 01:42:09 +00:00
|
|
|
mState &= ~NS_STATE_IS_ROOT;
|
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-09 22:02:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
parent->GetParent(&parent);
|
|
|
|
}
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
if (mState & NS_STATE_IS_ROOT) {
|
2000-02-17 04:10:02 +00:00
|
|
|
|
|
|
|
// see if someone turned on debugging
|
|
|
|
PRBool debug = PR_FALSE;
|
2000-02-14 01:42:09 +00:00
|
|
|
nsCOMPtr<nsIPref> pref;
|
|
|
|
aPresContext->GetPrefs(getter_AddRefs(pref));
|
|
|
|
if (pref) {
|
2000-02-17 04:10:02 +00:00
|
|
|
pref->GetBoolPref("xul.debug.box", &debug);
|
2000-02-14 01:42:09 +00:00
|
|
|
}
|
|
|
|
|
2000-02-17 04:10:02 +00:00
|
|
|
if (debug)
|
|
|
|
nsBoxDebugInner::gDebug++;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
2000-02-10 21:36:28 +00:00
|
|
|
printf("-------- BOX IS ROOT --------\n");
|
2000-02-12 01:25:55 +00:00
|
|
|
#endif
|
2000-02-14 01:42:09 +00:00
|
|
|
}
|
2000-02-10 21:36:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( aReflowState.reason == eReflowReason_Incremental ) {
|
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-09 22:02:40 +00:00
|
|
|
nsIReflowCommand::ReflowType reflowType;
|
|
|
|
aReflowState.reflowCommand->GetType(reflowType);
|
|
|
|
|
|
|
|
// See if it's targeted at us
|
|
|
|
nsIFrame* targetFrame;
|
|
|
|
aReflowState.reflowCommand->GetTarget(targetFrame);
|
|
|
|
|
|
|
|
if (this == targetFrame) {
|
|
|
|
// if we are the target see what the type was
|
|
|
|
// and generate a normal non incremental reflow.
|
|
|
|
switch (reflowType) {
|
|
|
|
|
|
|
|
case nsIReflowCommand::StyleChanged:
|
|
|
|
{
|
|
|
|
nsHTMLReflowState newState(aReflowState);
|
|
|
|
newState.reason = eReflowReason_StyleChange;
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
gIndent--;
|
|
|
|
#endif
|
|
|
|
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;
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
gIndent--;
|
|
|
|
#endif
|
|
|
|
return Reflow(aPresContext, aDesiredSize, newState, aStatus);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
NS_ASSERTION(PR_FALSE, "unexpected reflow command type");
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
// ok we are not the target, see if our parent is a box. If its not then we
|
|
|
|
// are the first box so its our responsibility
|
|
|
|
// to blow away the caches for each child in the incremental
|
|
|
|
// reflow chain. only mark those children whose parents are boxes
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_ROOT) {
|
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-09 22:02:40 +00:00
|
|
|
HandleRootBoxReflow(aPresContext, this, aReflowState);
|
2000-02-14 01:42:09 +00: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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// then get the child we need to flow incrementally
|
|
|
|
aReflowState.reflowCommand->GetNext(incrementalChild);
|
1999-07-23 23:30:17 +00: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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
if (aReflowState.reason == eReflowReason_Initial )
|
|
|
|
{
|
2000-02-17 04:10:02 +00:00
|
|
|
if (nsBoxDebugInner::gDebug > 0) {
|
2000-02-14 01:42:09 +00:00
|
|
|
if (!mInner->mDebugInner) {
|
|
|
|
mInner->mDebugInner = new nsBoxDebugInner(this);
|
|
|
|
mInner->UpdatePseudoElements(aPresContext);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (mInner->mDebugInner)
|
|
|
|
{
|
|
|
|
delete mInner->mDebugInner;
|
|
|
|
mInner->mDebugInner = nsnull;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_ROOT)
|
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-09 22:02:40 +00:00
|
|
|
printf("--------REFLOW %d--------\n", gReflows++);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-07-14 17:32:43 +00:00
|
|
|
#if 0
|
|
|
|
ListTag(stdout);
|
|
|
|
printf(": begin reflow reason=%s",
|
|
|
|
aReflowState.reason == eReflowReason_Incremental ? "incremental" : "other");
|
|
|
|
if (incrementalChild) { printf(" frame="); nsFrame::ListTag(stdout, incrementalChild); }
|
|
|
|
printf("\n");
|
|
|
|
#endif
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
//------------------------------------------------------------------------------------------------
|
|
|
|
//------- Figure out what our box size is. This will calculate our children's sizes as well ------
|
|
|
|
//------------------------------------------------------------------------------------------------
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// get our size. This returns a boxSize that contains our min, max, pref sizes. It also
|
|
|
|
// calculates all of our children sizes as well. It does not include our border we will have to include that
|
|
|
|
// later
|
|
|
|
nsBoxInfo ourSize;
|
|
|
|
GetBoxInfo(aPresContext, aReflowState, ourSize);
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
//------------------------------------------------------------------------------------------------
|
|
|
|
//------- Make sure the space we need to layout into adhears to our min, max, pref sizes ------
|
|
|
|
//------------------------------------------------------------------------------------------------
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
BoundsCheck(ourSize, rect);
|
|
|
|
|
|
|
|
// subtract out the insets. Insets are so subclasses like toolbars can wedge controls in and around the
|
|
|
|
// box. GetBoxInfo automatically adds them in. But we want to know the size we need to layout our children
|
|
|
|
// in so lets subtract them our for now.
|
|
|
|
nsMargin inset(0,0,0,0);
|
|
|
|
GetInset(inset);
|
1999-03-30 08:11:00 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
nsMargin debugInset(0,0,0,0);
|
|
|
|
mInner->GetDebugInset(debugInset);
|
|
|
|
inset += debugInset;
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
rect.Deflate(inset);
|
1999-03-29 01:45:34 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
//-----------------------------------------------------------------------------------
|
|
|
|
//------------------------- figure our our children's sizes -------------------------
|
|
|
|
//-----------------------------------------------------------------------------------
|
1999-03-30 08:11:00 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// now that we know our child's min, max, pref sizes. Stretch our children out to fit into our size.
|
|
|
|
// this will calculate each of our childs sizes.
|
|
|
|
InvalidateChildren();
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
nscoord maxAscent;
|
|
|
|
|
|
|
|
LayoutChildrenInRect(rect, maxAscent);
|
|
|
|
|
1999-03-29 01:45:34 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
//-----------------------------------------------------------------------------------
|
|
|
|
//------------------------- flow all the children -----------------------------------
|
|
|
|
//-----------------------------------------------------------------------------------
|
1999-03-31 08:04:37 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
// get the layout rect.
|
|
|
|
nsRect layoutRect = rect;
|
|
|
|
|
|
|
|
// set up our actual size
|
|
|
|
layoutRect.Inflate(inset);
|
|
|
|
|
|
|
|
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE && layoutRect.width < aReflowState.mComputedWidth)
|
|
|
|
layoutRect.width = aReflowState.mComputedWidth;
|
|
|
|
|
|
|
|
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE && layoutRect.height < aReflowState.mComputedHeight)
|
|
|
|
layoutRect.height = aReflowState.mComputedHeight;
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
nsRect actualRect(layoutRect);
|
|
|
|
actualRect.Deflate(inset);
|
2000-02-14 01:42:09 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
nsSize actualSize(actualRect.width, actualRect.height);
|
2000-02-14 01:42:09 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
// flow each child at the new sizes we have calculated. With the actual size we are giving them to layout our and the
|
|
|
|
// size of the rect they were computed to layout in.
|
|
|
|
mInner->FlowChildren(aPresContext, aDesiredSize, aReflowState, aStatus, incrementalChild, rect, actualSize, maxAscent);
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
//-----------------------------------------------------------------------------------
|
|
|
|
//------------------------- Add our border and insets in ----------------------------
|
|
|
|
//-----------------------------------------------------------------------------------
|
1999-03-31 08:04:37 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
// flow children may have changed the rect so lets use it.
|
1999-08-27 06:06:39 +00:00
|
|
|
rect.Inflate(inset);
|
|
|
|
|
1999-08-19 22:16:23 +00:00
|
|
|
if (aReflowState.mComputedWidth != NS_INTRINSICSIZE && rect.width < aReflowState.mComputedWidth)
|
|
|
|
rect.width = aReflowState.mComputedWidth;
|
|
|
|
|
|
|
|
if (aReflowState.mComputedHeight != NS_INTRINSICSIZE && rect.height < aReflowState.mComputedHeight)
|
|
|
|
rect.height = aReflowState.mComputedHeight;
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
rect.Inflate(aReflowState.mComputedBorderPadding);
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-08-27 06:06:39 +00:00
|
|
|
// the rect might have gotten bigger so recalc ourSize
|
1999-05-09 21:46:24 +00:00
|
|
|
aDesiredSize.width = rect.width;
|
|
|
|
aDesiredSize.height = rect.height;
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
aDesiredSize.ascent = aDesiredSize.height;
|
|
|
|
aDesiredSize.descent = 0;
|
|
|
|
|
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
|
|
|
|
1999-07-14 17:32:43 +00:00
|
|
|
#if 0
|
|
|
|
ListTag(stdout); printf(": reflow done\n");
|
|
|
|
#endif
|
1999-07-02 05:28:32 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
gIndent--;
|
|
|
|
#endif
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-04-28 00:13:44 +00: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-09 22:02:40 +00:00
|
|
|
void
|
|
|
|
nsBoxFrameInner::InvalidateCachesTo(nsIFrame* aTargetFrame)
|
|
|
|
{
|
|
|
|
// walk up the tree from the target frame to the root invalidating each childs cached layout infomation
|
|
|
|
|
|
|
|
nsIFrame* parent;
|
|
|
|
aTargetFrame->GetParent(&parent);
|
|
|
|
if (parent == nsnull)
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
InvalidateCachesTo(parent);
|
|
|
|
|
|
|
|
// only mark those children whose parents are boxes
|
|
|
|
nsIBox* ibox = nsnull;
|
|
|
|
if (NS_SUCCEEDED(parent->QueryInterface(nsIBox::GetIID(), (void**)&ibox)) && ibox) {
|
|
|
|
ibox->InvalidateCache(aTargetFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
nsBoxFrameInner::InvalidateAllCachesBelow(nsIPresContext* aPresContext, nsIFrame* aTargetFrame)
|
|
|
|
{
|
|
|
|
// walk the whole tree under the target frame and clear each childs cached layout information
|
|
|
|
// but make sure we only mark children whose parent is a box.
|
|
|
|
nsIBox* ibox = nsnull;
|
|
|
|
if (NS_FAILED(aTargetFrame->QueryInterface(nsIBox::GetIID(), (void**)&ibox))) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ibox->InvalidateCache(nsnull);
|
|
|
|
|
|
|
|
nsIFrame* child = nsnull;
|
|
|
|
aTargetFrame->FirstChild(aPresContext, nsnull, &child);
|
|
|
|
|
|
|
|
while (nsnull != child)
|
|
|
|
{
|
|
|
|
InvalidateAllCachesBelow(aPresContext, child);
|
|
|
|
nsresult rv = child->GetNextSibling(&child);
|
|
|
|
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-02-14 01:42:09 +00:00
|
|
|
nsBoxFrame::ComputeChildsNextPosition(nsCalculatedBoxInfo* aInfo, nscoord& aCurX, nscoord& aCurY, nscoord& aNextX, nscoord& aNextY, const nsSize& aCurrentChildSize, const nsRect& aBoxRect, nscoord aMaxAscent)
|
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-09 22:02:40 +00:00
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_HORIZONTAL) {
|
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-09 22:02:40 +00:00
|
|
|
aNextX = aCurX + aCurrentChildSize.width;
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
if (mState & NS_STATE_AUTO_STRETCH) {
|
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-09 22:02:40 +00:00
|
|
|
aCurY = aBoxRect.y;
|
2000-02-14 01:42:09 +00:00
|
|
|
} else {
|
|
|
|
switch (mInner->mValign)
|
|
|
|
{
|
|
|
|
case nsBoxFrame::vAlign_BaseLine:
|
|
|
|
aCurY = aBoxRect.y + (aMaxAscent - aInfo->ascent);
|
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-09 22:02:40 +00:00
|
|
|
break;
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
case nsBoxFrame::vAlign_Top:
|
|
|
|
aCurY = aBoxRect.y;
|
|
|
|
break;
|
|
|
|
case nsBoxFrame::vAlign_Middle:
|
|
|
|
aCurY = aBoxRect.y + (aBoxRect.height/2 - aCurrentChildSize.height/2);
|
|
|
|
break;
|
|
|
|
case nsBoxFrame::vAlign_Bottom:
|
|
|
|
aCurY = aBoxRect.y + aBoxRect.height - aCurrentChildSize.height;
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
aNextY = aCurY + aCurrentChildSize.height;
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_AUTO_STRETCH) {
|
|
|
|
aCurX = aBoxRect.x;
|
|
|
|
} else {
|
|
|
|
switch (mInner->mHalign)
|
|
|
|
{
|
|
|
|
case nsBoxFrame::hAlign_Left:
|
|
|
|
aCurX = aBoxRect.x;
|
|
|
|
break;
|
|
|
|
case nsBoxFrame::hAlign_Center:
|
|
|
|
aCurX = aBoxRect.x + (aBoxRect.width/2 - aCurrentChildSize.width/2);
|
|
|
|
break;
|
|
|
|
case nsBoxFrame::hAlign_Right:
|
|
|
|
aCurX = aBoxRect.x + aBoxRect.width - aCurrentChildSize.width;
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-04-28 00:13:44 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
/**
|
|
|
|
* When all the childrens positions have been calculated and layed out. Flow each child
|
|
|
|
* at its not size.
|
|
|
|
*/
|
|
|
|
nsresult
|
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-09 22:02:40 +00:00
|
|
|
nsBoxFrameInner::FlowChildren(nsIPresContext* aPresContext,
|
1999-05-09 21:46:24 +00:00
|
|
|
nsHTMLReflowMetrics& aDesiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& 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-09 22:02:40 +00:00
|
|
|
nsIFrame*& aIncrementalChild,
|
2000-02-14 01:42:09 +00:00
|
|
|
nsRect& aRect,
|
|
|
|
nsSize& aActualSize,
|
|
|
|
nscoord& aMaxAscent)
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
1999-07-23 00:11:21 +00: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-09 22:02:40 +00:00
|
|
|
// ------- set the childs positions ---------
|
|
|
|
|
|
|
|
PRBool redraw = PR_FALSE;
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
PRBool finished;
|
|
|
|
nscoord passes = 0;
|
|
|
|
nscoord changedIndex = -1;
|
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-09 22:02:40 +00:00
|
|
|
nsAutoString reason;
|
|
|
|
nsAutoString nextReason;
|
|
|
|
PRInt32 infoCount = mInfoList->GetCount();
|
2000-02-16 23:00:52 +00:00
|
|
|
PRBool* resized = nsnull;
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// ----------------------
|
|
|
|
// Flow all children
|
|
|
|
// ----------------------
|
1999-03-31 08:04:37 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// ok what we want to do if flow each child at the location given in the spring.
|
|
|
|
// unfortunately after flowing a child it might get bigger. We have not control over this
|
|
|
|
// so it the child gets bigger or smaller than we expected we will have to do a 2nd, 3rd, 4th pass to
|
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-09 22:02:40 +00:00
|
|
|
// adjust. When we adjust make sure the new reason is resize.
|
1999-03-29 01:45:34 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
changedIndex = -1;
|
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-09 22:02:40 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
passes = 0;
|
1999-03-27 01:35:55 +00:00
|
|
|
do
|
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-09 22:02:40 +00:00
|
|
|
{
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
if (passes > 0) {
|
|
|
|
AddIndents();
|
|
|
|
printf("ChildResized doing pass: %d\n", passes);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
finished = PR_TRUE;
|
|
|
|
nscoord count = 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-09 22:02:40 +00:00
|
|
|
nsCalculatedBoxInfo* info = mInfoList->GetFirst();
|
|
|
|
|
|
|
|
nscoord x = aRect.x;
|
|
|
|
nscoord y = aRect.y;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (!(mOuter->mState & NS_STATE_AUTO_STRETCH)) {
|
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL) {
|
|
|
|
switch(mHalign) {
|
|
|
|
case nsBoxFrame::hAlign_Left:
|
|
|
|
x = aRect.x;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsBoxFrame::hAlign_Center:
|
|
|
|
x = aRect.x + (aActualSize.width - aRect.width)/2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsBoxFrame::hAlign_Right:
|
|
|
|
x = aRect.x + (aActualSize.width - aRect.width);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
switch(mValign) {
|
|
|
|
case nsBoxFrame::vAlign_Top:
|
|
|
|
case nsBoxFrame::vAlign_BaseLine:
|
|
|
|
y = aRect.y;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsBoxFrame::vAlign_Middle:
|
|
|
|
y = aRect.y + (aActualSize.height - aRect.height)/2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case nsBoxFrame::vAlign_Bottom:
|
|
|
|
y = aRect.y + (aActualSize.height - aRect.height);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
while (nsnull != info)
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-12-02 01:07:27 +00: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-09 22:02:40 +00:00
|
|
|
nsIFrame* childFrame = info->frame;
|
|
|
|
|
|
|
|
NS_ASSERTION(info, "ERROR not info object!!");
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// if we reached the index that changed we are done.
|
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-09 22:02:40 +00:00
|
|
|
//if (count == changedIndex)
|
|
|
|
// break;
|
|
|
|
|
|
|
|
// make collapsed children not show up
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_IS_COLLAPSED) {
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
if (aReflowState.reason == eReflowReason_Initial)
|
|
|
|
{
|
|
|
|
FlowChildAt(childFrame, aPresContext, aDesiredSize, aReflowState, aStatus, *info, x, y, PR_TRUE, aIncrementalChild, redraw, reason);
|
|
|
|
|
|
|
|
// if the child got bigger then adjust our rect and all the children.
|
2000-02-16 23:00:52 +00:00
|
|
|
mOuter->ChildResized(childFrame, aDesiredSize, aRect, aMaxAscent, *info, resized, infoCount, changedIndex, finished, count, nextReason);
|
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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ok if we are collapsed make sure the view and all its children
|
|
|
|
// are collapsed as well.
|
|
|
|
|
|
|
|
nsRect rect(0,0,0,0);
|
|
|
|
childFrame->GetRect(rect);
|
|
|
|
if (rect.width > 0 || rect.height > 0)
|
|
|
|
{
|
|
|
|
childFrame->SizeTo(aPresContext, 0,0);
|
|
|
|
mOuter->CollapseChild(aPresContext, childFrame, PR_TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
nsRect rect(0,0,0,0);
|
|
|
|
childFrame->GetRect(rect);
|
|
|
|
if (rect.width > 0 || rect.height > 0) {
|
|
|
|
nsIView* view;
|
|
|
|
childFrame->GetView(aPresContext, &view);
|
|
|
|
if (view) {
|
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, childFrame,
|
|
|
|
view, nsnull);
|
|
|
|
} else {
|
|
|
|
// Re-position any child frame views
|
|
|
|
nsContainerFrame::PositionChildViews(aPresContext, childFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*/
|
1999-03-27 01:35:55 +00: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-09 22:02:40 +00:00
|
|
|
} else {
|
|
|
|
|
|
|
|
nscoord nextX = x;
|
|
|
|
nscoord nextY = y;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
mOuter->ComputeChildsNextPosition(info, x, y, nextX, nextY, info->calculatedSize, aRect, aMaxAscent);
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
// reflow if the child needs it or we are on a second pass
|
|
|
|
FlowChildAt(childFrame, aPresContext, aDesiredSize, aReflowState, aStatus, *info, x, y, PR_TRUE, aIncrementalChild, redraw, reason);
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// if the child got bigger then adjust our rect and all the children.
|
2000-02-16 23:00:52 +00:00
|
|
|
mOuter->ChildResized(childFrame, aDesiredSize, aRect, aMaxAscent, *info, resized, infoCount, changedIndex, finished, count, nextReason);
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
|
|
|
|
if (!finished) {
|
|
|
|
AddIndents();
|
|
|
|
printf("**** Child ");
|
|
|
|
nsFrame::ListTag(stdout, childFrame);
|
|
|
|
printf(" resized!******\n");
|
|
|
|
AddIndents();
|
|
|
|
char ch[100];
|
|
|
|
nextReason.ToCString(ch,100);
|
|
|
|
printf("because (%s)\n", ch);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
*/
|
|
|
|
|
|
|
|
// always do 1 pass for now.
|
|
|
|
//finished = PR_TRUE;
|
1999-05-09 21:46:24 +00: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-09 22:02:40 +00:00
|
|
|
// if the child resized then recompute it position.
|
|
|
|
if (!finished) {
|
2000-02-14 01:42:09 +00:00
|
|
|
mOuter->ComputeChildsNextPosition(info, x, y, nextX, nextY, nsSize(aDesiredSize.width, aDesiredSize.height), aRect, aMaxAscent);
|
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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
x = nextX;
|
|
|
|
y = nextY;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
info = info->next;
|
|
|
|
count++;
|
1999-03-27 01:35:55 +00: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-09 22:02:40 +00:00
|
|
|
// ok if something go bigger and we need to do another pass then
|
|
|
|
// the second pass will be reflow resize
|
|
|
|
reason = nextReason;
|
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
// if we get over 10 passes something probably when wrong.
|
|
|
|
passes++;
|
1999-05-09 21:46:24 +00:00
|
|
|
if (passes > 5) {
|
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-09 22:02:40 +00:00
|
|
|
// mOuter->NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
|
|
|
|
// ("bug"));
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//NS_ASSERTION(passes <= 10,"Error infinte loop too many passes");
|
|
|
|
if (passes > 10) {
|
|
|
|
break;
|
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
} while (PR_FALSE == finished);
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
// if the rect inside us changes size. Mainly if it gets smaller redraw.
|
|
|
|
// this will make use draw when children have removed.
|
|
|
|
nscoord newInnerSize;
|
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL)
|
|
|
|
newInnerSize = aRect.width;
|
|
|
|
else
|
|
|
|
newInnerSize = aRect.height;
|
|
|
|
|
|
|
|
if (mInnerSize != newInnerSize)
|
|
|
|
{
|
|
|
|
mInnerSize = newInnerSize;
|
|
|
|
redraw = PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// redraw things if needed.
|
1999-07-23 00:11:21 +00:00
|
|
|
if (redraw) {
|
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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REDRAW
|
|
|
|
mInner->ListTag(stdout);
|
1999-07-23 00:11:21 +00:00
|
|
|
printf("is being redrawn\n");
|
|
|
|
#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-09 22:02:40 +00:00
|
|
|
mOuter->Invalidate(aPresContext, nsRect(0,0,mOuter->mRect.width, mOuter->mRect.height), PR_FALSE);
|
1999-07-23 00:11:21 +00:00
|
|
|
}
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
if (resized)
|
|
|
|
delete[] resized;
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
void
|
|
|
|
nsBoxFrameInner::AddIndents()
|
|
|
|
{
|
|
|
|
for(PRInt32 i=0; i < gIndent; i++)
|
|
|
|
{
|
|
|
|
printf(" ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
void
|
|
|
|
nsBoxFrameInner::MakeReason(nsIFrame* aFrame, const nsString& aText, nsString& aReason)
|
|
|
|
{
|
|
|
|
nsAutoString type;
|
|
|
|
nsIFrameDebug* frameDebug;
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(aFrame->QueryInterface(nsIFrameDebug::GetIID(), (void**)&frameDebug))) {
|
|
|
|
frameDebug->GetFrameName(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
char address[100];
|
|
|
|
sprintf(address, "@%p", aFrame);
|
|
|
|
|
|
|
|
aReason = "(";
|
|
|
|
aReason += type;
|
|
|
|
aReason += address;
|
|
|
|
aReason += " ";
|
|
|
|
aReason += aText;
|
|
|
|
aReason += ")";
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
void
|
2000-02-16 23:00:52 +00:00
|
|
|
nsBoxFrameInner::CreateResizedArray(PRBool*& aResized, PRInt32 aCount)
|
|
|
|
{
|
|
|
|
aResized = new PRBool[aCount];
|
|
|
|
|
|
|
|
for (int i=0; i < aCount; i++)
|
|
|
|
aResized[i] = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsBoxFrame::ChildResized(nsIFrame* aFrame, nsHTMLReflowMetrics& aDesiredSize, nsRect& aRect, nscoord& aMaxAscent, nsCalculatedBoxInfo& aInfo, PRBool*& aResized, PRInt32 aInfoCount, nscoord& aChangedIndex, PRBool& aFinished, nscoord aIndex, nsString& aReason)
|
1999-07-23 00:11:21 +00:00
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_HORIZONTAL) {
|
1999-07-23 00:11:21 +00:00
|
|
|
// if we are a horizontal box see if the child will fit inside us.
|
|
|
|
if ( aDesiredSize.height > aRect.height) {
|
|
|
|
// if we are a horizontal box and the the child it bigger than our height
|
|
|
|
|
|
|
|
// ok if the height changed then we need to reflow everyone but us at the new height
|
|
|
|
// so we will set the changed index to be us. And signal that we need a new pass.
|
1999-10-12 00:16:06 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
aRect.height = aDesiredSize.height;
|
|
|
|
|
|
|
|
// remember we do not need to clear the resized list because changing the height of a horizontal box
|
|
|
|
// will not affect the width of any of its children because block flow left to right, top to bottom. Just trust me
|
|
|
|
// on this one.
|
|
|
|
aFinished = PR_FALSE;
|
|
|
|
aChangedIndex = aIndex;
|
|
|
|
|
|
|
|
// relayout everything
|
|
|
|
InvalidateChildren();
|
2000-02-14 01:42:09 +00:00
|
|
|
LayoutChildrenInRect(aRect, aMaxAscent);
|
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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
mInner->MakeReason(aFrame, "height got bigger", aReason);
|
|
|
|
#endif
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
} else if (aDesiredSize.width > aInfo.calculatedSize.width) {
|
|
|
|
// if the child is wider than we anticipated. This can happend for children that we were not able to get a
|
|
|
|
// take on their min width. Like text, or tables.
|
|
|
|
|
|
|
|
// because things flow from left to right top to bottom we know that
|
|
|
|
// if we get wider that we can set the min size. This will only work
|
|
|
|
// for width not height. Height must always be recalculated!
|
1999-10-12 00:16:06 +00:00
|
|
|
|
|
|
|
// however we must see whether the min size was set in css.
|
|
|
|
// if it was then this size should not override it.
|
|
|
|
|
|
|
|
// add in the css min, max, pref
|
|
|
|
const nsStylePosition* position;
|
1999-10-20 00:46:21 +00:00
|
|
|
aFrame->GetStyleData(eStyleStruct_Position,
|
1999-10-12 00:16:06 +00:00
|
|
|
(const nsStyleStruct*&) position);
|
|
|
|
|
1999-10-20 00:46:21 +00:00
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
// same for min size. Unfortunately min size is always set to 0. So for now
|
|
|
|
// we will assume 0 means not set.
|
|
|
|
if (position->mMinWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinWidth.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
aInfo.minSize.width = aDesiredSize.width;
|
|
|
|
|
|
|
|
// our width now becomes the new size
|
|
|
|
aInfo.calculatedSize.width = aDesiredSize.width;
|
|
|
|
|
|
|
|
InvalidateChildren();
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
if (aResized == nsnull)
|
|
|
|
mInner->CreateResizedArray(aResized, aInfoCount);
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// our index resized
|
|
|
|
aResized[aIndex] = PR_TRUE;
|
|
|
|
|
|
|
|
// if the width changed. mark our child as being resized
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
|
|
|
PRInt32 infoCount = 0;
|
|
|
|
while(info) {
|
2000-02-14 01:42:09 +00:00
|
|
|
if (aResized[infoCount])
|
|
|
|
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
|
|
|
else
|
|
|
|
info->mFlags &= ~NS_FRAME_BOX_SIZE_VALID;
|
|
|
|
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
|
|
|
infoCount++;
|
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
LayoutChildrenInRect(aRect, aMaxAscent);
|
1999-07-23 00:11:21 +00:00
|
|
|
aFinished = PR_FALSE;
|
|
|
|
aChangedIndex = aIndex;
|
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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
mInner->MakeReason(aFrame, "width got bigger", aReason);
|
|
|
|
#endif
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if ( aDesiredSize.width > aRect.width) {
|
|
|
|
// ok if the height changed then we need to reflow everyone but us at the new height
|
|
|
|
// so we will set the changed index to be us. And signal that we need a new pass.
|
|
|
|
aRect.width = aDesiredSize.width;
|
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
// add in the css min, max, pref
|
|
|
|
const nsStylePosition* position;
|
1999-10-20 00:46:21 +00:00
|
|
|
aFrame->GetStyleData(eStyleStruct_Position,
|
1999-10-12 00:16:06 +00:00
|
|
|
(const nsStyleStruct*&) position);
|
|
|
|
|
|
|
|
// same for min size. Unfortunately min size is always set to 0. So for now
|
|
|
|
// we will assume 0 means not set.
|
|
|
|
if (position->mMinWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinWidth.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// because things flow from left to right top to bottom we know that
|
|
|
|
// if we get wider that we can set the min size. This will only work
|
|
|
|
// for width not height. Height must always be recalculated!
|
|
|
|
aInfo.minSize.width = aDesiredSize.width;
|
|
|
|
|
|
|
|
// if the width changed then clear out the resized list
|
|
|
|
// but only do this if we are vertical box. On a horizontal box increasing the height will not change the
|
|
|
|
// width of its children.
|
2000-02-16 23:00:52 +00:00
|
|
|
if (aResized == nsnull)
|
|
|
|
mInner->CreateResizedArray(aResized, aInfoCount);
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
PRInt32 infoCount = mInner->mInfoList->GetCount();
|
|
|
|
for (int i=0; i < infoCount; i++)
|
1999-07-23 00:11:21 +00:00
|
|
|
aResized[i] = PR_FALSE;
|
|
|
|
|
|
|
|
aFinished = PR_FALSE;
|
|
|
|
aChangedIndex = aIndex;
|
|
|
|
|
|
|
|
// relayout everything
|
|
|
|
InvalidateChildren();
|
2000-02-14 01:42:09 +00:00
|
|
|
LayoutChildrenInRect(aRect, aMaxAscent);
|
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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
mInner->MakeReason(aFrame, "width got bigger", aReason);
|
|
|
|
#endif
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
} else if (aDesiredSize.height > aInfo.calculatedSize.height) {
|
|
|
|
// our width now becomes the new size
|
|
|
|
aInfo.calculatedSize.height = aDesiredSize.height;
|
|
|
|
|
|
|
|
InvalidateChildren();
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
if (aResized == nsnull)
|
|
|
|
mInner->CreateResizedArray(aResized, aInfoCount);
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// our index resized
|
|
|
|
aResized[aIndex] = PR_TRUE;
|
|
|
|
|
|
|
|
// if the width changed. mark our child as being resized
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
|
|
|
PRInt32 infoCount = 0;
|
|
|
|
while(info) {
|
2000-02-14 01:42:09 +00:00
|
|
|
if (aResized[infoCount])
|
|
|
|
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
|
|
|
else
|
|
|
|
info->mFlags &= ~NS_FRAME_BOX_SIZE_VALID;
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
|
|
|
infoCount++;
|
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
LayoutChildrenInRect(aRect, aMaxAscent);
|
1999-07-23 00:11:21 +00:00
|
|
|
aFinished = PR_FALSE;
|
|
|
|
aChangedIndex = aIndex;
|
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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
mInner->MakeReason(aFrame, "height got bigger", aReason);
|
|
|
|
#endif
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-08-27 06:06:39 +00:00
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::CollapseChild(nsIPresContext* aPresContext, nsIFrame* frame, PRBool hide)
|
1999-06-30 22:17:43 +00:00
|
|
|
{
|
1999-10-29 22:13:57 +00:00
|
|
|
// shrink the view
|
1999-08-30 22:32:25 +00:00
|
|
|
nsIView* view = nsnull;
|
1999-11-24 06:03:41 +00:00
|
|
|
frame->GetView(aPresContext, &view);
|
1999-08-30 22:32:25 +00:00
|
|
|
|
|
|
|
// if we find a view stop right here. All views under it
|
|
|
|
// will be clipped.
|
|
|
|
if (view) {
|
1999-10-29 22:13:57 +00:00
|
|
|
nsViewVisibility v;
|
|
|
|
view->GetVisibility(v);
|
|
|
|
nsCOMPtr<nsIWidget> widget;
|
|
|
|
view->GetWidget(*getter_AddRefs(widget));
|
|
|
|
if (hide) {
|
|
|
|
view->SetVisibility(nsViewVisibility_kHide);
|
|
|
|
} else {
|
|
|
|
view->SetVisibility(nsViewVisibility_kShow);
|
|
|
|
}
|
|
|
|
if (widget) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
1999-08-30 22:32:25 +00:00
|
|
|
}
|
2000-01-14 10:34:27 +00:00
|
|
|
|
|
|
|
// Trees have to collapse their scrollbars manually, since you can't
|
|
|
|
// get to the scrollbar via the normal frame list.
|
|
|
|
nsISelfScrollingFrame* treeFrame;
|
2000-02-02 22:24:56 +00:00
|
|
|
if (NS_SUCCEEDED(frame->QueryInterface(NS_GET_IID(nsISelfScrollingFrame), (void**)&treeFrame)) && treeFrame) {
|
2000-01-14 10:34:27 +00:00
|
|
|
// Tell the tree frame to collapse its scrollbar.
|
|
|
|
treeFrame->CollapseScrollbar(aPresContext, hide);
|
|
|
|
}
|
|
|
|
|
1999-08-30 22:32:25 +00:00
|
|
|
// collapse the child
|
|
|
|
nsIFrame* child = nsnull;
|
2000-01-22 01:16:50 +00:00
|
|
|
frame->FirstChild(aPresContext, nsnull, &child);
|
1999-08-30 22:32:25 +00:00
|
|
|
|
|
|
|
while (nsnull != child)
|
|
|
|
{
|
1999-10-29 22:13:57 +00:00
|
|
|
CollapseChild(aPresContext, child, hide);
|
1999-08-30 22:32:25 +00:00
|
|
|
nsresult rv = child->GetNextSibling(&child);
|
|
|
|
NS_ASSERTION(rv == NS_OK,"failed to get next child");
|
|
|
|
}
|
1999-06-30 22:17:43 +00:00
|
|
|
}
|
|
|
|
|
1999-10-29 22:13:57 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::DidReflow(nsIPresContext* aPresContext,
|
1999-10-29 22:13:57 +00:00
|
|
|
nsDidReflowStatus aStatus)
|
|
|
|
{
|
|
|
|
nsresult rv = nsHTMLContainerFrame::DidReflow(aPresContext, aStatus);
|
|
|
|
NS_ASSERTION(rv == NS_OK,"DidReflow failed");
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
/*
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
while (info)
|
1999-10-29 22:13:57 +00:00
|
|
|
{
|
|
|
|
// make collapsed children not show up
|
1999-11-18 21:05:43 +00:00
|
|
|
if (info->collapsed) {
|
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-09 22:02:40 +00:00
|
|
|
nsRect rect(0,0,0,0);
|
|
|
|
info->frame->GetRect(rect);
|
|
|
|
if (rect.width == 0 && rect.height == 0)
|
|
|
|
return;
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
CollapseChild(aPresContext, info->frame, PR_TRUE);
|
1999-10-29 22:13:57 +00:00
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
info = info->next;
|
1999-10-29 22:13:57 +00: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-09 22:02:40 +00:00
|
|
|
*/
|
1999-10-29 22:13:57 +00:00
|
|
|
return rv;
|
|
|
|
}
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
/**
|
|
|
|
* Given the boxes rect. Set the x,y locations of all its children. Taking into account
|
|
|
|
* their margins
|
|
|
|
*/
|
|
|
|
nsresult
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::PlaceChildren(nsIPresContext* aPresContext, nsRect& boxRect)
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
|
|
|
// ------- set the childs positions ---------
|
|
|
|
nscoord x = boxRect.x;
|
|
|
|
nscoord y = boxRect.y;
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
while (info)
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
nsIFrame* childFrame = info->frame;
|
|
|
|
|
1999-06-30 22:17:43 +00:00
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// make collapsed children not show up
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_IS_COLLAPSED) {
|
1999-10-29 22:13:57 +00:00
|
|
|
nsRect rect(0,0,0,0);
|
|
|
|
childFrame->GetRect(rect);
|
|
|
|
if (rect.width > 0 || rect.height > 0) {
|
1999-11-24 06:03:41 +00:00
|
|
|
childFrame->SizeTo(aPresContext, 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-09 22:02:40 +00:00
|
|
|
CollapseChild(aPresContext, childFrame, PR_TRUE);
|
1999-10-29 22:13:57 +00:00
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
} else {
|
1999-06-30 22:17:43 +00:00
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
rv = childFrame->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
|
|
|
nsMargin margin(0,0,0,0);
|
|
|
|
spacing->GetMargin(margin);
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_HORIZONTAL) {
|
1999-06-30 22:17:43 +00:00
|
|
|
x += margin.left;
|
|
|
|
y = boxRect.y + margin.top;
|
|
|
|
} else {
|
|
|
|
y += margin.top;
|
|
|
|
x = boxRect.x + margin.left;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsRect rect;
|
1999-11-19 15:33:29 +00:00
|
|
|
nsIView* view;
|
1999-06-30 22:17:43 +00:00
|
|
|
childFrame->GetRect(rect);
|
|
|
|
rect.x = x;
|
|
|
|
rect.y = y;
|
1999-11-24 06:03:41 +00:00
|
|
|
childFrame->SetRect(aPresContext, rect);
|
|
|
|
childFrame->GetView(aPresContext, &view);
|
1999-11-19 15:33:29 +00:00
|
|
|
// XXX Because we didn't position the frame or its view when reflowing
|
|
|
|
// it we must re-position all child views. This isn't optimal, and if
|
|
|
|
// we knew its final position, it would be better to position the frame
|
|
|
|
// and its view when doing the reflow...
|
|
|
|
if (view) {
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, childFrame,
|
1999-11-19 15:33:29 +00:00
|
|
|
view, nsnull);
|
|
|
|
} else {
|
|
|
|
// Re-position any child frame views
|
1999-11-24 06:03:41 +00:00
|
|
|
nsContainerFrame::PositionChildViews(aPresContext, childFrame);
|
1999-11-19 15:33:29 +00:00
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-06-30 22:17:43 +00:00
|
|
|
// add in the right margin
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_HORIZONTAL)
|
1999-06-30 22:17:43 +00:00
|
|
|
x += margin.right;
|
|
|
|
else
|
|
|
|
y += margin.bottom;
|
1999-03-27 01:35:55 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_HORIZONTAL) {
|
1999-06-30 22:17:43 +00:00
|
|
|
x += rect.width;
|
|
|
|
//width += rect.width + margin.left + margin.right;
|
|
|
|
} else {
|
|
|
|
y += rect.height;
|
|
|
|
//height += rect.height + margin.top + margin.bottom;
|
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
info = info->next;
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
void
|
|
|
|
nsBoxFrameInner::PlaceChild(nsIPresContext* aPresContext, nsIFrame* aFrame, nscoord aX, nscoord aY)
|
|
|
|
{
|
|
|
|
nsPoint curOrigin;
|
|
|
|
aFrame->GetOrigin(curOrigin);
|
|
|
|
|
|
|
|
// only if the origin changed
|
|
|
|
if ((curOrigin.x != aX) || (curOrigin.y != aY)) {
|
|
|
|
aFrame->MoveTo(aPresContext, aX, aY);
|
|
|
|
|
|
|
|
nsIView* view;
|
|
|
|
aFrame->GetView(aPresContext, &view);
|
|
|
|
if (view) {
|
|
|
|
nsContainerFrame::PositionFrameView(aPresContext, aFrame, view);
|
|
|
|
} else
|
|
|
|
nsContainerFrame::PositionChildViews(aPresContext, aFrame);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
nsBoxFrameInner::InitializeReflowState(nsIPresContext* aPresContext, const nsCalculatedBoxInfo& aInfo, nsHTMLReflowState& aReflowState, const nsHTMLReflowState& aParentReflowState, nsIFrame* aFrame, const nsSize& aAvailSize, nsReflowReason aReason)
|
|
|
|
{
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Position,
|
|
|
|
(const nsStyleStruct*&)aReflowState.mStylePosition);
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Display,
|
|
|
|
(const nsStyleStruct*&)aReflowState.mStyleDisplay);
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&)aReflowState.mStyleSpacing);
|
|
|
|
|
|
|
|
aReflowState.mReflowDepth = aParentReflowState.mReflowDepth + 1;
|
|
|
|
aReflowState.parentReflowState = &aParentReflowState;
|
|
|
|
aReflowState.frame = aFrame;
|
|
|
|
aReflowState.reason = aReason;
|
|
|
|
aReflowState.reflowCommand = aReflowState.reflowCommand;
|
|
|
|
aReflowState.availableWidth = aAvailSize.width;
|
|
|
|
aReflowState.availableHeight = aAvailSize.height;
|
|
|
|
|
|
|
|
aReflowState.rendContext = aParentReflowState.rendContext;
|
|
|
|
aReflowState.mSpaceManager = aParentReflowState.mSpaceManager;
|
|
|
|
aReflowState.mLineLayout = aParentReflowState.mLineLayout;
|
|
|
|
aReflowState.isTopOfPage = aParentReflowState.isTopOfPage;
|
|
|
|
|
|
|
|
// if we are not a box then to the regular html thing.
|
|
|
|
// otherwise do the efficient thing for boxes.
|
|
|
|
// if (!(aInfo.mFlags & NS_FRAME_IS_BOX)) {
|
|
|
|
// aReflowState.Init(aPresContext);
|
|
|
|
/// } else {
|
|
|
|
aReflowState.mComputedMargin.SizeTo(0,0,0,0);
|
|
|
|
aReflowState.mStyleSpacing->GetMargin(aReflowState.mComputedMargin);
|
|
|
|
aReflowState.mComputedBorderPadding.SizeTo(0,0,0,0);
|
|
|
|
aReflowState.mStyleSpacing->GetBorderPadding(aReflowState.mComputedBorderPadding);
|
|
|
|
aReflowState.mComputedPadding.SizeTo(0,0,0,0);
|
|
|
|
aReflowState.mStyleSpacing->GetPadding(aReflowState.mComputedPadding);
|
|
|
|
aReflowState.mComputedOffsets.SizeTo(0, 0, 0, 0);
|
|
|
|
aReflowState.mComputedMinWidth = aReflowState.mComputedMinHeight = 0;
|
|
|
|
aReflowState.mComputedMaxWidth = aReflowState.mComputedMaxHeight = NS_UNCONSTRAINEDSIZE;
|
|
|
|
aReflowState.mCompactMarginWidth = 0;
|
|
|
|
aReflowState.mAlignCharOffset = 0;
|
|
|
|
aReflowState.mUseAlignCharOffset = 0;
|
|
|
|
aReflowState.mFrameType = NS_CSS_FRAME_TYPE_BLOCK;
|
|
|
|
//}
|
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
/**
|
|
|
|
* Flow an individual child. Special args:
|
|
|
|
* count: the spring that will be used to lay out the child
|
|
|
|
* incrementalChild: If incremental reflow this is the child that need to be reflowed.
|
|
|
|
* when we finally do reflow the child we will set the child to null
|
|
|
|
*/
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
nsresult
|
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-09 22:02:40 +00:00
|
|
|
nsBoxFrameInner::FlowChildAt(nsIFrame* childFrame,
|
|
|
|
nsIPresContext* aPresContext,
|
|
|
|
nsHTMLReflowMetrics& desiredSize,
|
|
|
|
const nsHTMLReflowState& aReflowState,
|
|
|
|
nsReflowStatus& aStatus,
|
|
|
|
nsCalculatedBoxInfo& aInfo,
|
|
|
|
nscoord aX,
|
|
|
|
nscoord aY,
|
|
|
|
PRBool aMoveFrame,
|
|
|
|
nsIFrame*& aIncrementalChild,
|
|
|
|
PRBool& aRedraw,
|
|
|
|
const nsString& aReason)
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
1999-08-25 19:58:07 +00:00
|
|
|
aStatus = NS_FRAME_COMPLETE;
|
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-09 22:02:40 +00:00
|
|
|
PRBool needsReflow = PR_FALSE;
|
1999-07-23 00:11:21 +00:00
|
|
|
nsReflowReason reason = aReflowState.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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nsFrameState childState;
|
|
|
|
aInfo.frame->GetFrameState(&childState);
|
|
|
|
|
|
|
|
if (childState & NS_FRAME_FIRST_REFLOW) {
|
2000-02-10 21:36:28 +00:00
|
|
|
NS_ASSERTION(reason != eReflowReason_Incremental,"Error should not be incremental!!");
|
|
|
|
reason = eReflowReason_Initial;
|
|
|
|
} else if (reason == eReflowReason_Initial) {
|
|
|
|
reason = eReflowReason_Resize;
|
|
|
|
}
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
switch(reason)
|
|
|
|
{
|
|
|
|
// if the child we are reflowing is the child we popped off the incremental
|
|
|
|
// reflow chain then we need to reflow it no matter what.
|
|
|
|
// if its not the child we got from the reflow chain then this child needs reflow
|
|
|
|
// because as a side effect of the incremental child changing aize andit needs to be resized.
|
|
|
|
// This will happen with a lot when a box that contains 2 children with different flexabilities
|
|
|
|
// if on child gets bigger the other is affected because it is proprotional to the first.
|
|
|
|
// so it might need to be resized. But we don't need to reflow it. If it is already the
|
|
|
|
// needed size then we will do nothing.
|
|
|
|
case eReflowReason_Incremental:
|
|
|
|
if (aIncrementalChild == aInfo.frame) {
|
|
|
|
needsReflow = PR_TRUE;
|
|
|
|
aIncrementalChild = nsnull;
|
|
|
|
} else {
|
|
|
|
reason = eReflowReason_Resize;
|
|
|
|
needsReflow = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
// if its dirty then see if the child we want to reflow is dirty. If it is then
|
|
|
|
// mark it as needing to be reflowed.
|
|
|
|
case eReflowReason_Dirty:
|
|
|
|
// get the frame state to see if it needs reflow
|
2000-02-14 01:42:09 +00:00
|
|
|
needsReflow = (childState & NS_FRAME_IS_DIRTY) || (childState & NS_FRAME_HAS_DIRTY_CHILDREN);
|
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-09 22:02:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
// if the a resize reflow then it doesn't need to be reflowed. Only if the size is different
|
|
|
|
// from the new size would we actually do a reflow
|
|
|
|
case eReflowReason_Resize:
|
|
|
|
needsReflow = PR_FALSE;
|
|
|
|
break;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
// if its an initial reflow we must place the child.
|
|
|
|
// otherwise we might think it was already placed when it wasn't
|
|
|
|
case eReflowReason_Initial:
|
|
|
|
aMoveFrame = PR_TRUE;
|
|
|
|
needsReflow = PR_TRUE;
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
default:
|
|
|
|
needsReflow = PR_TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// subtract out the childs margin and border
|
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
nsresult rv = childFrame->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-07-27 19:06:44 +00:00
|
|
|
nsMargin margin(0,0,0,0);
|
1999-05-09 21:46:24 +00:00
|
|
|
spacing->GetMargin(margin);
|
1999-03-30 04:05:49 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// get the current size of the child
|
|
|
|
nsRect currentRect(0,0,0,0);
|
|
|
|
childFrame->GetRect(currentRect);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
|
|
|
// if we don't need a reflow then
|
|
|
|
// lets see if we are already that size. Yes? then don't even reflow. We are done.
|
2000-02-10 21:36:28 +00:00
|
|
|
if (!needsReflow) {
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-10 21:36:28 +00:00
|
|
|
if (aInfo.calculatedSize.width != NS_INTRINSICSIZE && aInfo.calculatedSize.height != NS_INTRINSICSIZE) {
|
|
|
|
|
|
|
|
// if the new calculated size has a 0 width or a 0 height
|
|
|
|
if ((currentRect.width == 0 || currentRect.height == 0) && (aInfo.calculatedSize.width == 0 || aInfo.calculatedSize.height == 0)) {
|
|
|
|
needsReflow = PR_FALSE;
|
|
|
|
desiredSize.width = aInfo.calculatedSize.width - (margin.left + margin.right);
|
|
|
|
desiredSize.height = aInfo.calculatedSize.height - (margin.top + margin.bottom);
|
|
|
|
childFrame->SizeTo(aPresContext, desiredSize.width, desiredSize.height);
|
|
|
|
} else {
|
|
|
|
desiredSize.width = currentRect.width;
|
|
|
|
desiredSize.height = currentRect.height;
|
|
|
|
|
|
|
|
// remove the margin. The rect of our child does not include it but our calculated size does.
|
|
|
|
nscoord calcWidth = aInfo.calculatedSize.width - (margin.left + margin.right);
|
|
|
|
nscoord calcHeight = aInfo.calculatedSize.height - (margin.top + margin.bottom);
|
|
|
|
|
|
|
|
// don't reflow if we are already the right size
|
|
|
|
if (currentRect.width == calcWidth && currentRect.height == calcHeight)
|
|
|
|
needsReflow = PR_FALSE;
|
|
|
|
else
|
|
|
|
needsReflow = 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-09 22:02:40 +00:00
|
|
|
|
2000-02-10 21:36:28 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// if the width or height are intrinsic alway reflow because
|
|
|
|
// we don't know what it should be.
|
|
|
|
needsReflow = PR_TRUE;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
2000-02-10 21:36:28 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// ok now reflow the child into the springs calculated space
|
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-09 22:02:40 +00:00
|
|
|
if (needsReflow) {
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-27 19:06:44 +00:00
|
|
|
nsMargin border(0,0,0,0);
|
1999-07-23 00:11:21 +00:00
|
|
|
spacing->GetBorderPadding(border);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
const nsStylePosition* position;
|
|
|
|
rv = childFrame->GetStyleData(eStyleStruct_Position,
|
|
|
|
(const nsStyleStruct*&) position);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
desiredSize.width = 0;
|
|
|
|
desiredSize.height = 0;
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
nsSize size(aInfo.calculatedSize.width, aInfo.calculatedSize.height);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-27 19:06:44 +00:00
|
|
|
/*
|
|
|
|
// lets also look at our intrinsic flag. This flag is to make things like HR work.
|
|
|
|
// hr is funny if you flow it intrinsically you will get a size that is the height of
|
|
|
|
// the current font size. But if you then flow the hr with a computed height of what was returned the
|
|
|
|
// hr will be stretched out to fit. So basically the hr lays itself out differently depending
|
|
|
|
// on if you use intrinsic or or computed size. So to fix this we follow this policy. If any child
|
1999-09-10 00:57:01 +00:00
|
|
|
// does not Innerement nsIBox then we set this flag. Then on a flow if we decide to flow at the preferred width
|
1999-07-27 19:06:44 +00:00
|
|
|
// we flow it with a intrinsic width. This goes for height as well.
|
|
|
|
if (aInfo.prefWidthIntrinsic && size.width == aInfo.prefSize.width)
|
|
|
|
size.width = NS_INTRINSICSIZE;
|
|
|
|
|
|
|
|
if (aInfo.prefHeightIntrinsic && size.height == aInfo.prefSize.height)
|
|
|
|
size.height = NS_INTRINSICSIZE;
|
|
|
|
*/
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// only subrtact margin
|
|
|
|
if (size.height != NS_INTRINSICSIZE)
|
|
|
|
size.height -= (margin.top + margin.bottom);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
if (size.width != NS_INTRINSICSIZE)
|
|
|
|
size.width -= (margin.left + margin.right);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
// create a reflow state to tell our child to flow at the given size.
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
char* reflowReasonString;
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
switch(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-09 22:02:40 +00:00
|
|
|
{
|
|
|
|
case eReflowReason_Initial:
|
|
|
|
reflowReasonString = "initial";
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eReflowReason_Resize:
|
|
|
|
reflowReasonString = "resize";
|
|
|
|
break;
|
|
|
|
case eReflowReason_Dirty:
|
|
|
|
reflowReasonString = "dirty";
|
|
|
|
break;
|
|
|
|
case eReflowReason_StyleChange:
|
|
|
|
reflowReasonString = "stylechange";
|
|
|
|
break;
|
|
|
|
case eReflowReason_Incremental:
|
|
|
|
reflowReasonString = "incremental";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
reflowReasonString = "unknown";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
AddIndents();
|
|
|
|
nsFrame::ListTag(stdout, childFrame);
|
|
|
|
char ch[100];
|
|
|
|
aReason.ToCString(ch,100);
|
|
|
|
|
|
|
|
printf(" reason=%s %s\n",reflowReasonString,ch);
|
|
|
|
#endif
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
if (!(aInfo.mFlags & NS_FRAME_IS_BOX)) {
|
|
|
|
nsHTMLReflowState reflowState(aPresContext, aReflowState, childFrame, nsSize(size.width, NS_INTRINSICSIZE));
|
|
|
|
reflowState.reason = reason;
|
|
|
|
|
|
|
|
if (size.height != NS_INTRINSICSIZE)
|
|
|
|
size.height -= (border.top + border.bottom);
|
|
|
|
|
|
|
|
if (size.width != NS_INTRINSICSIZE)
|
|
|
|
size.width -= (border.left + border.right);
|
|
|
|
|
|
|
|
reflowState.mComputedWidth = size.width;
|
|
|
|
reflowState.mComputedHeight = size.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-09 22:02:40 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
// place the child and reflow
|
|
|
|
childFrame->WillReflow(aPresContext);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
if (aMoveFrame) {
|
|
|
|
PlaceChild(aPresContext, childFrame, aX + margin.left, aY + margin.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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
childFrame->Reflow(aPresContext, desiredSize, reflowState, aStatus);
|
|
|
|
} else {
|
|
|
|
nsHTMLReflowState reflowState(aReflowState);
|
|
|
|
InitializeReflowState(aPresContext, aInfo, reflowState, aReflowState, childFrame, nsSize(size.width, NS_INTRINSICSIZE), reason);
|
|
|
|
|
|
|
|
if (size.height != NS_INTRINSICSIZE)
|
|
|
|
size.height -= (border.top + border.bottom);
|
|
|
|
|
|
|
|
if (size.width != NS_INTRINSICSIZE)
|
|
|
|
size.width -= (border.left + border.right);
|
|
|
|
|
|
|
|
reflowState.mComputedWidth = size.width;
|
|
|
|
reflowState.mComputedHeight = size.height;
|
|
|
|
|
|
|
|
// place the child and reflow
|
|
|
|
childFrame->WillReflow(aPresContext);
|
|
|
|
|
|
|
|
if (aMoveFrame) {
|
|
|
|
PlaceChild(aPresContext, childFrame, aX + margin.left, aY + margin.top);
|
|
|
|
}
|
|
|
|
|
|
|
|
childFrame->Reflow(aPresContext, desiredSize, reflowState, aStatus);
|
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
nsFrameState kidState;
|
|
|
|
childFrame->GetFrameState(&kidState);
|
|
|
|
|
|
|
|
// printf("width: %d, height: %d\n", desiredSize.mCombinedArea.width, desiredSize.mCombinedArea.height);
|
|
|
|
|
|
|
|
if (kidState & NS_FRAME_OUTSIDE_CHILDREN) {
|
1999-12-06 15:49:53 +00:00
|
|
|
desiredSize.width = desiredSize.mOverflowArea.width;
|
|
|
|
desiredSize.height = desiredSize.mOverflowArea.height;
|
1999-07-23 00:11:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if (maxElementSize.width > desiredSize.width)
|
|
|
|
// desiredSize.width = maxElementSize.width;
|
|
|
|
|
|
|
|
PRBool changedSize = PR_FALSE;
|
|
|
|
|
|
|
|
if (currentRect.width != desiredSize.width || currentRect.height != desiredSize.height)
|
|
|
|
changedSize = PR_TRUE;
|
|
|
|
|
|
|
|
// if the child got bigger then make sure the new size in our min max range
|
|
|
|
if (changedSize) {
|
|
|
|
|
|
|
|
// redraw if we changed size.
|
|
|
|
aRedraw = PR_TRUE;
|
|
|
|
|
|
|
|
if (aInfo.maxSize.width != NS_INTRINSICSIZE && desiredSize.width > aInfo.maxSize.width - (margin.left + margin.right))
|
|
|
|
desiredSize.width = aInfo.maxSize.width - (margin.left + margin.right);
|
|
|
|
|
|
|
|
// if the child was bigger than anticipated and there was a min size set thennn
|
|
|
|
if (aInfo.calculatedSize.width != NS_INTRINSICSIZE && position->mMinWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinWidth.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
desiredSize.width = aInfo.calculatedSize.width - (margin.left + margin.right);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aInfo.maxSize.height != NS_INTRINSICSIZE && desiredSize.height > aInfo.maxSize.height - (margin.top + margin.bottom))
|
|
|
|
desiredSize.height = aInfo.maxSize.height - (margin.top + margin.bottom);
|
|
|
|
|
|
|
|
// if a min size was set we will always get the desired height
|
|
|
|
if (aInfo.calculatedSize.height != NS_INTRINSICSIZE && position->mMinHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinHeight.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
desiredSize.height = aInfo.calculatedSize.height - (margin.top + margin.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-09 22:02:40 +00:00
|
|
|
|
|
|
|
nsContainerFrame::FinishReflowChild(childFrame, aPresContext, desiredSize, aX + margin.left, aY + margin.top, NS_FRAME_NO_MOVE_FRAME);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-07-14 17:32:43 +00:00
|
|
|
// Stub out desiredSize.maxElementSize so that when go out of
|
|
|
|
// scope, nothing bad happens!
|
2000-02-14 01:42:09 +00:00
|
|
|
//desiredSize.maxElementSize = nsnull;
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
} else {
|
|
|
|
if (aMoveFrame) {
|
2000-02-16 23:00:52 +00:00
|
|
|
PlaceChild(aPresContext, childFrame, aX + margin.left, aY + margin.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-09 22:02:40 +00:00
|
|
|
}
|
|
|
|
}
|
1999-07-08 00:43:17 +00: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-09 22:02:40 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// add the margin back in. The child should add its border automatically
|
|
|
|
desiredSize.height += (margin.top + margin.bottom);
|
|
|
|
desiredSize.width += (margin.left + margin.right);
|
1999-05-19 22:14:11 +00: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-09 22:02:40 +00:00
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
if (aInfo.calculatedSize.height != NS_INTRINSICSIZE && desiredSize.height != aInfo.calculatedSize.height)
|
|
|
|
{
|
|
|
|
AddIndents();
|
|
|
|
printf("**** Child ");
|
|
|
|
nsFrame::ListTag(stdout, childFrame);
|
|
|
|
printf(" got taller!******\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
if (aInfo.calculatedSize.width != NS_INTRINSICSIZE && desiredSize.width != aInfo.calculatedSize.width)
|
|
|
|
{
|
|
|
|
AddIndents();
|
|
|
|
printf("**** Child ");
|
|
|
|
nsFrame::ListTag(stdout, childFrame);
|
|
|
|
printf(" got wider!******\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
if (aInfo.calculatedSize.width == NS_INTRINSICSIZE)
|
|
|
|
aInfo.calculatedSize.width = desiredSize.width;
|
|
|
|
|
|
|
|
if (aInfo.calculatedSize.height == NS_INTRINSICSIZE)
|
|
|
|
aInfo.calculatedSize.height = desiredSize.height;
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Given a box info object and a rect. Make sure the rect is not too small to layout the box and
|
|
|
|
* not to big either.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
nsBoxFrame::BoundsCheck(const nsBoxInfo& aBoxInfo, nsRect& aRect)
|
|
|
|
{
|
|
|
|
// if we are bieng flowed at our intrinsic width or height then set our width
|
|
|
|
// to the biggest child.
|
|
|
|
if (aRect.height == NS_INTRINSICSIZE )
|
|
|
|
aRect.height = aBoxInfo.prefSize.height;
|
|
|
|
|
|
|
|
if (aRect.width == NS_INTRINSICSIZE )
|
|
|
|
aRect.width = aBoxInfo.prefSize.width;
|
|
|
|
|
|
|
|
// make sure the available size is no bigger than the max size
|
|
|
|
if (aRect.height > aBoxInfo.maxSize.height)
|
|
|
|
aRect.height = aBoxInfo.maxSize.height;
|
|
|
|
|
|
|
|
if (aRect.width > aBoxInfo.maxSize.width)
|
1999-06-01 21:52:11 +00:00
|
|
|
aRect.width = aBoxInfo.maxSize.width;
|
1999-05-09 21:46:24 +00:00
|
|
|
|
|
|
|
// make sure the available size is at least as big as the min size
|
|
|
|
if (aRect.height < aBoxInfo.minSize.height)
|
|
|
|
aRect.height = aBoxInfo.minSize.height;
|
|
|
|
|
|
|
|
if (aRect.width < aBoxInfo.minSize.width)
|
|
|
|
aRect.width = aBoxInfo.minSize.width;
|
1999-06-01 21:52:11 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Ok when calculating a boxes size such as its min size we need to look at its children to figure it out.
|
|
|
|
* But this isn't as easy as just adding up its childs min sizes. If the box is horizontal then we need to
|
|
|
|
* add up each child's min width but our min height should be the childs largest min height. This needs to
|
|
|
|
* be done for preferred size and max size as well. Of course for our max size we need to pick the smallest
|
|
|
|
* max size. So this method facilitates the calculation. Just give it 2 sizes and a flag to ask whether is is
|
|
|
|
* looking for the largest or smallest value (max needs smallest) and it will set the second value.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
nsBoxFrame::AddSize(const nsSize& a, nsSize& b, PRBool largest)
|
|
|
|
{
|
|
|
|
|
|
|
|
// depending on the dimension switch either the width or the height component.
|
2000-02-14 01:42:09 +00:00
|
|
|
const nscoord& awidth = (mState & NS_STATE_IS_HORIZONTAL) ? a.width : a.height;
|
|
|
|
const nscoord& aheight = (mState & NS_STATE_IS_HORIZONTAL) ? a.height : a.width;
|
|
|
|
nscoord& bwidth = (mState & NS_STATE_IS_HORIZONTAL) ? b.width : b.height;
|
|
|
|
nscoord& bheight = (mState & NS_STATE_IS_HORIZONTAL) ? b.height : b.width;
|
1999-05-09 21:46:24 +00:00
|
|
|
|
|
|
|
// add up the widths make sure we check for intrinsic.
|
|
|
|
if (bwidth != NS_INTRINSICSIZE) // if we are already intrinsic we are done
|
|
|
|
{
|
|
|
|
// otherwise if what we are adding is intrinsic then we just become instrinsic and we are done
|
|
|
|
if (awidth == NS_INTRINSICSIZE)
|
|
|
|
bwidth = NS_INTRINSICSIZE;
|
|
|
|
else // add it on
|
|
|
|
bwidth += awidth;
|
|
|
|
}
|
|
|
|
|
|
|
|
// store the largest or smallest height
|
|
|
|
if ((largest && aheight > bheight) || (!largest && bheight < aheight))
|
|
|
|
bheight = aheight;
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-03-30 04:05:49 +00:00
|
|
|
void
|
|
|
|
nsBoxFrame::GetInset(nsMargin& margin)
|
|
|
|
{
|
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-12-07 22:10:45 +00:00
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
void
|
1999-05-09 21:46:24 +00:00
|
|
|
nsBoxFrame::InvalidateChildren()
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
|
|
|
while(info) {
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags &= ~NS_FRAME_BOX_SIZE_VALID;
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nsBoxFrame::Valignment
|
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-09 22:02:40 +00:00
|
|
|
nsBoxFrameInner::GetVAlign()
|
|
|
|
{
|
|
|
|
return mValign;
|
|
|
|
}
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nsBoxFrame::Halignment
|
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-09 22:02:40 +00:00
|
|
|
nsBoxFrameInner::GetHAlign()
|
|
|
|
{
|
|
|
|
return mHalign;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
void
|
2000-02-14 01:42:09 +00:00
|
|
|
nsBoxFrame::LayoutChildrenInRect(nsRect& aGivenSize, nscoord& aMaxAscent)
|
2000-02-16 23:00:52 +00:00
|
|
|
{
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfo* first = mInner->mInfoList->GetFirst();
|
|
|
|
|
|
|
|
if (!first)
|
1999-05-09 21:46:24 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
PRInt32 sizeRemaining;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mState & NS_STATE_IS_HORIZONTAL)
|
|
|
|
sizeRemaining = aGivenSize.width;
|
1999-05-09 21:46:24 +00:00
|
|
|
else
|
2000-02-14 01:42:09 +00:00
|
|
|
sizeRemaining = aGivenSize.height;
|
1999-05-09 21:46:24 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
PRInt32 springConstantsRemaining = 0;
|
1999-03-27 01:35:55 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfo* info = first;
|
|
|
|
|
|
|
|
while(info) {
|
1999-06-30 22:17:43 +00:00
|
|
|
// ignore collapsed children
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_IS_COLLAPSED) {
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-06-30 22:17:43 +00:00
|
|
|
continue;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
1999-06-30 22:17:43 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// figure out the direction of the box and get the correct value either the width or height
|
1999-12-02 01:07:27 +00:00
|
|
|
nscoord pref = GET_WIDTH(info->prefSize);
|
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-09 22:02:40 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
nscoord min = GET_WIDTH(info->minSize);
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
if (mState & NS_STATE_AUTO_STRETCH)
|
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-09 22:02:40 +00:00
|
|
|
{
|
|
|
|
// stretch
|
2000-02-14 01:42:09 +00:00
|
|
|
nscoord h = GET_HEIGHT(aGivenSize);
|
2000-02-10 02:43:09 +00:00
|
|
|
nscoord max1 = GET_HEIGHT(info->maxSize);
|
|
|
|
nscoord min1 = GET_HEIGHT(info->minSize);
|
|
|
|
if (h < min1)
|
|
|
|
h = min1;
|
|
|
|
else if (h > max1)
|
|
|
|
h = max1;
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
SET_HEIGHT(info->calculatedSize, h);
|
|
|
|
} else {
|
|
|
|
// go to preferred size
|
|
|
|
nscoord h = GET_HEIGHT(info->prefSize);
|
2000-02-14 01:42:09 +00:00
|
|
|
nscoord s = GET_HEIGHT(aGivenSize);
|
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-09 22:02:40 +00:00
|
|
|
if (h > s)
|
|
|
|
h = s;
|
|
|
|
|
2000-02-10 02:43:09 +00:00
|
|
|
nscoord max1 = GET_HEIGHT(info->maxSize);
|
|
|
|
nscoord min1 = GET_HEIGHT(info->minSize);
|
|
|
|
if (h < min1)
|
|
|
|
h = min1;
|
|
|
|
else if (h > max1)
|
|
|
|
h = max1;
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
SET_HEIGHT(info->calculatedSize, h);
|
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
if (pref < min) {
|
1999-05-09 21:46:24 +00:00
|
|
|
pref = min;
|
1999-12-07 22:10:45 +00:00
|
|
|
SET_WIDTH(info->prefSize, min);
|
1999-12-02 01:07:27 +00:00
|
|
|
}
|
1999-03-30 04:05:49 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_SIZE_VALID) {
|
1999-11-18 21:05:43 +00:00
|
|
|
sizeRemaining -= GET_WIDTH(info->calculatedSize);
|
1999-05-09 21:46:24 +00:00
|
|
|
} else {
|
1999-12-02 01:07:27 +00:00
|
|
|
if (info->flex == 0)
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
1999-12-07 22:10:45 +00:00
|
|
|
SET_WIDTH(info->calculatedSize, pref);
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
sizeRemaining -= pref;
|
1999-11-18 21:05:43 +00:00
|
|
|
springConstantsRemaining += info->flex;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
1999-11-18 21:05:43 +00:00
|
|
|
|
|
|
|
info = info->next;
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nscoord& sz = GET_WIDTH(aGivenSize);
|
1999-05-09 21:46:24 +00:00
|
|
|
if (sz == NS_INTRINSICSIZE) {
|
|
|
|
sz = 0;
|
1999-11-18 21:05:43 +00:00
|
|
|
info = first;
|
|
|
|
while(info) {
|
1999-06-30 22:17:43 +00:00
|
|
|
|
|
|
|
// ignore collapsed springs
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_IS_COLLAPSED) {
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-06-30 22:17:43 +00:00
|
|
|
continue;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
1999-06-30 22:17:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
nscoord pref = GET_WIDTH(info->prefSize);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (!(info->mFlags & NS_FRAME_BOX_SIZE_VALID))
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
|
|
|
// set the calculated size to be the preferred size
|
1999-12-07 22:10:45 +00:00
|
|
|
SET_WIDTH(info->calculatedSize, pref);
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// changed the size returned to reflect
|
1999-12-02 01:07:27 +00:00
|
|
|
sz += GET_WIDTH(info->calculatedSize);
|
1999-11-18 21:05:43 +00:00
|
|
|
|
|
|
|
info = info->next;
|
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool limit = PR_TRUE;
|
|
|
|
for (int pass=1; PR_TRUE == limit; pass++) {
|
|
|
|
limit = PR_FALSE;
|
1999-11-18 21:05:43 +00:00
|
|
|
info = first;
|
|
|
|
while(info) {
|
1999-06-30 22:17:43 +00:00
|
|
|
// ignore collapsed springs
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_IS_COLLAPSED) {
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-06-30 22:17:43 +00:00
|
|
|
continue;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
1999-06-30 22:17:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
nscoord pref = GET_WIDTH(info->prefSize);
|
|
|
|
nscoord max = GET_WIDTH(info->maxSize);
|
|
|
|
nscoord min = GET_WIDTH(info->minSize);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (!(info->mFlags & NS_FRAME_BOX_SIZE_VALID)) {
|
1999-12-02 01:07:27 +00:00
|
|
|
PRInt32 newSize = pref + (sizeRemaining*info->flex/springConstantsRemaining);
|
1999-05-09 21:46:24 +00:00
|
|
|
if (newSize<=min) {
|
1999-12-07 22:10:45 +00:00
|
|
|
SET_WIDTH(info->calculatedSize, min);
|
1999-11-18 21:05:43 +00:00
|
|
|
springConstantsRemaining -= info->flex;
|
1999-05-09 21:46:24 +00:00
|
|
|
sizeRemaining += pref;
|
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-09 22:02:40 +00:00
|
|
|
sizeRemaining -= min;
|
1999-03-27 01:35:55 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
1999-03-27 01:35:55 +00:00
|
|
|
limit = PR_TRUE;
|
|
|
|
}
|
1999-05-09 21:46:24 +00:00
|
|
|
else if (newSize>=max) {
|
1999-12-07 22:10:45 +00:00
|
|
|
SET_WIDTH(info->calculatedSize, max);
|
1999-11-18 21:05:43 +00:00
|
|
|
springConstantsRemaining -= info->flex;
|
1999-05-09 21:46:24 +00:00
|
|
|
sizeRemaining += pref;
|
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-09 22:02:40 +00:00
|
|
|
sizeRemaining -= max;
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
1999-03-27 01:35:55 +00:00
|
|
|
limit = PR_TRUE;
|
|
|
|
}
|
|
|
|
}
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
}
|
1999-05-09 21:46:24 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nscoord& s = GET_WIDTH(aGivenSize);
|
|
|
|
s = 0;
|
|
|
|
aMaxAscent = 0;
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
info = first;
|
|
|
|
while(info) {
|
1999-06-30 22:17:43 +00:00
|
|
|
|
|
|
|
// ignore collapsed springs
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_IS_COLLAPSED) {
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-06-30 22:17:43 +00:00
|
|
|
continue;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
1999-06-30 22:17:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
nscoord pref = GET_WIDTH(info->prefSize);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (!(info->mFlags & NS_FRAME_BOX_SIZE_VALID)) {
|
1999-12-07 22:10:45 +00:00
|
|
|
if (springConstantsRemaining == 0) {
|
|
|
|
SET_WIDTH(info->calculatedSize, pref);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
SET_WIDTH(info->calculatedSize, pref + info->flex*sizeRemaining/springConstantsRemaining);
|
|
|
|
}
|
1999-12-02 01:07:27 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_SIZE_VALID;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
s += GET_WIDTH(info->calculatedSize);
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
if (info->ascent > aMaxAscent)
|
|
|
|
aMaxAscent = info->ascent;
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
1999-03-27 01:35:55 +00:00
|
|
|
}
|
|
|
|
|
1999-09-05 20:46:59 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
nsBoxFrame::GetChildBoxInfo(PRInt32 aIndex, nsBoxInfo& aSize)
|
|
|
|
{
|
1999-11-18 21:05:43 +00:00
|
|
|
PRInt32 infoCount = mInner->mInfoList->GetCount();
|
|
|
|
|
|
|
|
NS_ASSERTION(aIndex >= 0 && aIndex < infoCount,"Index out of bounds!!");
|
|
|
|
|
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
|
|
|
|
|
|
|
for (PRInt32 i=0; i< infoCount; i++) {
|
|
|
|
if (i == aIndex)
|
|
|
|
break;
|
|
|
|
info = info->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
aSize = *info;
|
1999-09-05 20:46:59 +00:00
|
|
|
}
|
|
|
|
|
1999-08-19 03:51:25 +00:00
|
|
|
// Marks the frame as dirty and generates an incremental reflow
|
|
|
|
// command targeted at this frame
|
|
|
|
nsresult
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::GenerateDirtyReflowCommand(nsIPresContext* aPresContext,
|
1999-08-19 03:51:25 +00:00
|
|
|
nsIPresShell& aPresShell)
|
|
|
|
{
|
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-09 22:02:40 +00:00
|
|
|
/*
|
1999-08-19 03:51:25 +00:00
|
|
|
nsCOMPtr<nsIReflowCommand> reflowCmd;
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
mState |= NS_FRAME_IS_DIRTY;
|
|
|
|
rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), this,
|
|
|
|
nsIReflowCommand::ReflowDirty);
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
// Add the reflow command
|
|
|
|
rv = aPresShell.AppendReflowCommand(reflowCmd);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
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-09 22:02:40 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
// ask out parent to dirty things.
|
|
|
|
mState |= NS_FRAME_IS_DIRTY;
|
|
|
|
return mParent->ReflowDirtyChild(&aPresShell, this);
|
1999-08-19 03:51:25 +00:00
|
|
|
}
|
1999-05-09 21:46:24 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::RemoveFrame(nsIPresContext* aPresContext,
|
1999-05-09 21:46:24 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aOldFrame)
|
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
// remove child from our info list
|
|
|
|
mInner->mInfoList->Remove(aOldFrame);
|
1999-08-19 03:51:25 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// remove the child frame
|
|
|
|
mFrames.DestroyFrame(aPresContext, aOldFrame);
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// mark us dirty and generate a reflow command
|
|
|
|
return GenerateDirtyReflowCommand(aPresContext, aPresShell);
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
2000-02-17 04:10:02 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsBoxFrame::Destroy(nsIPresContext* aPresContext)
|
|
|
|
{
|
|
|
|
|
|
|
|
// if we are root remove 1 from the debug count.
|
|
|
|
if (mState & NS_STATE_IS_ROOT && nsBoxDebugInner::gDebug > 0)
|
|
|
|
{
|
|
|
|
nsBoxDebugInner::gDebug--;
|
|
|
|
if (nsBoxDebugInner::gDebug == 0)
|
|
|
|
{
|
|
|
|
NS_RELEASE(mInner->mDebugInner->mHorizontalDebugStyle);
|
|
|
|
NS_RELEASE(mInner->mDebugInner->mVerticalDebugStyle);
|
|
|
|
mInner->mDebugInner->mHorizontalDebugStyle = nsnull;
|
|
|
|
mInner->mDebugInner->mVerticalDebugStyle = nsnull;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsHTMLContainerFrame::Destroy(aPresContext);
|
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::InsertFrames(nsIPresContext* aPresContext,
|
1999-05-09 21:46:24 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aPrevFrame,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
// insert the frames to our info list
|
|
|
|
mInner->mInfoList->Insert(aPrevFrame, aFrameList);
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
// insert the frames in out regular frame list
|
2000-02-16 23:00:52 +00:00
|
|
|
mFrames.InsertFrames(this, aPrevFrame, aFrameList);
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
// mark us dirty and generate a reflow command
|
|
|
|
return GenerateDirtyReflowCommand(aPresContext, aPresShell);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::AppendFrames(nsIPresContext* aPresContext,
|
1999-05-09 21:46:24 +00:00
|
|
|
nsIPresShell& aPresShell,
|
|
|
|
nsIAtom* aListName,
|
|
|
|
nsIFrame* aFrameList)
|
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
|
|
|
|
|
|
|
// append them after
|
1999-11-18 21:05:43 +00:00
|
|
|
mInner->mInfoList->Append(aFrameList);
|
1999-05-18 04:06:52 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
// append in regular frames
|
2000-02-16 23:00:52 +00:00
|
|
|
mFrames.AppendFrames(this, aFrameList);
|
1999-08-19 03:51:25 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
mInner->SanityCheck();
|
|
|
|
|
1999-08-19 03:51:25 +00:00
|
|
|
// mark us dirty and generate a reflow command
|
|
|
|
return GenerateDirtyReflowCommand(aPresContext, aPresShell);
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-05-09 21:46:24 +00:00
|
|
|
nsBoxFrame::AttributeChanged(nsIPresContext* aPresContext,
|
|
|
|
nsIContent* aChild,
|
1999-10-15 23:16:45 +00:00
|
|
|
PRInt32 aNameSpaceID,
|
1999-05-09 21:46:24 +00:00
|
|
|
nsIAtom* aAttribute,
|
|
|
|
PRInt32 aHint)
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-05-09 21:46:24 +00:00
|
|
|
nsresult rv = nsHTMLContainerFrame::AttributeChanged(aPresContext, aChild,
|
1999-10-15 23:16:45 +00:00
|
|
|
aNameSpaceID, aAttribute, aHint);
|
1999-05-09 21:46:24 +00:00
|
|
|
|
2000-01-09 23:09:10 +00:00
|
|
|
return rv;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Goes though each child asking for its size to determine our size. Returns our box size minus our border.
|
|
|
|
* This method is defined in nsIBox interface.
|
|
|
|
*/
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::GetBoxInfo(nsIPresContext* aPresContext, const nsHTMLReflowState& aReflowState, nsBoxInfo& aSize)
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
2000-02-10 21:36:28 +00:00
|
|
|
nsMargin debugInset(0,0,0,0);
|
|
|
|
mInner->GetDebugInset(debugInset);
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
nsresult rv;
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
aSize.Clear();
|
2000-02-14 01:42:09 +00:00
|
|
|
GetDefaultFlex(aSize.flex);
|
1999-06-30 22:17:43 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// run through all the children and get there min, max, and preferred sizes
|
|
|
|
// return us the size of the box
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
nsCalculatedBoxInfo* info = mInner->mInfoList->GetFirst();
|
1999-06-30 22:17:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
while (info)
|
1999-11-18 21:05:43 +00:00
|
|
|
{
|
|
|
|
// if a child needs recalculation then ask it for its size. Otherwise
|
|
|
|
// just use the size we already have.
|
2000-02-14 01:42:09 +00:00
|
|
|
if (info->mFlags & NS_FRAME_BOX_NEEDS_RECALC)
|
1999-11-18 21:05:43 +00:00
|
|
|
{
|
|
|
|
// see if the child is collapsed
|
|
|
|
const nsStyleDisplay* disp;
|
1999-12-02 01:07:27 +00:00
|
|
|
info->frame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)disp));
|
1999-11-18 21:05:43 +00:00
|
|
|
|
|
|
|
// if collapsed then the child will have no size
|
1999-12-15 00:10:24 +00:00
|
|
|
// don't unset needsRecalc - therefore cause us
|
|
|
|
// to be recalculated when we are uncollapsed
|
1999-11-18 21:05:43 +00:00
|
|
|
if (disp->mVisible == NS_STYLE_VISIBILITY_COLLAPSE)
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags |= NS_FRAME_BOX_IS_COLLAPSED;
|
1999-11-18 21:05:43 +00:00
|
|
|
else {
|
|
|
|
// get the size of the child. This is the min, max, preferred, and spring constant
|
|
|
|
// it does not include its border.
|
1999-12-02 01:07:27 +00:00
|
|
|
rv = GetChildBoxInfo(aPresContext, aReflowState, info->frame, *info);
|
2000-02-10 21:36:28 +00:00
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
/*
|
2000-02-10 21:36:28 +00:00
|
|
|
// make sure we can see the debug info
|
|
|
|
if (info->prefSize.width < debugInset.left)
|
|
|
|
info->prefSize.width = debugInset.left;
|
|
|
|
|
|
|
|
if (info->prefSize.height < debugInset.top)
|
|
|
|
info->prefSize.height = debugInset.top;
|
2000-02-16 23:00:52 +00:00
|
|
|
*/
|
2000-02-10 21:36:28 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
NS_ASSERTION(rv == NS_OK,"failed to child box info");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
// add in the child's margin and border/padding if there is one.
|
|
|
|
const nsStyleSpacing* spacing;
|
1999-12-02 01:07:27 +00:00
|
|
|
rv = info->frame->GetStyleData(eStyleStruct_Spacing,
|
1999-11-18 21:05:43 +00:00
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
|
|
|
NS_ASSERTION(rv == NS_OK,"failed to get spacing info");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsMargin margin(0,0,0,0);
|
|
|
|
spacing->GetMargin(margin);
|
|
|
|
nsSize m(margin.left+margin.right,margin.top+margin.bottom);
|
|
|
|
info->minSize += m;
|
|
|
|
info->prefSize += m;
|
|
|
|
if (info->maxSize.width != NS_INTRINSICSIZE)
|
|
|
|
info->maxSize.width += m.width;
|
|
|
|
|
|
|
|
if (info->maxSize.height != NS_INTRINSICSIZE)
|
|
|
|
info->maxSize.height += m.height;
|
|
|
|
|
|
|
|
spacing->GetBorderPadding(margin);
|
|
|
|
nsSize b(margin.left+margin.right,margin.top+margin.bottom);
|
|
|
|
info->minSize += b;
|
|
|
|
info->prefSize += b;
|
|
|
|
if (info->maxSize.width != NS_INTRINSICSIZE)
|
|
|
|
info->maxSize.width += b.width;
|
|
|
|
|
|
|
|
if (info->maxSize.height != NS_INTRINSICSIZE)
|
|
|
|
info->maxSize.height += b.height;
|
1999-09-10 23:38:58 +00:00
|
|
|
|
1999-12-15 00:10:24 +00:00
|
|
|
// ok we don't need to calc this guy again
|
2000-02-14 01:42:09 +00:00
|
|
|
info->mFlags &= ~NS_FRAME_BOX_NEEDS_RECALC;
|
1999-12-15 00:10:24 +00:00
|
|
|
}
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AddChildSize(aSize, *info);
|
1999-06-30 22:17:43 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
// if horizontal get the largest child's ascent
|
|
|
|
if (mState & NS_STATE_IS_HORIZONTAL) {
|
|
|
|
if (info->ascent > aSize.ascent)
|
|
|
|
aSize.ascent = info->ascent;
|
|
|
|
} else {
|
|
|
|
// if vertical then get the last child's ascent.
|
|
|
|
if (info->next)
|
|
|
|
aSize.ascent += info->prefSize.height;
|
|
|
|
else
|
|
|
|
aSize.ascent += info->ascent;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
info = info->next;
|
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
// add the insets into our size. This is merely some extra space subclasses like toolbars
|
|
|
|
// can place around us. Toolbars use it to place extra control like grippies around things.
|
|
|
|
nsMargin inset(0,0,0,0);
|
|
|
|
GetInset(inset);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
inset += debugInset;
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
nsSize in(inset.left+inset.right,inset.top+inset.bottom);
|
|
|
|
aSize.minSize += in;
|
|
|
|
aSize.prefSize += in;
|
1999-03-27 01:35:55 +00:00
|
|
|
|
2000-02-16 23:00:52 +00: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-09 22:02:40 +00:00
|
|
|
// make sure we can see the debug info
|
|
|
|
if (aSize.maxSize.width < debugInset.left + debugInset.right)
|
|
|
|
aSize.maxSize.width = debugInset.left + debugInset.right;
|
|
|
|
|
|
|
|
if (aSize.maxSize.height < debugInset.top + debugInset.bottom)
|
|
|
|
aSize.maxSize.height = debugInset.top + debugInset.bottom;
|
2000-02-16 23:00:52 +00: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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
aSize.ascent += inset.top;
|
|
|
|
aSize.ascent += debugInset.top;
|
|
|
|
|
1999-03-27 01:35:55 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
void
|
|
|
|
nsBoxFrame::AddChildSize(nsBoxInfo& aInfo, nsBoxInfo& aChildInfo)
|
|
|
|
{
|
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-09 22:02:40 +00:00
|
|
|
// if the child is not flexible then its min, max, is the same as its pref.
|
|
|
|
if (aChildInfo.flex == 0) {
|
1999-10-29 22:13:57 +00: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-09 22:02:40 +00:00
|
|
|
nsSize min(aChildInfo.minSize);
|
|
|
|
nsSize max(aChildInfo.maxSize);
|
|
|
|
nsSize pref(aChildInfo.prefSize);
|
1999-05-09 21:46:24 +00: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-09 22:02:40 +00:00
|
|
|
SET_WIDTH(min, GET_WIDTH(pref));
|
|
|
|
SET_WIDTH(max, GET_WIDTH(pref));
|
1999-07-14 17:32:43 +00: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-09 22:02:40 +00:00
|
|
|
AddSize(min, aInfo.minSize, PR_FALSE);
|
|
|
|
AddSize(max, aInfo.maxSize, PR_TRUE);
|
|
|
|
AddSize(pref, aInfo.prefSize, PR_FALSE);
|
|
|
|
} else {
|
|
|
|
// now that we know our child's min, max, pref sizes figure OUR size from them.
|
|
|
|
AddSize(aChildInfo.minSize, aInfo.minSize, PR_FALSE);
|
|
|
|
AddSize(aChildInfo.maxSize, aInfo.maxSize, PR_TRUE);
|
|
|
|
AddSize(aChildInfo.prefSize, aInfo.prefSize, PR_FALSE);
|
1999-12-02 01:07:27 +00:00
|
|
|
}
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
1999-07-23 00:11:21 +00:00
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame :: Paint ( nsIPresContext* aPresContext,
|
1999-07-23 00:11:21 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
|
|
|
{
|
|
|
|
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
|
|
|
mStyleContext->GetStyleData(eStyleStruct_Display);
|
|
|
|
|
|
|
|
// if we aren't visible then we are done.
|
|
|
|
if (!disp->mVisible)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
// if we are visible then tell our superclass to paint
|
|
|
|
nsresult r = nsHTMLContainerFrame::Paint(aPresContext, aRenderingContext, aDirtyRect,
|
|
|
|
aWhichLayer);
|
1999-09-10 00:57:01 +00:00
|
|
|
|
1999-08-27 06:06:39 +00:00
|
|
|
if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {
|
1999-09-10 00:57:01 +00:00
|
|
|
if (mInner->mDebugInner) {
|
|
|
|
mInner->mDebugInner->PaintSprings(aPresContext, aRenderingContext, aDirtyRect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
#ifdef DEBUG_REFLOW
|
|
|
|
if (mInner->reflowCount == gViewPortReflowCount) {
|
|
|
|
if (!mInner->mResized)
|
|
|
|
aRenderingContext.SetColor(NS_RGB(255,0,0));
|
|
|
|
else
|
|
|
|
aRenderingContext.SetColor(NS_RGB(0,255,0));
|
|
|
|
|
|
|
|
aRenderingContext.DrawRect(nsRect(0,0,mRect.width, mRect.height));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
*/
|
1999-09-10 00:57:01 +00:00
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Paint one child frame
|
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::PaintChild(nsIPresContext* aPresContext,
|
1999-09-10 00:57:01 +00:00
|
|
|
nsIRenderingContext& aRenderingContext,
|
|
|
|
const nsRect& aDirtyRect,
|
|
|
|
nsIFrame* aFrame,
|
|
|
|
nsFramePaintLayer aWhichLayer)
|
|
|
|
{
|
|
|
|
const nsStyleDisplay* disp;
|
|
|
|
aFrame->GetStyleData(eStyleStruct_Display, ((const nsStyleStruct *&)disp));
|
|
|
|
|
|
|
|
// if collapsed don't paint the child.
|
|
|
|
if (disp->mVisible == NS_STYLE_VISIBILITY_COLLAPSE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
nsHTMLContainerFrame::PaintChild(aPresContext, aRenderingContext, aDirtyRect, aFrame, aWhichLayer);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxDebugInner::PaintSprings(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, const nsRect& aDirtyRect)
|
1999-09-10 00:57:01 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
// remove our border
|
|
|
|
const nsStyleSpacing* spacing;
|
1999-10-20 00:46:21 +00:00
|
|
|
mOuter->GetStyleData(eStyleStruct_Spacing,
|
1999-08-27 06:06:39 +00:00
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
|
|
|
nsMargin border(0,0,0,0);
|
|
|
|
spacing->GetBorderPadding(border);
|
1999-09-10 00:57:01 +00:00
|
|
|
|
1999-08-27 06:06:39 +00:00
|
|
|
float p2t;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-08-27 06:06:39 +00:00
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
nsIStyleContext* debugStyle;
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL)
|
1999-09-10 00:57:01 +00:00
|
|
|
debugStyle = mHorizontalDebugStyle;
|
|
|
|
else
|
|
|
|
debugStyle = mVerticalDebugStyle;
|
1999-08-27 06:06:39 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (debugStyle == nsnull)
|
|
|
|
return;
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
const nsStyleSpacing* debugSpacing =
|
|
|
|
(const nsStyleSpacing*)debugStyle->GetStyleData(eStyleStruct_Spacing);
|
|
|
|
const nsStyleColor* debugColor =
|
|
|
|
(const nsStyleColor*)debugStyle->GetStyleData(eStyleStruct_Color);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-09-14 22:17:19 +00:00
|
|
|
nsMargin margin(0,0,0,0);
|
|
|
|
debugSpacing->GetMargin(margin);
|
|
|
|
|
|
|
|
border += margin;
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
nsRect inner(0,0,mOuter->mRect.width, mOuter->mRect.height);
|
|
|
|
inner.Deflate(border);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
// paint our debug border
|
|
|
|
nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mOuter,
|
|
|
|
aDirtyRect, inner, *debugSpacing, debugStyle, 0);
|
|
|
|
|
|
|
|
// get the debug border dimensions
|
|
|
|
nsMargin debugBorder(0,0,0,0);
|
|
|
|
debugSpacing->GetBorderPadding(debugBorder);
|
|
|
|
|
|
|
|
|
|
|
|
// paint the springs.
|
|
|
|
nscoord x, y, borderSize, springSize;
|
|
|
|
|
|
|
|
|
|
|
|
aRenderingContext.SetColor(debugColor->mColor);
|
|
|
|
|
1999-08-27 06:06:39 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL)
|
1999-09-10 00:57:01 +00:00
|
|
|
{
|
|
|
|
x = inner.x;
|
|
|
|
y = inner.y + onePixel;
|
|
|
|
x += debugBorder.left;
|
1999-09-14 22:17:19 +00:00
|
|
|
springSize = debugBorder.top - onePixel*4;
|
1999-08-27 06:06:39 +00:00
|
|
|
} else {
|
1999-09-10 00:57:01 +00:00
|
|
|
x = inner.y;
|
|
|
|
y = inner.x + onePixel;
|
|
|
|
x += debugBorder.top;
|
1999-09-14 22:17:19 +00:00
|
|
|
springSize = debugBorder.left - onePixel*4;
|
1999-09-10 00:57:01 +00:00
|
|
|
}
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
nsCalculatedBoxInfo* info = mOuter->GetInfoList()->GetFirst();
|
1999-11-18 21:05:43 +00:00
|
|
|
while (info) {
|
|
|
|
nsSize& size = info->calculatedSize;
|
2000-02-14 01:42:09 +00:00
|
|
|
if (!(info->mFlags & NS_FRAME_BOX_IS_COLLAPSED)) {
|
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL)
|
1999-09-10 00:57:01 +00:00
|
|
|
borderSize = size.width;
|
|
|
|
else
|
|
|
|
borderSize = size.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-09 22:02:40 +00:00
|
|
|
/*
|
|
|
|
if (mDebugChild == info->frame)
|
|
|
|
{
|
|
|
|
aRenderingContext.SetColor(NS_RGB(0,255,0));
|
|
|
|
if (mOuter->mInner->mHorizontal)
|
|
|
|
aRenderingContext.FillRect(x, inner.y, size.width, debugBorder.top);
|
|
|
|
else
|
|
|
|
aRenderingContext.FillRect(inner.x, x, size.height, debugBorder.left);
|
|
|
|
aRenderingContext.SetColor(debugColor->mColor);
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
DrawSpring(aPresContext, aRenderingContext, info->flex, x, y, borderSize, springSize);
|
1999-09-10 00:57:01 +00:00
|
|
|
x += borderSize;
|
|
|
|
}
|
1999-11-18 21:05:43 +00:00
|
|
|
info = info->next;
|
1999-08-27 06:06:39 +00:00
|
|
|
}
|
1999-09-10 00:57:01 +00:00
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
void
|
|
|
|
nsBoxDebugInner::DrawLine(nsIRenderingContext& aRenderingContext, nscoord x1, nscoord y1, nscoord x2, nscoord y2)
|
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL)
|
1999-09-10 00:57:01 +00:00
|
|
|
aRenderingContext.DrawLine(x1,y1,x2,y2);
|
|
|
|
else
|
|
|
|
aRenderingContext.DrawLine(y1,x1,y2,x2);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsBoxDebugInner::FillRect(nsIRenderingContext& aRenderingContext, nscoord x, nscoord y, nscoord width, nscoord height)
|
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL)
|
1999-09-10 00:57:01 +00:00
|
|
|
aRenderingContext.FillRect(x,y,width,height);
|
|
|
|
else
|
|
|
|
aRenderingContext.FillRect(y,x,height,width);
|
|
|
|
}
|
1999-08-27 06:06:39 +00:00
|
|
|
|
|
|
|
void
|
1999-12-02 01:07:27 +00:00
|
|
|
nsBoxDebugInner::DrawSpring(nsIPresContext* aPresContext, nsIRenderingContext& aRenderingContext, PRInt32 flex, nscoord x, nscoord y, nscoord size, nscoord springSize)
|
2000-02-14 01:42:09 +00:00
|
|
|
{
|
1999-08-27 06:06:39 +00:00
|
|
|
float p2t;
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
1999-08-27 06:06:39 +00:00
|
|
|
nscoord onePixel = NSIntPixelsToTwips(1, p2t);
|
|
|
|
|
|
|
|
// if we do draw the coils
|
|
|
|
int distance = 0;
|
|
|
|
int center = 0;
|
|
|
|
int offset = 0;
|
|
|
|
int coilSize = COIL_SIZE*onePixel;
|
|
|
|
int halfSpring = springSize/2;
|
|
|
|
|
|
|
|
distance = size;
|
|
|
|
center = y + halfSpring;
|
|
|
|
offset = x;
|
|
|
|
|
|
|
|
int coils = distance/coilSize;
|
|
|
|
|
|
|
|
int halfCoilSize = coilSize/2;
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
if (flex == 0) {
|
1999-09-10 00:57:01 +00:00
|
|
|
DrawLine(aRenderingContext, x,y + springSize/2, x + size, y + springSize/2);
|
|
|
|
} else {
|
|
|
|
for (int i=0; i < coils; i++)
|
|
|
|
{
|
|
|
|
DrawLine(aRenderingContext, offset, center+halfSpring, offset+halfCoilSize, center-halfSpring);
|
|
|
|
DrawLine(aRenderingContext, offset+halfCoilSize, center-halfSpring, offset+coilSize, center+halfSpring);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
offset += coilSize;
|
|
|
|
}
|
1999-08-27 06:06:39 +00:00
|
|
|
}
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
FillRect(aRenderingContext, x + size - springSize/2, y, springSize/2, springSize);
|
|
|
|
FillRect(aRenderingContext, x, y, springSize/2, springSize);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
|
|
|
//DrawKnob(aPresContext, aRenderingContext, x + size - springSize, y, springSize);
|
1999-09-10 00:57:01 +00:00
|
|
|
}
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
void
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrameInner::UpdatePseudoElements(nsIPresContext* aPresContext)
|
1999-08-27 06:06:39 +00:00
|
|
|
{
|
2000-02-17 04:10:02 +00:00
|
|
|
if (mDebugInner->mHorizontalDebugStyle || mDebugInner->mVerticalDebugStyle)
|
|
|
|
return;
|
1999-09-10 00:57:01 +00:00
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
GetContentOf(mOuter, getter_AddRefs(content));
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
nsCOMPtr<nsIAtom> atom ( getter_AddRefs(NS_NewAtom(":-moz-horizontal-box-debug")) );
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->ProbePseudoStyleContextFor(content, atom, mOuter->mStyleContext,
|
1999-09-10 00:57:01 +00:00
|
|
|
PR_FALSE,
|
2000-02-17 04:10:02 +00:00
|
|
|
&mDebugInner->mHorizontalDebugStyle);
|
1999-09-10 00:57:01 +00:00
|
|
|
|
|
|
|
atom = getter_AddRefs(NS_NewAtom(":-moz-vertical-box-debug"));
|
1999-11-24 06:03:41 +00:00
|
|
|
aPresContext->ProbePseudoStyleContextFor(content, atom, mOuter->mStyleContext,
|
1999-09-10 00:57:01 +00:00
|
|
|
PR_FALSE,
|
2000-02-17 04:10:02 +00:00
|
|
|
&mDebugInner->mVerticalDebugStyle);
|
1999-09-10 00:57:01 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
aPresContext->GetScaledPixelsToTwips(&mDebugInner->mP2t);
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
}
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-08-27 06:06:39 +00:00
|
|
|
void
|
1999-09-10 00:57:01 +00:00
|
|
|
nsBoxFrameInner::GetDebugInset(nsMargin& inset)
|
1999-08-27 06:06:39 +00:00
|
|
|
{
|
1999-09-10 00:57:01 +00:00
|
|
|
inset.SizeTo(0,0,0,0);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
2000-02-17 04:10:02 +00:00
|
|
|
if (nsBoxDebugInner::gDebug > 0)
|
1999-09-10 00:57:01 +00:00
|
|
|
{
|
|
|
|
nsIStyleContext* style;
|
2000-02-14 01:42:09 +00:00
|
|
|
if (mOuter->mState & NS_STATE_IS_HORIZONTAL)
|
1999-09-10 00:57:01 +00:00
|
|
|
style = mDebugInner->mHorizontalDebugStyle;
|
|
|
|
else
|
|
|
|
style = mDebugInner->mVerticalDebugStyle;
|
1999-08-27 06:06:39 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (style == nsnull)
|
|
|
|
return;
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
const nsStyleSpacing* debugSpacing =
|
|
|
|
(const nsStyleSpacing*)style->GetStyleData(eStyleStruct_Spacing);
|
1999-08-27 06:06:39 +00:00
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
debugSpacing->GetBorderPadding(inset);
|
1999-09-14 22:17:19 +00:00
|
|
|
nsMargin margin(0,0,0,0);
|
|
|
|
debugSpacing->GetMargin(margin);
|
|
|
|
inset += margin;
|
1999-09-10 00:57:01 +00:00
|
|
|
}
|
1999-07-23 00:11:21 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
NS_IMETHODIMP_(nsrefcnt)
|
|
|
|
nsBoxFrame::AddRef(void)
|
1999-03-27 01:35:55 +00:00
|
|
|
{
|
1999-05-09 21:46:24 +00:00
|
|
|
return NS_OK;
|
|
|
|
}
|
1999-03-27 01:35:55 +00: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-09 22:02:40 +00:00
|
|
|
NS_IMETHODIMP_(nsrefcnt)
|
1999-05-09 21:46:24 +00:00
|
|
|
nsBoxFrame::Release(void)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-12-21 19:28:15 +00:00
|
|
|
NS_INTERFACE_MAP_BEGIN(nsBoxFrame)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIBox)
|
2000-02-10 00:38:59 +00:00
|
|
|
#ifdef NS_DEBUG
|
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-09 22:02:40 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIFrameDebug)
|
2000-02-10 00:38:59 +00:00
|
|
|
#endif
|
1999-12-21 19:28:15 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIBox)
|
2000-01-26 22:33:44 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsHTMLContainerFrame)
|
1999-12-21 19:28:15 +00:00
|
|
|
|
|
|
|
|
1999-07-14 17:32:43 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsBoxFrame::GetFrameName(nsString& aResult) const
|
|
|
|
{
|
2000-02-14 01:42:09 +00:00
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
nsIFrame* frame = (nsIFrame*)this;
|
|
|
|
mInner->GetContentOf(frame, getter_AddRefs(content));
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
nsString id;
|
2000-02-14 01:42:09 +00:00
|
|
|
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);
|
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-09 22:02:40 +00:00
|
|
|
|
|
|
|
aResult = "Box[id=";
|
|
|
|
aResult.Append(id);
|
|
|
|
aResult.Append("]");
|
|
|
|
return NS_OK;
|
1999-07-14 17:32:43 +00:00
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
//static PRInt32 gBoxInfoCount = 0;
|
1999-11-18 21:05:43 +00:00
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
nsCalculatedBoxInfoImpl::nsCalculatedBoxInfoImpl(nsIFrame* aFrame)
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
1999-11-18 21:05:43 +00:00
|
|
|
//gBoxInfoCount++;
|
1999-12-02 01:07:27 +00:00
|
|
|
// printf("created Info=%d\n",gBoxInfoCount);
|
1999-11-18 21:05:43 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
mFlags = NS_FRAME_BOX_NEEDS_RECALC;
|
1999-12-02 01:07:27 +00:00
|
|
|
next = nsnull;
|
|
|
|
calculatedSize.width = 0;
|
|
|
|
calculatedSize.height = 0;
|
|
|
|
frame = aFrame;
|
2000-02-14 01:42:09 +00:00
|
|
|
prefSize.width = 0;
|
|
|
|
prefSize.height = 0;
|
|
|
|
minSize.width = 0;
|
|
|
|
minSize.height = 0;
|
|
|
|
ascent = 0;
|
|
|
|
flex = 0;
|
|
|
|
maxSize.width = NS_INTRINSICSIZE;
|
|
|
|
maxSize.height = NS_INTRINSICSIZE;
|
1999-05-09 21:46:24 +00:00
|
|
|
}
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
nsCalculatedBoxInfoImpl::~nsCalculatedBoxInfoImpl()
|
1999-07-23 00:11:21 +00:00
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
// gBoxInfoCount--;
|
|
|
|
// printf("deleted Info=%d\n",gBoxInfoCount);
|
1999-07-23 00:11:21 +00:00
|
|
|
}
|
|
|
|
|
1999-05-09 21:46:24 +00:00
|
|
|
void
|
1999-12-02 01:07:27 +00:00
|
|
|
nsCalculatedBoxInfoImpl::Clear()
|
1999-05-09 21:46:24 +00:00
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
nsBoxInfo::Clear();
|
1999-11-18 21:05:43 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
mFlags = NS_FRAME_BOX_NEEDS_RECALC;
|
1999-05-09 21:46:24 +00:00
|
|
|
|
|
|
|
calculatedSize.width = 0;
|
|
|
|
calculatedSize.height = 0;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
//prefWidthIntrinsic = PR_TRUE;
|
|
|
|
//prefHeightIntrinsic = PR_TRUE;
|
1999-12-02 01:07:27 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
1999-09-10 00:57:01 +00:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-10-26 04:44:41 +00:00
|
|
|
nsBoxFrame::GetFrameForPoint(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
1999-09-10 00:57:01 +00:00
|
|
|
nsIFrame** aFrame)
|
|
|
|
{
|
1999-10-26 04:44:41 +00:00
|
|
|
nsresult rv = nsHTMLContainerFrame::GetFrameForPoint(aPresContext, aPoint, aFrame);
|
1999-09-10 00:57:01 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsBoxDebugInner::GetValue(const nsSize& a, const nsSize& b, char* ch)
|
|
|
|
{
|
|
|
|
char width[100];
|
|
|
|
char height[100];
|
|
|
|
|
|
|
|
if (a.width == NS_INTRINSICSIZE)
|
|
|
|
sprintf(width,"%s","INF");
|
|
|
|
else
|
|
|
|
sprintf(width,"%d", nscoord(a.width/mP2t));
|
|
|
|
|
|
|
|
if (a.height == NS_INTRINSICSIZE)
|
|
|
|
sprintf(height,"%s","INF");
|
|
|
|
else
|
|
|
|
sprintf(height,"%d", nscoord(a.height/mP2t));
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(ch, "(%s%s, %s%s)", width, (b.width != NS_INTRINSICSIZE ? "[CSS]" : ""),
|
|
|
|
height, (b.height != NS_INTRINSICSIZE ? "[CSS]" : ""));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
1999-12-02 01:07:27 +00:00
|
|
|
nsBoxDebugInner::GetValue(PRInt32 a, PRInt32 b, char* ch)
|
1999-09-10 00:57:01 +00:00
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
sprintf(ch, "(%d)", a);
|
1999-09-10 00:57:01 +00: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-09 22:02:40 +00:00
|
|
|
PRBool
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext* aPresContext,
|
1999-10-12 00:16:06 +00:00
|
|
|
nsPoint& aPoint,
|
|
|
|
PRInt32& aCursor)
|
|
|
|
{
|
|
|
|
nscoord x = aPoint.x;
|
|
|
|
nscoord y = aPoint.y;
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
// get the area inside our border.
|
2000-02-09 23:18:40 +00:00
|
|
|
nsRect insideBorder(0,0,mOuter->mRect.width, mOuter->mRect.height);
|
1999-10-12 00:16:06 +00: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-09 22:02:40 +00:00
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
nsresult rv = mOuter->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
|
|
|
NS_ASSERTION(rv == NS_OK,"failed to get spacing");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
nsMargin border;
|
|
|
|
spacing->GetBorderPadding(border);
|
|
|
|
|
2000-02-09 23:18:40 +00:00
|
|
|
insideBorder.Deflate(border);
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
PRBool isHorizontal = mOuter->mState & NS_STATE_IS_HORIZONTAL;
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2000-02-09 23:18:40 +00:00
|
|
|
if (!insideBorder.Contains(nsPoint(x,y)))
|
1999-10-20 00:46:21 +00:00
|
|
|
return NS_OK;
|
1999-10-12 00:16:06 +00: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-09 22:02:40 +00:00
|
|
|
//printf("%%%%%% inside box %%%%%%%\n");
|
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
int count = 0;
|
1999-12-02 01:07:27 +00:00
|
|
|
nsCalculatedBoxInfo* info = mOuter->GetInfoList()->GetFirst();
|
1999-11-18 21:05:43 +00: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-09 22:02:40 +00:00
|
|
|
nsMargin m;
|
|
|
|
mOuter->mInner->GetDebugInset(m);
|
|
|
|
|
2000-02-09 23:18:40 +00:00
|
|
|
if ((isHorizontal && y < insideBorder.y + m.top) ||
|
|
|
|
(!isHorizontal && x < insideBorder.x + m.left)) {
|
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-09 22:02:40 +00:00
|
|
|
//printf("**** inside debug border *******\n");
|
|
|
|
while (info)
|
|
|
|
{
|
|
|
|
nsIFrame* childFrame = info->frame;
|
|
|
|
nsRect r;
|
|
|
|
childFrame->GetRect(r);
|
|
|
|
|
|
|
|
// if we are not in the child. But in the spring above the child.
|
|
|
|
if ((isHorizontal && x >= r.x && x < r.x + r.width) ||
|
|
|
|
(!isHorizontal && y >= r.y && y < r.y + r.height)) {
|
|
|
|
aCursor = NS_STYLE_CURSOR_POINTER;
|
|
|
|
// found it but we already showed it.
|
|
|
|
if (mDebugChild == childFrame)
|
|
|
|
return PR_TRUE;
|
|
|
|
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mOuter->mInner->GetContentOf(mOuter, getter_AddRefs(content));
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
nsString id;
|
|
|
|
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);
|
|
|
|
char idValue[100];
|
|
|
|
id.ToCString(idValue,100);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
nsString kClass;
|
|
|
|
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, kClass);
|
|
|
|
char kClassValue[100];
|
|
|
|
kClass.ToCString(kClassValue,100);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAtom> tag;
|
|
|
|
content->GetTag(*getter_AddRefs(tag));
|
|
|
|
nsString tagString;
|
|
|
|
tag->ToString(tagString);
|
|
|
|
char tagValue[100];
|
|
|
|
tagString.ToCString(tagValue,100);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-17 04:10:02 +00:00
|
|
|
printf("----- ");
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsFrame::ListTag(stdout, mOuter);
|
|
|
|
#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-09 22:02:40 +00:00
|
|
|
|
2000-02-17 04:10:02 +00:00
|
|
|
printf(" Tag='%s', id='%s' class='%s'---------------\n", tagValue, idValue, kClassValue);
|
2000-02-14 01:42:09 +00:00
|
|
|
|
|
|
|
|
2000-02-16 23:00:52 +00:00
|
|
|
childFrame->GetContent(getter_AddRefs(content));
|
|
|
|
|
|
|
|
if (content) {
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);
|
|
|
|
id.ToCString(idValue,100);
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, kClass);
|
|
|
|
kClass.ToCString(kClassValue,100);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
content->GetTag(*getter_AddRefs(tag));
|
|
|
|
tag->ToString(tagString);
|
|
|
|
tagString.ToCString(tagValue,100);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
printf("child #%d: ", count);
|
2000-02-17 04:10:02 +00:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
nsFrame::ListTag(stdout, childFrame);
|
2000-02-10 00:38:59 +00:00
|
|
|
#endif
|
2000-02-17 04:10:02 +00:00
|
|
|
printf(" Tag='%s', id='%s' class='%s'\n", tagValue, idValue, kClassValue);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00: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-09 22:02:40 +00:00
|
|
|
mDebugChild = childFrame;
|
|
|
|
nsCalculatedBoxInfoImpl aSize(childFrame);
|
|
|
|
aSize.prefSize.width = NS_INTRINSICSIZE;
|
|
|
|
aSize.prefSize.height = NS_INTRINSICSIZE;
|
|
|
|
|
|
|
|
aSize.minSize.width = NS_INTRINSICSIZE;
|
|
|
|
aSize.minSize.height = NS_INTRINSICSIZE;
|
|
|
|
|
|
|
|
aSize.maxSize.width = NS_INTRINSICSIZE;
|
|
|
|
aSize.maxSize.height = NS_INTRINSICSIZE;
|
|
|
|
|
|
|
|
aSize.calculatedSize.width = NS_INTRINSICSIZE;
|
|
|
|
aSize.calculatedSize.height = NS_INTRINSICSIZE;
|
|
|
|
|
|
|
|
aSize.flex = -1;
|
|
|
|
|
|
|
|
// add in the css min, max, pref
|
|
|
|
const nsStylePosition* position;
|
2000-02-16 23:00:52 +00:00
|
|
|
rv = childFrame->GetStyleData(eStyleStruct_Position,
|
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-09 22:02:40 +00:00
|
|
|
(const nsStyleStruct*&) position);
|
|
|
|
|
|
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get position");
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return PR_TRUE;
|
|
|
|
|
|
|
|
// see if the width or height was specifically set
|
|
|
|
if (position->mWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
aSize.prefSize.width = position->mWidth.GetCoordValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (position->mHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
aSize.prefSize.height = position->mHeight.GetCoordValue();
|
|
|
|
}
|
1999-10-12 00:16:06 +00: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-09 22:02:40 +00:00
|
|
|
// same for min size. Unfortunately min size is always set to 0. So for now
|
|
|
|
// we will assume 0 means not set.
|
|
|
|
if (position->mMinWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinWidth.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
aSize.minSize.width = min;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (position->mMinHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord min = position->mMinHeight.GetCoordValue();
|
|
|
|
if (min != 0)
|
|
|
|
aSize.minSize.height = min;
|
|
|
|
}
|
|
|
|
|
|
|
|
// and max
|
|
|
|
if (position->mMaxWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord max = position->mMaxWidth.GetCoordValue();
|
|
|
|
aSize.maxSize.width = max;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (position->mMaxHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
nscoord max = position->mMaxHeight.GetCoordValue();
|
|
|
|
aSize.maxSize.height = max;
|
|
|
|
}
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (content) {
|
|
|
|
nsAutoString value;
|
|
|
|
PRInt32 error;
|
|
|
|
|
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value))
|
|
|
|
{
|
|
|
|
value.Trim("%");
|
|
|
|
aSize.flex = value.ToInteger(&error);
|
|
|
|
}
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, value))
|
|
|
|
{
|
|
|
|
float p2t;
|
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
value.Trim("%");
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
aSize.prefSize.width = NSIntPixelsToTwips(value.ToInteger(&error), p2t);
|
|
|
|
}
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, value))
|
|
|
|
{
|
|
|
|
float p2t;
|
|
|
|
aPresContext->GetScaledPixelsToTwips(&p2t);
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
value.Trim("%");
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
aSize.prefSize.height = NSIntPixelsToTwips(value.ToInteger(&error), p2t);
|
|
|
|
}
|
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-09 22:02:40 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
}
|
1999-10-12 00:16:06 +00: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-09 22:02:40 +00:00
|
|
|
char min[100];
|
|
|
|
char pref[100];
|
|
|
|
char max[100];
|
|
|
|
char calc[100];
|
|
|
|
char flex[100];
|
|
|
|
|
|
|
|
/*
|
|
|
|
nsSize c(info->calculatedSize);
|
|
|
|
if (c.width != NS_INTRINSICSIZE)
|
|
|
|
c.width -= inset.left + inset.right;
|
|
|
|
|
|
|
|
if (c.height != NS_INTRINSICSIZE)
|
|
|
|
c.height -= inset.left + inset.right;
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
GetValue(info->minSize, aSize.minSize, min);
|
|
|
|
GetValue(info->prefSize, aSize.prefSize, pref);
|
|
|
|
GetValue(info->maxSize, aSize.maxSize, max);
|
|
|
|
GetValue(info->calculatedSize, aSize.calculatedSize, calc);
|
|
|
|
GetValue(info->flex, aSize.flex, flex);
|
|
|
|
|
|
|
|
|
|
|
|
printf("min%s, pref%s, max%s, actual%s, flex=%s\n\n",
|
|
|
|
min,
|
|
|
|
pref,
|
|
|
|
max,
|
|
|
|
calc,
|
|
|
|
flex
|
|
|
|
);
|
|
|
|
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
1999-10-20 00:46:21 +00: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-09 22:02:40 +00:00
|
|
|
info = info->next;
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
mDebugChild = nsnull;
|
1999-10-12 00:16:06 +00: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-09 22:02:40 +00:00
|
|
|
|
|
|
|
return PR_FALSE;
|
1999-10-12 00:16:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
1999-11-24 06:03:41 +00:00
|
|
|
nsBoxFrame::GetCursor(nsIPresContext* aPresContext,
|
1999-10-12 00:16:06 +00:00
|
|
|
nsPoint& aPoint,
|
|
|
|
PRInt32& aCursor)
|
|
|
|
{
|
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-09 22:02:40 +00:00
|
|
|
nsPoint newPoint;
|
|
|
|
mInner->TranslateEventCoords(aPresContext, aPoint, newPoint);
|
1999-10-12 00:16:06 +00:00
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
/*
|
|
|
|
nsCOMPtr<nsIContent> content;
|
|
|
|
mInner->GetContentOf(this, getter_AddRefs(content));
|
|
|
|
|
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-09 22:02:40 +00:00
|
|
|
nsString id;
|
2000-02-14 01:42:09 +00:00
|
|
|
content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);
|
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-09 22:02:40 +00:00
|
|
|
char idValue[100];
|
|
|
|
id.ToCString(idValue,100);
|
2000-02-14 01:42:09 +00: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-09 22:02:40 +00:00
|
|
|
|
|
|
|
/// printf("----------Box id = %s-----------\n", idValue);
|
|
|
|
// printf("x=%d, r.x=%d r.x + r.width=%d\n",newPoint.x, or.x, or.x + or.width);
|
|
|
|
// printf("y=%d, r.y=%d r.y + r.height=%d\n",newPoint.y, or.y, or.y + or.height);
|
|
|
|
|
|
|
|
//aCursor = NS_STYLE_CURSOR_POINTER;
|
|
|
|
|
|
|
|
|
|
|
|
// if we are in debug and we are in the debug area
|
|
|
|
// return our own cursor and dump the debug information.
|
|
|
|
if (mInner->mDebugInner)
|
|
|
|
{
|
|
|
|
if (mInner->mDebugInner->DisplayDebugInfoFor(aPresContext, newPoint, aCursor))
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsHTMLContainerFrame::GetCursor(aPresContext, aPoint, aCursor);
|
1999-10-12 00:16:06 +00: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-09 22:02:40 +00:00
|
|
|
//XXX the event come's in in view relative coords, but really should
|
|
|
|
//be in frame relative coords by the time it hits our frame.
|
|
|
|
|
|
|
|
// Translate an point that is relative to our view (or a containing
|
|
|
|
// view) into a localized pixel coordinate that is relative to the
|
|
|
|
// content area of this frame (inside the border+padding).
|
|
|
|
void
|
|
|
|
nsBoxFrameInner::TranslateEventCoords(nsIPresContext* aPresContext,
|
|
|
|
const nsPoint& aPoint,
|
|
|
|
nsPoint& aResult)
|
|
|
|
{
|
|
|
|
nscoord x = aPoint.x;
|
|
|
|
nscoord y = aPoint.y;
|
|
|
|
|
|
|
|
// If we have a view then the event coordinates are already relative
|
|
|
|
// to this frame; otherwise we have to adjust the coordinates
|
|
|
|
// appropriately.
|
|
|
|
nsIView* view;
|
|
|
|
mOuter->GetView(aPresContext, &view);
|
|
|
|
if (nsnull == view) {
|
|
|
|
nsPoint offset;
|
|
|
|
mOuter->GetOffsetFromView(aPresContext, offset, &view);
|
|
|
|
if (nsnull != view) {
|
|
|
|
x -= offset.x;
|
|
|
|
y -= offset.y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
const nsStyleSpacing* spacing;
|
|
|
|
nsresult rv = mOuter->GetStyleData(eStyleStruct_Spacing,
|
|
|
|
(const nsStyleStruct*&) spacing);
|
|
|
|
|
|
|
|
nsMargin m(0,0,0,0);
|
|
|
|
spacing->GetBorderPadding(m);
|
|
|
|
|
|
|
|
// Subtract out border and padding here so that the coordinates are
|
|
|
|
// now relative to the content area of this frame.
|
|
|
|
x -= m.left + m.right;
|
|
|
|
y -= m.top + m.bottom;
|
|
|
|
*/
|
|
|
|
|
|
|
|
aResult.x = x;
|
|
|
|
aResult.y = y;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-12 00:16:06 +00:00
|
|
|
nsresult
|
|
|
|
nsBoxFrameInner::GetContentOf(nsIFrame* aFrame, nsIContent** aContent)
|
|
|
|
{
|
|
|
|
// If we don't have a content node find a parent that does.
|
|
|
|
while(aFrame != nsnull) {
|
|
|
|
aFrame->GetContent(aContent);
|
|
|
|
if (*aContent != nsnull)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
aFrame->GetParent(&aFrame);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ERROR("Can't find a parent with a content node");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
void
|
|
|
|
nsBoxFrameInner::SanityCheck()
|
|
|
|
{
|
|
|
|
#ifdef TEST_SANITY
|
|
|
|
mInfoList->SanityCheck(mOuter->mFrames);
|
|
|
|
#endif
|
|
|
|
}
|
1999-10-12 00:16:06 +00:00
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
nsInfoListImpl::nsInfoListImpl():mFirst(nsnull),mLast(nsnull),mCount(0)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
nsInfoListImpl::~nsInfoListImpl()
|
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCalculatedBoxInfo*
|
|
|
|
nsInfoListImpl::GetFirst()
|
|
|
|
{
|
|
|
|
return mFirst;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCalculatedBoxInfo*
|
|
|
|
nsInfoListImpl::GetLast()
|
|
|
|
{
|
|
|
|
return mLast;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::Clear()
|
|
|
|
{
|
|
|
|
nsCalculatedBoxInfo* info = mFirst;
|
|
|
|
while(info) {
|
|
|
|
nsCalculatedBoxInfo* it = info;
|
|
|
|
info = info->next;
|
|
|
|
delete it;
|
|
|
|
}
|
|
|
|
mFirst = nsnull;
|
|
|
|
mLast = nsnull;
|
|
|
|
mCount = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32
|
|
|
|
nsInfoListImpl::GetCount()
|
|
|
|
{
|
|
|
|
return mCount;
|
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
PRInt32
|
1999-11-18 21:05:43 +00:00
|
|
|
nsInfoListImpl::CreateInfosFor(nsIFrame* aList, nsCalculatedBoxInfo*& first, nsCalculatedBoxInfo*& last)
|
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
PRInt32 count = 0;
|
1999-11-18 21:05:43 +00:00
|
|
|
if (aList) {
|
1999-12-02 01:07:27 +00:00
|
|
|
first = new nsCalculatedBoxInfoImpl(aList);
|
|
|
|
count++;
|
1999-11-18 21:05:43 +00:00
|
|
|
last = first;
|
|
|
|
aList->GetNextSibling(&aList);
|
|
|
|
while(aList) {
|
1999-12-02 01:07:27 +00:00
|
|
|
last->next = new nsCalculatedBoxInfoImpl(aList);
|
|
|
|
count++;
|
1999-11-18 21:05:43 +00:00
|
|
|
aList->GetNextSibling(&aList);
|
|
|
|
last = last->next;
|
|
|
|
}
|
|
|
|
}
|
1999-12-02 01:07:27 +00:00
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCalculatedBoxInfo*
|
|
|
|
nsInfoListImpl::GetPrevious(nsIFrame* aFrame)
|
|
|
|
{
|
|
|
|
if (aFrame == nsnull)
|
|
|
|
return nsnull;
|
|
|
|
|
|
|
|
// find the frame to remove
|
|
|
|
nsCalculatedBoxInfo* info = mFirst;
|
|
|
|
nsCalculatedBoxInfo* prev = nsnull;
|
|
|
|
while (info)
|
|
|
|
{
|
|
|
|
if (info->frame == aFrame) {
|
|
|
|
return prev;
|
|
|
|
}
|
|
|
|
|
|
|
|
prev = info;
|
|
|
|
info = info->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCalculatedBoxInfo*
|
|
|
|
nsInfoListImpl::GetInfo(nsIFrame* aFrame)
|
|
|
|
{
|
|
|
|
if (aFrame == nsnull)
|
|
|
|
return nsnull;
|
|
|
|
|
|
|
|
// find the frame to remove
|
|
|
|
nsCalculatedBoxInfo* info = mFirst;
|
|
|
|
while (info)
|
|
|
|
{
|
|
|
|
if (info->frame == aFrame) {
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
|
|
|
|
info = info->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::Remove(nsIFrame* aFrame)
|
|
|
|
{
|
|
|
|
// get the info before the frame
|
|
|
|
nsCalculatedBoxInfo* prevInfo = GetPrevious(aFrame);
|
|
|
|
RemoveAfter(prevInfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::Insert(nsIFrame* aPrevFrame, nsIFrame* aFrameList)
|
|
|
|
{
|
|
|
|
nsCalculatedBoxInfo* prevInfo = GetInfo(aPrevFrame);
|
|
|
|
|
|
|
|
// find the frame before this one
|
|
|
|
// if no previous frame then we are inserting in front
|
|
|
|
if (prevInfo == nsnull) {
|
|
|
|
// prepend them
|
|
|
|
Prepend(aFrameList);
|
|
|
|
} else {
|
|
|
|
// insert insert after previous info
|
|
|
|
InsertAfter(prevInfo, aFrameList);
|
|
|
|
}
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::RemoveAfter(nsCalculatedBoxInfo* aPrevious)
|
|
|
|
{
|
1999-12-02 01:07:27 +00:00
|
|
|
nsCalculatedBoxInfo* toDelete = nsnull;
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
if (aPrevious == nsnull)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(mFirst,"Can't find first child");
|
1999-12-02 01:07:27 +00:00
|
|
|
toDelete = mFirst;
|
|
|
|
if (mLast == mFirst)
|
|
|
|
mLast = mFirst->next;
|
1999-11-18 21:05:43 +00:00
|
|
|
mFirst = mFirst->next;
|
|
|
|
} else {
|
1999-12-02 01:07:27 +00:00
|
|
|
toDelete = aPrevious->next;
|
1999-11-18 21:05:43 +00:00
|
|
|
NS_ASSERTION(toDelete,"Can't find child to delete");
|
|
|
|
aPrevious->next = toDelete->next;
|
1999-12-02 01:07:27 +00:00
|
|
|
if (mLast == toDelete)
|
|
|
|
mLast = aPrevious;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
1999-12-02 01:07:27 +00:00
|
|
|
|
|
|
|
delete toDelete;
|
|
|
|
mCount--;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::Prepend(nsIFrame* aList)
|
|
|
|
{
|
|
|
|
nsCalculatedBoxInfo* first;
|
|
|
|
nsCalculatedBoxInfo* last;
|
1999-12-02 01:07:27 +00:00
|
|
|
mCount += CreateInfosFor(aList, first, last);
|
1999-11-18 21:05:43 +00:00
|
|
|
if (!mFirst)
|
|
|
|
mFirst = mLast = first;
|
|
|
|
else {
|
|
|
|
last->next = mFirst;
|
|
|
|
mFirst = first;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::Append(nsIFrame* aList)
|
|
|
|
{
|
|
|
|
nsCalculatedBoxInfo* first;
|
|
|
|
nsCalculatedBoxInfo* last;
|
1999-12-02 01:07:27 +00:00
|
|
|
mCount += CreateInfosFor(aList, first, last);
|
|
|
|
if (!mFirst)
|
|
|
|
mFirst = first;
|
|
|
|
else
|
1999-11-18 21:05:43 +00:00
|
|
|
mLast->next = first;
|
1999-12-02 01:07:27 +00:00
|
|
|
|
|
|
|
mLast = last;
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::InsertAfter(nsCalculatedBoxInfo* aPrev, nsIFrame* aList)
|
|
|
|
{
|
|
|
|
nsCalculatedBoxInfo* first;
|
|
|
|
nsCalculatedBoxInfo* last;
|
1999-12-02 01:07:27 +00:00
|
|
|
mCount += CreateInfosFor(aList, first, last);
|
1999-11-18 21:05:43 +00:00
|
|
|
last->next = aPrev->next;
|
|
|
|
aPrev->next = first;
|
1999-12-02 01:07:27 +00:00
|
|
|
if (aPrev == mLast)
|
|
|
|
mLast = last;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsInfoListImpl::Init(nsIFrame* aList)
|
|
|
|
{
|
|
|
|
Clear();
|
|
|
|
mCount += CreateInfosFor(aList, mFirst, mLast);
|
1999-11-18 21:05:43 +00:00
|
|
|
}
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
void
|
|
|
|
nsInfoListImpl::SanityCheck(nsFrameList& aFrameList)
|
|
|
|
{
|
|
|
|
// make sure the length match
|
|
|
|
PRInt32 length = aFrameList.GetLength();
|
|
|
|
NS_ASSERTION(length == mCount,"nsBox::ERROR!! Box info list count does not match frame count!!");
|
|
|
|
|
|
|
|
// make sure last makes sense
|
|
|
|
NS_ASSERTION(mLast == nsnull || mLast->next == nsnull,"nsBox::ERROR!! The last child is not really the last!!!");
|
|
|
|
nsIFrame* child = aFrameList.FirstChild();
|
|
|
|
nsCalculatedBoxInfo* info = mFirst;
|
|
|
|
PRInt32 count = 0;
|
|
|
|
while(child)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(count <= mCount,"too many children!!!");
|
|
|
|
NS_ASSERTION(info->frame == child,"nsBox::ERROR!! box info list and child info lists don't match!!!");
|
|
|
|
info = info->next;
|
|
|
|
child->GetNextSibling(&child);
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---- box info ------
|
|
|
|
|
1999-12-28 19:37:29 +00:00
|
|
|
nsBoxInfo::nsBoxInfo():prefSize(0,0), minSize(0,0), maxSize(NS_INTRINSICSIZE, NS_INTRINSICSIZE), flex(0)
|
1999-12-02 01:07:27 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
nsBoxInfo::Clear()
|
|
|
|
{
|
|
|
|
prefSize.width = 0;
|
|
|
|
prefSize.height = 0;
|
|
|
|
|
|
|
|
minSize.width = 0;
|
|
|
|
minSize.height = 0;
|
|
|
|
|
2000-02-14 01:42:09 +00:00
|
|
|
ascent = 0;
|
|
|
|
|
1999-12-02 01:07:27 +00:00
|
|
|
flex = 0;
|
|
|
|
|
|
|
|
maxSize.width = NS_INTRINSICSIZE;
|
|
|
|
maxSize.height = NS_INTRINSICSIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsBoxInfo::~nsBoxInfo()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-11-18 21:05:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-09-10 00:57:01 +00:00
|
|
|
|