-r pinkerton
This commit is contained in:
evaughan%netscape.com 2000-07-07 22:24:06 +00:00
Родитель c6087db637
Коммит a17ec2746d
34 изменённых файлов: 246 добавлений и 171 удалений

Просмотреть файл

@ -6191,13 +6191,13 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
rv = NS_NewGrippyFrame(aPresShell, &newFrame);
}
// End of GRIPPY CONSTRUCTION logic
#if 0
#if 1
else if (aTag != nsHTMLAtoms::html) {
nsCAutoString str("Invalid XUL tag encountered in file. Perhaps you used the wrong namespace?\n\nThe tag name is ");
nsAutoString tagName;
aTag->ToString(tagName);
str.AppendWithConversion(tagName);
NS_ERROR(str);
NS_WARNING(str);
}
#endif
}

Просмотреть файл

@ -161,12 +161,14 @@ public:
nsIScrollableView* GetScrollableView(nsIPresContext* aPresContext);
void GetScrolledContentSize(nsSize& aSize);
void ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
void SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible);
NS_IMETHOD GetScrolledSize(nsIPresContext* aPresContext,
nscoord *aWidth,
nscoord *aHeight) const;
nsIBox* mHScrollbarBox;
nsIBox* mVScrollbarBox;
nsIBox* mScrollAreaBox;
@ -898,23 +900,6 @@ nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext)
return scrollingView;
}
void
nsGfxScrollFrameInner::GetScrolledContentSize(nsSize& aSize)
{
// get the ara frame is the scrollarea
nsIBox* child = nsnull;
mScrollAreaBox->GetChildBox(&child);
nsRect rect(0,0,0,0);
child->GetBounds(rect);
aSize.width = rect.width;
aSize.height = rect.height;
nsBox::AddMargin(child, aSize);
nsBox::AddBorderAndPadding(mScrollAreaBox, aSize);
nsBox::AddInset(mScrollAreaBox, aSize);
}
PRBool
nsGfxScrollFrameInner::AddHorizontalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnTop)
{
@ -1017,19 +1002,14 @@ nsGfxScrollFrameInner::LayoutBox(nsBoxLayoutState& aState, nsIBox* aBox, const n
}
NS_IMETHODIMP
nsGfxScrollFrame::Layout(nsBoxLayoutState& aState)
nsGfxScrollFrame::DoLayout(nsBoxLayoutState& aState)
{
// mark ourselves as dirty so no child under us
// can post an incremental layout.
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
PropagateDebug(aState);
PRUint32 flags = 0;
aState.GetLayoutFlags(flags);
nsresult rv = mInner->Layout(aState);
aState.SetLayoutFlags(flags);
nsBox::Layout(aState);
nsBox::DoLayout(aState);
return rv;
}
@ -1108,7 +1088,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
if (styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLL
&& styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL) {
// get the area frame is the scrollarea
GetScrolledContentSize(scrolledContentSize);
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
// There are two cases to consider
if (scrolledContentSize.height <= scrollAreaRect.height
@ -1145,7 +1125,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
&& (NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL != styleDisplay->mOverflow))
{
// get the area frame is the scrollarea
GetScrolledContentSize(scrolledContentSize);
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
// if the child is wider that the scroll area
// and we don't have a scrollbar add one.
@ -1184,7 +1164,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
needsLayout = PR_FALSE;
}
GetScrolledContentSize(scrolledContentSize);
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
nsIPresContext* presContext = aState.GetPresContext();
float p2t;
@ -1329,6 +1309,41 @@ nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize,
return PR_FALSE;
}
/**
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
*/
NS_IMETHODIMP
nsGfxScrollFrameInner::GetScrolledSize(nsIPresContext* aPresContext,
nscoord *aWidth,
nscoord *aHeight) const
{
// our scrolled size is the size of our scrolled view.
nsSize size;
nsIBox* child = nsnull;
mScrollAreaBox->GetChildBox(&child);
nsIFrame* frame;
child->GetFrame(&frame);
nsIView* view;
frame->GetView(aPresContext, &view);
NS_ASSERTION(view,"Scrolled frame must have a view!!!");
nsRect rect(0,0,0,0);
view->GetBounds(rect);
size.width = rect.width;
size.height = rect.height;
nsBox::AddMargin(child, size);
nsBox::AddBorderAndPadding(mScrollAreaBox, size);
nsBox::AddInset(mScrollAreaBox, size);
*aWidth = size.width;
*aHeight = size.height;
return NS_OK;
}
void
nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible)
{

Просмотреть файл

@ -121,7 +121,7 @@ public:
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD GetPadding(nsMargin& aPadding);
// nsIScrollableFrame
@ -143,7 +143,7 @@ public:
NS_IMETHOD GetClipSize(nsIPresContext* aPresContext,
nscoord *aWidth,
nscoord *aHeight) const;
NS_IMETHOD GetScrollPreference(nsIPresContext* aPresContext, nsScrollPref* aScrollPreference) const;
NS_IMETHOD GetScrollbarSizes(nsIPresContext* aPresContext,

Просмотреть файл

@ -161,12 +161,14 @@ public:
nsIScrollableView* GetScrollableView(nsIPresContext* aPresContext);
void GetScrolledContentSize(nsSize& aSize);
void ScrollbarChanged(nsIPresContext* aPresContext, nscoord aX, nscoord aY);
void SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible);
NS_IMETHOD GetScrolledSize(nsIPresContext* aPresContext,
nscoord *aWidth,
nscoord *aHeight) const;
nsIBox* mHScrollbarBox;
nsIBox* mVScrollbarBox;
nsIBox* mScrollAreaBox;
@ -898,23 +900,6 @@ nsGfxScrollFrameInner::GetScrollableView(nsIPresContext* aPresContext)
return scrollingView;
}
void
nsGfxScrollFrameInner::GetScrolledContentSize(nsSize& aSize)
{
// get the ara frame is the scrollarea
nsIBox* child = nsnull;
mScrollAreaBox->GetChildBox(&child);
nsRect rect(0,0,0,0);
child->GetBounds(rect);
aSize.width = rect.width;
aSize.height = rect.height;
nsBox::AddMargin(child, aSize);
nsBox::AddBorderAndPadding(mScrollAreaBox, aSize);
nsBox::AddInset(mScrollAreaBox, aSize);
}
PRBool
nsGfxScrollFrameInner::AddHorizontalScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAreaSize, PRBool aOnTop)
{
@ -1017,19 +1002,14 @@ nsGfxScrollFrameInner::LayoutBox(nsBoxLayoutState& aState, nsIBox* aBox, const n
}
NS_IMETHODIMP
nsGfxScrollFrame::Layout(nsBoxLayoutState& aState)
nsGfxScrollFrame::DoLayout(nsBoxLayoutState& aState)
{
// mark ourselves as dirty so no child under us
// can post an incremental layout.
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
PropagateDebug(aState);
PRUint32 flags = 0;
aState.GetLayoutFlags(flags);
nsresult rv = mInner->Layout(aState);
aState.SetLayoutFlags(flags);
nsBox::Layout(aState);
nsBox::DoLayout(aState);
return rv;
}
@ -1108,7 +1088,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
if (styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLL
&& styleDisplay->mOverflow != NS_STYLE_OVERFLOW_SCROLLBARS_VERTICAL) {
// get the area frame is the scrollarea
GetScrolledContentSize(scrolledContentSize);
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
// There are two cases to consider
if (scrolledContentSize.height <= scrollAreaRect.height
@ -1145,7 +1125,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
&& (NS_STYLE_OVERFLOW_SCROLLBARS_HORIZONTAL != styleDisplay->mOverflow))
{
// get the area frame is the scrollarea
GetScrolledContentSize(scrolledContentSize);
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
// if the child is wider that the scroll area
// and we don't have a scrollbar add one.
@ -1184,7 +1164,7 @@ nsGfxScrollFrameInner::Layout(nsBoxLayoutState& aState)
needsLayout = PR_FALSE;
}
GetScrolledContentSize(scrolledContentSize);
GetScrolledSize(aState.GetPresContext(),&scrolledContentSize.width, &scrolledContentSize.height);
nsIPresContext* presContext = aState.GetPresContext();
float p2t;
@ -1329,6 +1309,41 @@ nsGfxScrollFrameInner::SetAttribute(nsIBox* aBox, nsIAtom* aAtom, nscoord aSize,
return PR_FALSE;
}
/**
* Gets the size of the area that lies inside the scrollbars but clips the scrolled frame
*/
NS_IMETHODIMP
nsGfxScrollFrameInner::GetScrolledSize(nsIPresContext* aPresContext,
nscoord *aWidth,
nscoord *aHeight) const
{
// our scrolled size is the size of our scrolled view.
nsSize size;
nsIBox* child = nsnull;
mScrollAreaBox->GetChildBox(&child);
nsIFrame* frame;
child->GetFrame(&frame);
nsIView* view;
frame->GetView(aPresContext, &view);
NS_ASSERTION(view,"Scrolled frame must have a view!!!");
nsRect rect(0,0,0,0);
view->GetBounds(rect);
size.width = rect.width;
size.height = rect.height;
nsBox::AddMargin(child, size);
nsBox::AddBorderAndPadding(mScrollAreaBox, size);
nsBox::AddInset(mScrollAreaBox, size);
*aWidth = size.width;
*aHeight = size.height;
return NS_OK;
}
void
nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible)
{

Просмотреть файл

@ -121,7 +121,7 @@ public:
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD GetPadding(nsMargin& aPadding);
// nsIScrollableFrame
@ -143,7 +143,7 @@ public:
NS_IMETHOD GetClipSize(nsIPresContext* aPresContext,
nscoord *aWidth,
nscoord *aHeight) const;
NS_IMETHOD GetScrollPreference(nsIPresContext* aPresContext, nsScrollPref* aScrollPreference) const;
NS_IMETHOD GetScrollbarSizes(nsIPresContext* aPresContext,

Просмотреть файл

@ -6191,13 +6191,13 @@ nsCSSFrameConstructor::ConstructXULFrame(nsIPresShell* aPresShell,
rv = NS_NewGrippyFrame(aPresShell, &newFrame);
}
// End of GRIPPY CONSTRUCTION logic
#if 0
#if 1
else if (aTag != nsHTMLAtoms::html) {
nsCAutoString str("Invalid XUL tag encountered in file. Perhaps you used the wrong namespace?\n\nThe tag name is ");
nsAutoString tagName;
aTag->ToString(tagName);
str.AppendWithConversion(tagName);
NS_ERROR(str);
NS_WARNING(str);
}
#endif
}

Просмотреть файл

@ -141,8 +141,8 @@ nsBox::GetBoxName(nsAutoString& aName)
aName.AssignWithConversion("Box");
}
void
nsBox::EnterLayout(nsBoxLayoutState& aState)
NS_IMETHODIMP
nsBox::BeginLayout(nsBoxLayoutState& aState)
{
#ifdef DEBUG_LAYOUT
@ -169,14 +169,25 @@ nsBox::EnterLayout(nsBoxLayoutState& aState)
printf("\n");
gIndent++;
#endif
return NS_OK;
}
void
nsBox::ExitLayout(nsBoxLayoutState& aState)
NS_IMETHODIMP
nsBox::DoLayout(nsBoxLayoutState& aState)
{
return NS_OK;
}
NS_IMETHODIMP
nsBox::EndLayout(nsBoxLayoutState& aState)
{
#ifdef DEBUG_LAYOUT
--gIndent;
#endif
return SyncLayout(aState);
}
#ifdef REFLOW_COELESCED
@ -984,11 +995,11 @@ nsBox::IsCollapsed(nsBoxLayoutState& aState, PRBool& aCollapsed)
NS_IMETHODIMP
nsBox::Layout(nsBoxLayoutState& aState)
{
EnterLayout(aState);
BeginLayout(aState);
SyncLayout(aState);
DoLayout(aState);
ExitLayout(aState);
EndLayout(aState);
return NS_OK;
}

Просмотреть файл

@ -68,7 +68,10 @@ public:
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed);
NS_IMETHOD Collapse(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD UnCollapse(nsBoxLayoutState& aBoxLayoutState);
// do not redefine this. Either create a new layout manager or redefine DoLayout below.
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD Redraw(nsBoxLayoutState& aState, const nsRect* aRect = nsnull, PRBool aImmediate = PR_FALSE);
NS_IMETHOD NeedsRecalc();
NS_IMETHOD GetDebugBoxAt(const nsPoint& aPoint, nsIBox** aBox);
@ -119,8 +122,10 @@ protected:
virtual PRBool GetDefaultFlex(PRInt32& aFlex);
virtual void GetLayoutFlags(PRUint32& aFlags);
void EnterLayout(nsBoxLayoutState& aState);
void ExitLayout(nsBoxLayoutState& aState);
NS_IMETHOD BeginLayout(nsBoxLayoutState& aState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD EndLayout(nsBoxLayoutState& aState);
virtual void GetBoxName(nsAutoString& aName);
enum eMouseThrough {

Просмотреть файл

@ -877,18 +877,30 @@ nsBoxFrame::PropagateDebug(nsBoxLayoutState& aState)
}
NS_IMETHODIMP
nsBoxFrame::Layout(nsBoxLayoutState& aState)
nsBoxFrame::BeginLayout(nsBoxLayoutState& aState)
{
nsresult rv = nsContainerBox::BeginLayout(aState);
// mark ourselves as dirty so no child under us
// can post an incremental layout.
mState |= NS_FRAME_HAS_DIRTY_CHILDREN;
PropagateDebug(aState);
nsresult rv = nsContainerBox::Layout(aState);
return rv;
}
/**
* If subclassing please subclass this method not layout.
* layout will call this method.
*/
NS_IMETHODIMP
nsBoxFrame::DoLayout(nsBoxLayoutState& aState)
{
return nsContainerBox::DoLayout(aState);
}
nsBoxFrame::Valignment
nsBoxFrameInner::GetVAlign()
{

Просмотреть файл

@ -90,7 +90,8 @@ public:
NS_IMETHOD GetHAlign(Halignment& aAlign);
NS_IMETHOD NeedsRecalc();
NS_IMETHOD GetInset(nsMargin& aInset);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD BeginLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD GetDebug(PRBool& aDebug);
//NS_IMETHOD GetMouseThrough(PRBool& aMouseThrough);

Просмотреть файл

@ -124,6 +124,9 @@ nsBoxToBlockAdaptor::nsBoxToBlockAdaptor(nsIPresShell* aPresShell, nsIFrame* aFr
mWasCollapsed = PR_FALSE;
mCachedMaxElementHeight = 0;
mStyleChange = PR_FALSE;
mOverflow.width = 0;
mOverflow.height = 0;
mIncludeOverflow = PR_TRUE;
NeedsRecalc();
}
@ -203,6 +206,20 @@ nsBoxToBlockAdaptor::NeedsRecalc()
return NS_OK;
}
NS_IMETHODIMP
nsBoxToBlockAdaptor::GetOverflow(nsSize& aOverflow)
{
aOverflow = mOverflow;
return NS_OK;
}
NS_IMETHODIMP
nsBoxToBlockAdaptor::SetIncludeOverflow(PRBool aInclude)
{
mIncludeOverflow = aInclude;
return NS_OK;
}
NS_IMETHODIMP
nsBoxToBlockAdaptor::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
{
@ -433,7 +450,7 @@ nsBoxToBlockAdaptor::IsCollapsed(nsBoxLayoutState& aState, PRBool& aCollapsed)
}
nsresult
nsBoxToBlockAdaptor::Layout(nsBoxLayoutState& aState)
nsBoxToBlockAdaptor::DoLayout(nsBoxLayoutState& aState)
{
nsRect ourRect(0,0,0,0);
GetBounds(ourRect);
@ -802,13 +819,13 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
// see if the overflow option is set. If it is then if our child's bounds overflow then
// we will set the child's rect to include the overflow size.
PRBool includeOverFlow = PR_TRUE;
aState.GetIncludeOverFlow(includeOverFlow);
if (kidState & NS_FRAME_OUTSIDE_CHILDREN) {
// make sure we store the overflow size
mOverflow.width = aDesiredSize.mOverflowArea.width;
mOverflow.height = aDesiredSize.mOverflowArea.height;
// include the overflow size in our child's rect?
if (includeOverFlow) {
if (mIncludeOverflow) {
//printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height);
aDesiredSize.width = aDesiredSize.mOverflowArea.width;
if (aDesiredSize.width <= aWidth)
@ -831,14 +848,14 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
mFrame->GetFrameState(&kidState);
if (kidState & NS_FRAME_OUTSIDE_CHILDREN)
aDesiredSize.height = aDesiredSize.mOverflowArea.height;
}
}
}
// make sure we store the overflow size
aState.SetOverFlowSize(nsSize(aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.width));
}
} else {
mOverflow.width = aDesiredSize.width;
mOverflow.height = aDesiredSize.height;
}
// ok we need the max ascent of the items on the line. So to do this
// ask the block for its line iterator. Get the max ascent.

Просмотреть файл

@ -42,8 +42,10 @@ public:
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD IsCollapsed(nsBoxLayoutState& aBoxLayoutState, PRBool& aCollapsed);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD GetFrame(nsIFrame** aFrame);
NS_IMETHOD SetIncludeOverflow(PRBool aInclude);
NS_IMETHOD GetOverflow(nsSize& aOverflow);
NS_IMETHOD NeedsRecalc();
NS_IMETHOD Recycle(nsIPresShell* aPresShell);
@ -90,6 +92,8 @@ protected:
nscoord mCachedMaxElementHeight;
PRBool mStyleChange;
PRBool mSizeSet;
nsSize mOverflow;
PRBool mIncludeOverflow;
};
#endif

