зеркало из https://github.com/mozilla/pjs.git
Bug 366531 - "deCOMtaminate nsBox.h [BoundsCheck()]" [p=ldx@users.sourceforge.net (Lorenzo Dieryckx) r+sr=roc a1.9=damons]
This commit is contained in:
Родитель
4fff9178ef
Коммит
0d62d5e0bd
|
@ -1092,10 +1092,8 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHori
|
||||||
// ignore collapsed children
|
// ignore collapsed children
|
||||||
if (!child->IsCollapsed(aState))
|
if (!child->IsCollapsed(aState))
|
||||||
{
|
{
|
||||||
nsSize childSize = child->GetMaxSize(aState);
|
|
||||||
nsSize min = child->GetMinSize(aState);
|
nsSize min = child->GetMinSize(aState);
|
||||||
nsBox::BoundsCheckMinMax(min, childSize);
|
nsSize childSize = nsBox::BoundsCheckMinMax(min, child->GetMaxSize(aState));
|
||||||
|
|
||||||
nsSprocketLayout::AddLargestSize(size, childSize, aIsHorizontal);
|
nsSprocketLayout::AddLargestSize(size, childSize, aIsHorizontal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,7 +218,7 @@ nsGridRowLeafLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, ns
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize the box size here
|
// initialize the box size here
|
||||||
nsBox::BoundsCheck(min, pref, max);
|
pref = nsBox::BoundsCheck(min, pref, max);
|
||||||
|
|
||||||
current = new (aState) nsBoxSize();
|
current = new (aState) nsBoxSize();
|
||||||
current->pref = pref;
|
current->pref = pref;
|
||||||
|
|
|
@ -469,9 +469,7 @@ nsBox::GetPrefSize(nsBoxLayoutState& aState)
|
||||||
|
|
||||||
nsSize minSize = GetMinSize(aState);
|
nsSize minSize = GetMinSize(aState);
|
||||||
nsSize maxSize = GetMaxSize(aState);
|
nsSize maxSize = GetMaxSize(aState);
|
||||||
BoundsCheck(minSize, pref, maxSize);
|
return BoundsCheck(minSize, pref, maxSize);
|
||||||
|
|
||||||
return pref;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSize
|
nsSize
|
||||||
|
@ -991,35 +989,30 @@ nsBox::AddMargin(nsSize& aSize, const nsMargin& aMargin)
|
||||||
aSize.height += aMargin.top + aMargin.bottom;
|
aSize.height += aMargin.top + aMargin.bottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
nscoord
|
||||||
nsBox::BoundsCheck(nscoord& aMin, nscoord& aPref, nscoord& aMax)
|
nsBox::BoundsCheck(nscoord aMin, nscoord aPref, nscoord aMax)
|
||||||
{
|
{
|
||||||
if (aMax < aMin)
|
|
||||||
aMax = aMin;
|
|
||||||
|
|
||||||
if (aPref > aMax)
|
if (aPref > aMax)
|
||||||
aPref = aMax;
|
aPref = aMax;
|
||||||
|
|
||||||
if (aPref < aMin)
|
if (aPref < aMin)
|
||||||
aPref = aMin;
|
aPref = aMin;
|
||||||
|
|
||||||
|
return aPref;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
nsSize
|
||||||
nsBox::BoundsCheckMinMax(nsSize& aMinSize, nsSize& aMaxSize)
|
nsBox::BoundsCheckMinMax(const nsSize& aMinSize, const nsSize& aMaxSize)
|
||||||
{
|
{
|
||||||
if (aMaxSize.width < aMinSize.width) {
|
return nsSize(PR_MAX(aMaxSize.width, aMinSize.width),
|
||||||
aMaxSize.width = aMinSize.width;
|
PR_MAX(aMaxSize.height, aMinSize.height));
|
||||||
}
|
|
||||||
|
|
||||||
if (aMaxSize.height < aMinSize.height)
|
|
||||||
aMaxSize.height = aMinSize.height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
nsSize
|
||||||
nsBox::BoundsCheck(nsSize& aMinSize, nsSize& aPrefSize, nsSize& aMaxSize)
|
nsBox::BoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize, const nsSize& aMaxSize)
|
||||||
{
|
{
|
||||||
BoundsCheck(aMinSize.width, aPrefSize.width, aMaxSize.width);
|
return nsSize(BoundsCheck(aMinSize.width, aPrefSize.width, aMaxSize.width),
|
||||||
BoundsCheck(aMinSize.height, aPrefSize.height, aMaxSize.height);
|
BoundsCheck(aMinSize.height, aPrefSize.height, aMaxSize.height));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_LAYOUT
|
#ifdef DEBUG_LAYOUT
|
||||||
|
|
|
@ -117,9 +117,9 @@ rollbox.
|
||||||
static void AddMargin(nsIBox* aChild, nsSize& aSize);
|
static void AddMargin(nsIBox* aChild, nsSize& aSize);
|
||||||
static void AddMargin(nsSize& aSize, const nsMargin& aMargin);
|
static void AddMargin(nsSize& aSize, const nsMargin& aMargin);
|
||||||
|
|
||||||
static void BoundsCheckMinMax(nsSize& aMinSize, nsSize& aMaxSize);
|
static nsSize BoundsCheckMinMax(const nsSize& aMinSize, const nsSize& aMaxSize);
|
||||||
static void BoundsCheck(nsSize& aMinSize, nsSize& aPrefSize, nsSize& aMaxSize);
|
static nsSize BoundsCheck(const nsSize& aMinSize, const nsSize& aPrefSize, const nsSize& aMaxSize);
|
||||||
static void BoundsCheck(nscoord& aMinSize, nscoord& aPrefSize, nscoord& aMaxSize);
|
static nscoord BoundsCheck(nscoord aMinSize, nscoord aPrefSize, nscoord aMaxSize);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
|
@ -722,7 +722,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
|
||||||
prefSize = GetPrefSize(state);
|
prefSize = GetPrefSize(state);
|
||||||
nsSize minSize = GetMinSize(state);
|
nsSize minSize = GetMinSize(state);
|
||||||
nsSize maxSize = GetMaxSize(state);
|
nsSize maxSize = GetMaxSize(state);
|
||||||
BoundsCheck(minSize, prefSize, maxSize);
|
prefSize = BoundsCheck(minSize, prefSize, maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get our desiredSize
|
// get our desiredSize
|
||||||
|
@ -821,10 +821,9 @@ nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
|
||||||
|
|
||||||
nsSize minSize = GetMinSize(aBoxLayoutState);
|
nsSize minSize = GetMinSize(aBoxLayoutState);
|
||||||
nsSize maxSize = GetMaxSize(aBoxLayoutState);
|
nsSize maxSize = GetMaxSize(aBoxLayoutState);
|
||||||
BoundsCheck(minSize, size, maxSize);
|
mPrefSize = BoundsCheck(minSize, size, maxSize);
|
||||||
mPrefSize = size;
|
|
||||||
|
|
||||||
return size;
|
return mPrefSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
nscoord
|
||||||
|
|
|
@ -453,10 +453,9 @@ nsImageBoxFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||||
nsIBox::AddCSSPrefSize(aState, this, size);
|
nsIBox::AddCSSPrefSize(aState, this, size);
|
||||||
|
|
||||||
nsSize minSize = GetMinSize(aState);
|
nsSize minSize = GetMinSize(aState);
|
||||||
nsSize maxSize = GetMaxSize(aState);
|
nsSize maxSize = GetMaxSize(aState);
|
||||||
BoundsCheck(minSize, size, maxSize);
|
|
||||||
|
|
||||||
return size;
|
return BoundsCheck(minSize, size, maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsSize
|
nsSize
|
||||||
|
|
|
@ -298,7 +298,7 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
|
||||||
prefSize = GetPrefSize(state);
|
prefSize = GetPrefSize(state);
|
||||||
nsSize minSize = GetMinSize(state);
|
nsSize minSize = GetMinSize(state);
|
||||||
nsSize maxSize = GetMaxSize(state);
|
nsSize maxSize = GetMaxSize(state);
|
||||||
BoundsCheck(minSize, prefSize, maxSize);
|
prefSize = BoundsCheck(minSize, prefSize, maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get our desiredSize
|
// get our desiredSize
|
||||||
|
|
|
@ -742,7 +742,7 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
nsSize minSize = mPopupFrame->GetMinSize(aState);
|
nsSize minSize = mPopupFrame->GetMinSize(aState);
|
||||||
nsSize maxSize = mPopupFrame->GetMaxSize(aState);
|
nsSize maxSize = mPopupFrame->GetMaxSize(aState);
|
||||||
|
|
||||||
BoundsCheck(minSize, prefSize, maxSize);
|
prefSize = BoundsCheck(minSize, prefSize, maxSize);
|
||||||
|
|
||||||
if (sizeToPopup)
|
if (sizeToPopup)
|
||||||
prefSize.width = mRect.width;
|
prefSize.width = mRect.width;
|
||||||
|
@ -1286,7 +1286,7 @@ nsMenuFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||||
// We now need to ensure that size is within the min - max range.
|
// We now need to ensure that size is within the min - max range.
|
||||||
nsSize minSize = nsBoxFrame::GetMinSize(aState);
|
nsSize minSize = nsBoxFrame::GetMinSize(aState);
|
||||||
nsSize maxSize = GetMaxSize(aState);
|
nsSize maxSize = GetMaxSize(aState);
|
||||||
BoundsCheck(minSize, size, maxSize);
|
size = BoundsCheck(minSize, size, maxSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
|
|
|
@ -170,7 +170,7 @@ nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState)
|
||||||
nsSize minSize = popupChild->GetMinSize(aState);
|
nsSize minSize = popupChild->GetMinSize(aState);
|
||||||
nsSize maxSize = popupChild->GetMaxSize(aState);
|
nsSize maxSize = popupChild->GetMaxSize(aState);
|
||||||
|
|
||||||
BoundsCheck(minSize, prefSize, maxSize);
|
prefSize = BoundsCheck(minSize, prefSize, maxSize);
|
||||||
|
|
||||||
popupChild->SetPreferredBounds(aState, nsRect(0,0,prefSize.width, prefSize.height));
|
popupChild->SetPreferredBounds(aState, nsRect(0,0,prefSize.width, prefSize.height));
|
||||||
popupChild->SetPopupPosition(nsnull);
|
popupChild->SetPopupPosition(nsnull);
|
||||||
|
|
|
@ -792,8 +792,8 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||||
if (atom != nsGkAtoms::splitter) {
|
if (atom != nsGkAtoms::splitter) {
|
||||||
nsSize prefSize = childBox->GetPrefSize(state);
|
nsSize prefSize = childBox->GetPrefSize(state);
|
||||||
nsSize minSize = childBox->GetMinSize(state);
|
nsSize minSize = childBox->GetMinSize(state);
|
||||||
nsSize maxSize = childBox->GetMaxSize(state);
|
nsSize maxSize = nsBox::BoundsCheckMinMax(minSize, childBox->GetMaxSize(state));
|
||||||
nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
prefSize = nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
||||||
|
|
||||||
mOuter->AddMargin(childBox, minSize);
|
mOuter->AddMargin(childBox, minSize);
|
||||||
mOuter->AddMargin(childBox, prefSize);
|
mOuter->AddMargin(childBox, prefSize);
|
||||||
|
|
|
@ -360,7 +360,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
nsSize prefSize = child->GetPrefSize(aState);
|
nsSize prefSize = child->GetPrefSize(aState);
|
||||||
nsSize minSize = child->GetMinSize(aState);
|
nsSize minSize = child->GetMinSize(aState);
|
||||||
nsSize maxSize = child->GetMaxSize(aState);
|
nsSize maxSize = child->GetMaxSize(aState);
|
||||||
nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
prefSize = nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
||||||
|
|
||||||
AddMargin(child, prefSize);
|
AddMargin(child, prefSize);
|
||||||
width = PR_MIN(prefSize.width, originalClientRect.width);
|
width = PR_MIN(prefSize.width, originalClientRect.width);
|
||||||
|
@ -496,7 +496,7 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
||||||
// we didn't exceed it.
|
// we didn't exceed it.
|
||||||
nsSize minSize = child->GetMinSize(aState);
|
nsSize minSize = child->GetMinSize(aState);
|
||||||
nsSize maxSize = child->GetMaxSize(aState);
|
nsSize maxSize = child->GetMaxSize(aState);
|
||||||
nsBox::BoundsCheckMinMax(minSize, maxSize);
|
maxSize = nsBox::BoundsCheckMinMax(minSize, maxSize);
|
||||||
|
|
||||||
// make sure the size is in our max size.
|
// make sure the size is in our max size.
|
||||||
if (childRect.width > maxSize.width)
|
if (childRect.width > maxSize.width)
|
||||||
|
@ -800,14 +800,14 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
||||||
|
|
||||||
pref = child->GetPrefSize(aState);
|
pref = child->GetPrefSize(aState);
|
||||||
min = child->GetMinSize(aState);
|
min = child->GetMinSize(aState);
|
||||||
max = child->GetMaxSize(aState);
|
max = nsBox::BoundsCheckMinMax(min, child->GetMaxSize(aState));
|
||||||
ascent = child->GetBoxAscent(aState);
|
ascent = child->GetBoxAscent(aState);
|
||||||
nsMargin margin;
|
nsMargin margin;
|
||||||
child->GetMargin(margin);
|
child->GetMargin(margin);
|
||||||
ascent += margin.top;
|
ascent += margin.top;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
nsBox::BoundsCheck(min, pref, max);
|
pref = nsBox::BoundsCheck(min, pref, max);
|
||||||
|
|
||||||
AddMargin(child, pref);
|
AddMargin(child, pref);
|
||||||
AddMargin(child, min);
|
AddMargin(child, min);
|
||||||
|
@ -920,7 +920,7 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
||||||
|
|
||||||
// we specified all our children are equal size;
|
// we specified all our children are equal size;
|
||||||
if (frameState & NS_STATE_EQUAL_SIZE) {
|
if (frameState & NS_STATE_EQUAL_SIZE) {
|
||||||
nsBox::BoundsCheck(biggestMinWidth, biggestPrefWidth, smallestMaxWidth);
|
biggestPrefWidth = nsBox::BoundsCheck(biggestMinWidth, biggestPrefWidth, smallestMaxWidth);
|
||||||
|
|
||||||
currentBox = aBoxSizes;
|
currentBox = aBoxSizes;
|
||||||
|
|
||||||
|
@ -1053,9 +1053,8 @@ nsSprocketLayout::ChildResized(nsIBox* aBox,
|
||||||
// ok if the height changed then we need to reflow everyone but us at the new 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.
|
// so we will set the changed index to be us. And signal that we need a new pass.
|
||||||
|
|
||||||
nsSize max = aChild->GetMaxSize(aState);
|
nsSize min = aChild->GetMinSize(aState);
|
||||||
nsSize min = aChild->GetMinSize(aState);
|
nsSize max = nsBox::BoundsCheckMinMax(min, aChild->GetMaxSize(aState));
|
||||||
nsBox::BoundsCheckMinMax(min, max);
|
|
||||||
AddMargin(aChild, max);
|
AddMargin(aChild, max);
|
||||||
|
|
||||||
if (isHorizontal)
|
if (isHorizontal)
|
||||||
|
@ -1090,8 +1089,8 @@ nsSprocketLayout::ChildResized(nsIBox* aBox,
|
||||||
|
|
||||||
if (childActualWidth > childLayoutWidth) {
|
if (childActualWidth > childLayoutWidth) {
|
||||||
nsSize min = aChild->GetMinSize(aState);
|
nsSize min = aChild->GetMinSize(aState);
|
||||||
nsSize max = aChild->GetMaxSize(aState);
|
nsSize max = nsBox::BoundsCheckMinMax(min, aChild->GetMaxSize(aState));
|
||||||
nsBox::BoundsCheckMinMax(min, max);
|
|
||||||
AddMargin(aChild, max);
|
AddMargin(aChild, max);
|
||||||
|
|
||||||
// our width now becomes the new size
|
// our width now becomes the new size
|
||||||
|
@ -1466,9 +1465,8 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi
|
||||||
if (!child->IsCollapsed(aState))
|
if (!child->IsCollapsed(aState))
|
||||||
{
|
{
|
||||||
// if completely redefined don't even ask our child for its size.
|
// if completely redefined don't even ask our child for its size.
|
||||||
nsSize max = child->GetMaxSize(aState);
|
|
||||||
nsSize min = child->GetMinSize(aState);
|
nsSize min = child->GetMinSize(aState);
|
||||||
nsBox::BoundsCheckMinMax(min, max);
|
nsSize max = nsBox::BoundsCheckMinMax(min, child->GetMaxSize(aState));
|
||||||
|
|
||||||
AddMargin(child, max);
|
AddMargin(child, max);
|
||||||
AddSmallestSize(aSize, max, isHorizontal);
|
AddSmallestSize(aSize, max, isHorizontal);
|
||||||
|
|
|
@ -136,9 +136,8 @@ nsStackLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
||||||
|
|
||||||
nsIBox* child = aBox->GetChildBox();
|
nsIBox* child = aBox->GetChildBox();
|
||||||
while (child) {
|
while (child) {
|
||||||
nsSize max = child->GetMaxSize(aState);
|
|
||||||
nsSize min = child->GetMinSize(aState);
|
nsSize min = child->GetMinSize(aState);
|
||||||
nsBox::BoundsCheckMinMax(min, max);
|
nsSize max = nsBox::BoundsCheckMinMax(min, child->GetMaxSize(aState));
|
||||||
|
|
||||||
AddMargin(child, max);
|
AddMargin(child, max);
|
||||||
AddOffset(aState, child, max);
|
AddOffset(aState, child, max);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче