Fix for 99198, ensure that stack doesn't stretch children explicitly position at left/top of (0,0), r=bryner, sr=waterson

This commit is contained in:
hyatt%netscape.com 2001-09-19 02:05:57 +00:00
Родитель acbcfb40c8
Коммит f0fb3c199b
2 изменённых файлов: 6 добавлений и 6 удалений

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

@ -171,7 +171,7 @@ nsStackLayout::GetAscent(nsIBox* aBox, nsBoxLayoutState& aState, nscoord& aAscen
return NS_OK; return NS_OK;
} }
nsresult PRBool
nsStackLayout::AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize) nsStackLayout::AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize)
{ {
nsSize offset(0,0); nsSize offset(0,0);
@ -187,7 +187,7 @@ nsStackLayout::AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize
// As an optimization, we cache the fact that we are not positioned to avoid // As an optimization, we cache the fact that we are not positioned to avoid
// wasting time fetching attributes and checking style data. // wasting time fetching attributes and checking style data.
if (state & NS_STATE_STACK_NOT_POSITIONED) if (state & NS_STATE_STACK_NOT_POSITIONED)
return NS_OK; return PR_FALSE;
PRBool offsetSpecified = PR_FALSE; PRBool offsetSpecified = PR_FALSE;
frame->GetStyleData(eStyleStruct_Position,(const nsStyleStruct*&) pos); frame->GetStyleData(eStyleStruct_Position,(const nsStyleStruct*&) pos);
@ -239,7 +239,7 @@ nsStackLayout::AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize
frame->SetFrameState(state); frame->SetFrameState(state);
} }
return NS_OK; return offsetSpecified;
} }
@ -290,7 +290,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
// obtain our offset from the top left border of the stack's content box. // obtain our offset from the top left border of the stack's content box.
nsSize offset(0,0); nsSize offset(0,0);
AddOffset(aState, child, offset); PRBool offsetSpecified = AddOffset(aState, child, offset);
// Correct the child's x/y position by adding in both the margins // Correct the child's x/y position by adding in both the margins
// and the left/top offset. // and the left/top offset.
@ -299,7 +299,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
// If we have an offset, we don't stretch the child. Just use // If we have an offset, we don't stretch the child. Just use
// its preferred size. // its preferred size.
if (offset.width != 0 || offset.height != 0) { if (offsetSpecified) {
nsSize pref(0,0); nsSize pref(0,0);
child->GetPrefSize(aState, pref); child->GetPrefSize(aState, pref);
childRect.width = pref.width; childRect.width = pref.width;

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

@ -52,7 +52,7 @@ public:
NS_IMETHOD GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent); NS_IMETHOD GetAscent(nsIBox* aBox, nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
protected: protected:
nsresult AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize); PRBool AddOffset(nsBoxLayoutState& aState, nsIBox* aChild, nsSize& aSize);
private: private:
static nsIBoxLayout* gInstance; static nsIBoxLayout* gInstance;