Просмотреть файл

@ -542,25 +542,18 @@ nsContainerBox::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
}
NS_IMETHODIMP
nsContainerBox::Layout(nsBoxLayoutState& aState)
nsContainerBox::DoLayout(nsBoxLayoutState& aState)
{
EnterLayout(aState);
nsresult rv = NS_OK;
PRUint32 oldFlags = 0;
aState.GetLayoutFlags(oldFlags);
aState.SetLayoutFlags(0);
nsresult rv = NS_OK;
if (mLayoutManager)
rv = mLayoutManager->Layout(this, aState);
aState.SetLayoutFlags(oldFlags);
SyncLayout(aState);
ExitLayout(aState);
return rv;
}
@ -579,19 +572,6 @@ nsContainerBox::GetLayoutManager(nsIBoxLayout** aLayout)
return NS_OK;
}
/*
nsresult
nsContainerBox::LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect, PRUint32 aLayoutFlags)
{
PRUint32 oldFlags = 0;
aState.GetLayoutFlags(oldFlags);
aState.SetLayoutFlags(aLayoutFlags);
nsresult rv = LayoutChildAt(aState, aBox, aRect);
aState.SetLayoutFlags(oldFlags);
return rv;
}
*/
nsresult
nsContainerBox::LayoutChildAt(nsBoxLayoutState& aState, nsIBox* aBox, const nsRect& aRect)
{

Просмотреть файл

@ -47,7 +47,7 @@ public:
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
virtual nsIBox* GetBoxAt(PRInt32 aIndex);
virtual nsIBox* GetBox(nsIFrame* aFrame);

Просмотреть файл

@ -366,7 +366,7 @@ NS_IMETHODIMP nsDeckFrame::GetFrameForPoint(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsDeckFrame::Layout(nsBoxLayoutState& aState)
nsDeckFrame::DoLayout(nsBoxLayoutState& aState)
{
// make sure we tweek the state so it does not resize our children. We will do that.
PRUint32 oldFlags = 0;
@ -374,7 +374,7 @@ nsDeckFrame::Layout(nsBoxLayoutState& aState)
aState.SetLayoutFlags(NS_FRAME_NO_SIZE_VIEW | NS_FRAME_NO_VISIBILITY);
// do a normal layout
nsresult rv = nsBoxFrame::Layout(aState);
nsresult rv = nsBoxFrame::DoLayout(aState);
// run though each child. Hide all but the selected one
nsIBox* box = nsnull;

Просмотреть файл

@ -47,7 +47,7 @@ public:
nsIAtom* aAttribute,
PRInt32 aHint);
NS_IMETHOD Layout(nsBoxLayoutState& aState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aState);
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,

Просмотреть файл

@ -41,6 +41,8 @@ public:
static const nsIID& GetIID() { static nsIID iid = NS_IBOX_TO_BLOCK_ADAPTOR_IID; return iid; }
NS_IMETHOD Recycle(nsIPresShell* aPresShell)=0;
NS_IMETHOD SetIncludeOverflow(PRBool aInclude)=0;
NS_IMETHOD GetOverflow(nsSize& aOverflow)=0;
};
#endif

Просмотреть файл

@ -378,9 +378,9 @@ nsImageBoxFrame::GetImageSize(nsIPresContext* aPresContext)
* Ok return our dimensions
*/
NS_IMETHODIMP
nsImageBoxFrame::Layout(nsBoxLayoutState& aState)
nsImageBoxFrame::DoLayout(nsBoxLayoutState& aState)
{
return nsLeafBoxFrame::Layout(aState);
return nsLeafBoxFrame::DoLayout(aState);
}
/**

Просмотреть файл

@ -33,7 +33,7 @@ public:
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD NeedsRecalc();
friend nsresult NS_NewImageBoxFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame);

Просмотреть файл

@ -753,13 +753,13 @@ nsMenuFrame::GetMenuChildrenElement(nsIContent** aResult)
}
NS_IMETHODIMP
nsMenuFrame::Layout(nsBoxLayoutState& aState)
nsMenuFrame::DoLayout(nsBoxLayoutState& aState)
{
nsRect contentRect;
GetContentRect(contentRect);
// lay us out
nsresult rv = nsBoxFrame::Layout(aState);
nsresult rv = nsBoxFrame::DoLayout(aState);
// layout the popup. First we need to get it.
nsIFrame* popupChild = mPopupFrames.FirstChild();

Просмотреть файл

@ -60,7 +60,7 @@ public:
NS_DECL_ISUPPORTS
// nsIBox
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
// The nsIAnonymousContentCreator interface

Просмотреть файл

@ -204,10 +204,10 @@ nsPopupSetFrame::Destroy(nsIPresContext* aPresContext)
}
NS_IMETHODIMP
nsPopupSetFrame::Layout(nsBoxLayoutState& aState)
nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState)
{
// lay us out
nsresult rv = nsBoxFrame::Layout(aState);
nsresult rv = nsBoxFrame::DoLayout(aState);
// layout the popup. First we need to get it.
nsIFrame* popupChild = GetActiveChild();

Просмотреть файл

@ -56,7 +56,7 @@ public:
nsIFrame* aPrevInFlow);
// nsIBox
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD SetDebug(nsBoxLayoutState& aState, PRBool aDebug);
// The following four methods are all overridden so that the menu children

Просмотреть файл

@ -326,10 +326,10 @@ nsScrollBoxFrame::GetBorder(nsMargin& aMargin)
}
NS_IMETHODIMP
nsScrollBoxFrame::Layout(nsBoxLayoutState& aState)
nsScrollBoxFrame::DoLayout(nsBoxLayoutState& aState)
{
PRUint32 flags = 0;
aState.GetLayoutFlags(flags);
PRUint32 oldflags = 0;
aState.GetLayoutFlags(oldflags);
nsRect clientRect(0,0,0,0);
GetClientRect(clientRect);
@ -339,26 +339,36 @@ nsScrollBoxFrame::Layout(nsBoxLayoutState& aState)
nsMargin margin(0,0,0,0);
kid->GetMargin(margin);
childRect.Deflate(margin);
nsSize min(0,0);
kid->GetMinSize(aState, min);
/*
// if our child is not html then get is min size
// and make sure we don't squeeze it smaller than that.
nsIBoxToBlockAdaptor* adaptor = nsnull;
if (NS_FAILED(kid->QueryInterface(NS_GET_IID(nsIBoxToBlockAdaptor), (void**)&adaptor))) {
nsIPresContext* presContext = aState.GetPresContext();
// see if our child is html. If it is then
// never include the overflow. The child will be the size
// given but its view will include the overflow size.
nsCOMPtr<nsIBoxToBlockAdaptor> adaptor = do_QueryInterface(kid);
if (adaptor)
adaptor->SetIncludeOverflow(PR_FALSE);
PRInt32 flags = NS_FRAME_NO_MOVE_VIEW;
// do we have an adaptor? No then we can't use
// min size the child technically can get as small as it wants
// to.
if (!adaptor) {
nsSize min(0,0);
kid->GetMinSize(aState, min);
if (min.height > childRect.height)
childRect.height = min.height;
}
*/
if (min.height > childRect.height)
childRect.height = min.height;
if (min.width > childRect.width)
childRect.width = min.width;
} else {
// don't size the view if we have an adaptor
flags |= NS_FRAME_NO_SIZE_VIEW;
}
if (min.width > childRect.width)
childRect.width = min.width;
aState.SetLayoutFlags(NS_FRAME_NO_MOVE_VIEW);
aState.SetLayoutFlags(flags);
kid->SetBounds(aState, childRect);
kid->Layout(aState);
@ -366,6 +376,14 @@ nsScrollBoxFrame::Layout(nsBoxLayoutState& aState)
clientRect.Inflate(margin);
// now size the view to the size including our overflow.
if (adaptor) {
nsSize overflow(0,0);
adaptor->GetOverflow(overflow);
childRect.width = overflow.width;
childRect.height = overflow.height;
}
if (childRect.width < clientRect.width || childRect.height < clientRect.height)
{
if (childRect.width < clientRect.width)
@ -379,11 +397,20 @@ nsScrollBoxFrame::Layout(nsBoxLayoutState& aState)
kid->SetBounds(aState, childRect);
}
aState.SetLayoutFlags(flags);
aState.SetLayoutFlags(oldflags);
SyncLayout(aState);
nsIPresContext* presContext = aState.GetPresContext();
if (adaptor) {
nsIView* view;
nsIFrame* frame;
kid->GetFrame(&frame);
frame->GetView(presContext, &view);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
vm->ResizeView(view, childRect.width, childRect.height);
}
nsIScrollableView* scrollingView;
nsIView* view;
GetView(presContext, &view);

Просмотреть файл

@ -94,7 +94,7 @@ public:
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD GetPadding(nsMargin& aMargin);
NS_IMETHOD GetBorder(nsMargin& aMargin);
NS_IMETHOD GetMargin(nsMargin& aMargin);

Просмотреть файл

@ -261,7 +261,7 @@ nsSliderFrame::Paint(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsSliderFrame::Layout(nsBoxLayoutState& aState)
nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
{
EnsureOrient();

Просмотреть файл

@ -129,7 +129,7 @@ public:
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
// nsIFrame overrides
NS_IMETHOD Destroy(nsIPresContext* aPresContext);

Просмотреть файл

@ -378,7 +378,7 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsSplitterFrame::Layout(nsBoxLayoutState& aState)
nsSplitterFrame::DoLayout(nsBoxLayoutState& aState)
{
nsIFrame* frame;
GetFrame(&frame);
@ -392,7 +392,7 @@ nsSplitterFrame::Layout(nsBoxLayoutState& aState)
mInner->UpdateState();
}
return nsBoxFrame::Layout(aState);
return nsBoxFrame::DoLayout(aState);
}

Просмотреть файл

@ -66,7 +66,7 @@ public:
nsPoint& aPoint,
PRInt32& aCursor);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
// nsIAnonymousContentCreator
NS_IMETHOD CreateAnonymousContent(nsIPresContext* aPresContext,

Просмотреть файл

@ -29,23 +29,9 @@
#include "nsStackLayout.h"
#include "nsIStyleContext.h"
#include "nsIPresContext.h"
#include "nsIContent.h"
#include "nsCOMPtr.h"
#include "nsHTMLIIDs.h"
#include "nsUnitConversion.h"
#include "nsINameSpaceManager.h"
#include "nsXULAtoms.h"
#include "nsHTMLAtoms.h"
#include "nsIReflowCommand.h"
#include "nsHTMLParts.h"
#include "nsIPresShell.h"
#include "nsStyleChangeList.h"
#include "nsCSSRendering.h"
#include "nsIViewManager.h"
#include "nsBoxLayoutState.h"
#include "nsBox.h"
#include "nsContainerBox.h"
nsCOMPtr<nsIBoxLayout> nsStackLayout::gInstance = new nsStackLayout();

Просмотреть файл

@ -560,11 +560,11 @@ nsTextBoxFrame::UpdateAccessUnderline()
NS_IMETHODIMP
nsTextBoxFrame::Layout(nsBoxLayoutState& aBoxLayoutState)
nsTextBoxFrame::DoLayout(nsBoxLayoutState& aBoxLayoutState)
{
mState |= NS_STATE_NEED_LAYOUT;
return nsLeafBoxFrame::Layout(aBoxLayoutState);
return nsLeafBoxFrame::DoLayout(aBoxLayoutState);
}
NS_IMETHODIMP

Просмотреть файл

@ -34,7 +34,7 @@ public:
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD NeedsRecalc();
enum CroppingStyle { CropNone, CropLeft, CropRight, CropCenter };

Просмотреть файл

@ -1394,10 +1394,10 @@ nsTitledButtonFrame::GetImageSize(nsIPresContext* aPresContext)
* Ok return our dimensions
*/
NS_IMETHODIMP
nsTitledButtonFrame::Layout(nsBoxLayoutState& aState)
nsTitledButtonFrame::DoLayout(nsBoxLayoutState& aState)
{
mNeedsLayout = PR_TRUE;
return nsLeafBoxFrame::Layout(aState);
return nsLeafBoxFrame::DoLayout(aState);
}
/**

Просмотреть файл

@ -36,7 +36,7 @@ public:
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
NS_IMETHOD Layout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
NS_IMETHOD NeedsRecalc();
// our methods