зеркало из https://github.com/mozilla/gecko-dev.git
deCOMtaminate nsIFrame::GetMinSize/GetPrefSize/GetMaxSize. Bug 243370, patch
by Andreas Lange <anlan@lange.cx>, r+sr=roc
This commit is contained in:
Родитель
f31edc79b8
Коммит
5bb5b8f623
|
@ -1779,63 +1779,58 @@ nsTextControlFrame::Reflow(nsPresContext* aPresContext,
|
|||
aStatus);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
if (!DoesNeedRecalc(mPrefSize)) {
|
||||
aSize = mPrefSize;
|
||||
return NS_OK;
|
||||
}
|
||||
if (!DoesNeedRecalc(mPrefSize))
|
||||
return mPrefSize;
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PropagateDebug(aState);
|
||||
#endif
|
||||
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
nsSize pref(0,0);
|
||||
|
||||
// XXXbz this is almost certainly wrong.
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aState, collapsed);
|
||||
if (collapsed)
|
||||
return NS_OK;
|
||||
return pref;
|
||||
|
||||
nsresult rv = CalcIntrinsicSize(aState.GetRenderingContext(), aSize);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsresult rv = CalcIntrinsicSize(aState.GetRenderingContext(), pref);
|
||||
NS_ENSURE_SUCCESS(rv, pref);
|
||||
AddBorderAndPadding(pref);
|
||||
AddInset(pref);
|
||||
|
||||
mPrefSize = aSize;
|
||||
mPrefSize = pref;
|
||||
|
||||
#ifdef DEBUG_rods
|
||||
{
|
||||
nsMargin borderPadding(0,0,0,0);
|
||||
GetBorderAndPadding(borderPadding);
|
||||
nsSize size(169, 24);
|
||||
nsSize actual(aSize.width/15,
|
||||
aSize.height/15);
|
||||
nsSize actual(pref.width/15,
|
||||
pref.height/15);
|
||||
printf("nsGfxText(field) %d,%d %d,%d %d,%d\n",
|
||||
size.width, size.height, actual.width, actual.height, actual.width-size.width, actual.height-size.height); // text field
|
||||
}
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
return pref;
|
||||
}
|
||||
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextControlFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsTextControlFrame::GetMinSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
// XXXbz why? Why not the nsBoxFrame sizes?
|
||||
return nsBox::GetMinSize(aState, aSize);
|
||||
return nsBox::GetMinSize(aState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTextControlFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsTextControlFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
// XXXbz why? Why not the nsBoxFrame sizes?
|
||||
return nsBox::GetMaxSize(aState, aSize);
|
||||
return nsBox::GetMaxSize(aState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -86,9 +86,9 @@ public:
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
|
||||
DECL_DO_GLOBAL_REFLOW_COUNT_DSP(nsTextControlFrame, nsStackFrame)
|
||||
|
|
|
@ -5781,110 +5781,96 @@ nsFrame::RefreshSizeCache(nsBoxLayoutState& aState)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
nsSize size(0,0);
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
// If the size is cached, and there are no HTML constraints that we might
|
||||
// be depending on, then we just return the cached size.
|
||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||
if (!DoesNeedRecalc(metrics->mPrefSize)) {
|
||||
aSize = metrics->mPrefSize;
|
||||
return NS_OK;
|
||||
size = metrics->mPrefSize;
|
||||
return size;
|
||||
}
|
||||
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
IsCollapsed(aState, isCollapsed);
|
||||
if (isCollapsed) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
// get our size in CSS.
|
||||
PRBool completelyRedefined = nsIBox::AddCSSPrefSize(aState, this, metrics->mPrefSize);
|
||||
if (isCollapsed)
|
||||
return size;
|
||||
|
||||
// Refresh our caches with new sizes.
|
||||
if (!completelyRedefined) {
|
||||
RefreshSizeCache(aState);
|
||||
metrics->mPrefSize = metrics->mBlockPrefSize;
|
||||
// get our size in CSS.
|
||||
PRBool completelyRedefined = nsIBox::AddCSSPrefSize(aState, this, size);
|
||||
|
||||
// notice we don't need to add our borders or padding
|
||||
// in. That's because the block did it for us.
|
||||
// but we do need to add insets so debugging will work.
|
||||
AddInset(metrics->mPrefSize);
|
||||
nsIBox::AddCSSPrefSize(aState, this, metrics->mPrefSize);
|
||||
}
|
||||
// Refresh our caches with new sizes.
|
||||
if (!completelyRedefined) {
|
||||
RefreshSizeCache(aState);
|
||||
size = metrics->mBlockPrefSize;
|
||||
|
||||
// notice we don't need to add our borders or padding
|
||||
// in. That's because the block did it for us.
|
||||
// but we do need to add insets so debugging will work.
|
||||
AddInset(size);
|
||||
nsIBox::AddCSSPrefSize(aState, this, size);
|
||||
}
|
||||
|
||||
aSize = metrics->mPrefSize;
|
||||
|
||||
return NS_OK;
|
||||
metrics->mPrefSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsFrame::GetMinSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_MIN_SIZE(this, aSize);
|
||||
nsSize size(0,0);
|
||||
DISPLAY_MIN_SIZE(this, size);
|
||||
// Don't use the cache if we have HTMLReflowState constraints --- they might have changed
|
||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||
if (!DoesNeedRecalc(metrics->mMinSize)) {
|
||||
aSize = metrics->mMinSize;
|
||||
return NS_OK;
|
||||
size = metrics->mMinSize;
|
||||
return size;
|
||||
}
|
||||
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
IsCollapsed(aState, isCollapsed);
|
||||
if (isCollapsed) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
// get our size in CSS.
|
||||
PRBool completelyRedefined = nsIBox::AddCSSMinSize(aState, this, metrics->mMinSize);
|
||||
if (isCollapsed)
|
||||
return size;
|
||||
|
||||
// Refresh our caches with new sizes.
|
||||
if (!completelyRedefined) {
|
||||
RefreshSizeCache(aState);
|
||||
metrics->mMinSize = metrics->mBlockMinSize;
|
||||
AddInset(metrics->mMinSize);
|
||||
nsIBox::AddCSSMinSize(aState, this, metrics->mMinSize);
|
||||
}
|
||||
// get our size in CSS.
|
||||
PRBool completelyRedefined = nsIBox::AddCSSMinSize(aState, this, size);
|
||||
|
||||
// Refresh our caches with new sizes.
|
||||
if (!completelyRedefined) {
|
||||
RefreshSizeCache(aState);
|
||||
size = metrics->mBlockMinSize;
|
||||
AddInset(size);
|
||||
nsIBox::AddCSSMinSize(aState, this, size);
|
||||
}
|
||||
|
||||
aSize = metrics->mMinSize;
|
||||
|
||||
return NS_OK;
|
||||
metrics->mMinSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_MAX_SIZE(this, aSize);
|
||||
nsSize size(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
DISPLAY_MAX_SIZE(this, size);
|
||||
// Don't use the cache if we have HTMLReflowState constraints --- they might have changed
|
||||
nsBoxLayoutMetrics *metrics = BoxMetrics();
|
||||
if (!DoesNeedRecalc(metrics->mMaxSize)) {
|
||||
aSize = metrics->mMaxSize;
|
||||
return NS_OK;
|
||||
size = metrics->mMaxSize;
|
||||
return size;
|
||||
}
|
||||
|
||||
aSize.width = NS_INTRINSICSIZE;
|
||||
aSize.height = NS_INTRINSICSIZE;
|
||||
|
||||
PRBool isCollapsed = PR_FALSE;
|
||||
IsCollapsed(aState, isCollapsed);
|
||||
if (isCollapsed) {
|
||||
return NS_OK;
|
||||
} else {
|
||||
metrics->mMaxSize.width = NS_INTRINSICSIZE;
|
||||
metrics->mMaxSize.height = NS_INTRINSICSIZE;
|
||||
nsBox::GetMaxSize(aState, metrics->mMaxSize);
|
||||
}
|
||||
if (isCollapsed)
|
||||
return size;
|
||||
|
||||
aSize = metrics->mMaxSize;
|
||||
size = nsBox::GetMaxSize(aState);
|
||||
metrics->mMaxSize = size;
|
||||
|
||||
return NS_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -359,9 +359,9 @@ public:
|
|||
virtual ContentOffsets CalcContentOffsetsFromFramePoint(nsPoint aPoint);
|
||||
|
||||
// Box layout methods
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
NS_IMETHOD SetIncludeOverflow(PRBool aInclude);
|
||||
|
|
|
@ -296,12 +296,12 @@ GetScrollbarMetrics(nsBoxLayoutState& aState, nsIBox* aBox, nsSize* aMin,
|
|||
"computations");
|
||||
|
||||
if (aMin) {
|
||||
aBox->GetMinSize(aState, *aMin);
|
||||
*aMin = aBox->GetMinSize(aState);
|
||||
nsBox::AddMargin(aBox, *aMin);
|
||||
}
|
||||
|
||||
if (aPref) {
|
||||
aBox->GetPrefSize(aState, *aPref);
|
||||
*aPref = aBox->GetPrefSize(aState);
|
||||
nsBox::AddMargin(aBox, *aPref);
|
||||
}
|
||||
}
|
||||
|
@ -429,9 +429,9 @@ nsHTMLScrollFrame::ReflowScrolledFrame(const ScrollReflowState& aState,
|
|||
nscoord availWidth = aState.mReflowState.mComputedWidth + paddingLR;
|
||||
|
||||
if (aAssumeVScroll) {
|
||||
nsSize vScrollbarPrefSize;
|
||||
mInner.mVScrollbarBox->GetPrefSize(NS_CONST_CAST(nsBoxLayoutState&, aState.mBoxState),
|
||||
vScrollbarPrefSize);
|
||||
nsSize vScrollbarPrefSize =
|
||||
mInner.mVScrollbarBox->GetPrefSize(NS_CONST_CAST(nsBoxLayoutState&,
|
||||
aState.mBoxState));
|
||||
availWidth = PR_MAX(0, availWidth - vScrollbarPrefSize.width);
|
||||
}
|
||||
// pixel align the content
|
||||
|
@ -913,8 +913,7 @@ nsMargin nsGfxScrollFrameInner::GetDesiredScrollbarSizes(nsBoxLayoutState* aStat
|
|||
nsMargin result(0, 0, 0, 0);
|
||||
|
||||
if (mVScrollbarBox) {
|
||||
nsSize size;
|
||||
mVScrollbarBox->GetPrefSize(*aState, size);
|
||||
nsSize size = mVScrollbarBox->GetPrefSize(*aState);
|
||||
nsBox::AddMargin(mVScrollbarBox, size);
|
||||
if (IsScrollbarOnRight())
|
||||
result.left = size.width;
|
||||
|
@ -923,8 +922,7 @@ nsMargin nsGfxScrollFrameInner::GetDesiredScrollbarSizes(nsBoxLayoutState* aStat
|
|||
}
|
||||
|
||||
if (mHScrollbarBox) {
|
||||
nsSize size;
|
||||
mHScrollbarBox->GetPrefSize(*aState, size);
|
||||
nsSize size = mHScrollbarBox->GetPrefSize(*aState);
|
||||
nsBox::AddMargin(mHScrollbarBox, size);
|
||||
// We don't currently support any scripts that would require a scrollbar
|
||||
// at the top. (Are there any?)
|
||||
|
@ -1051,94 +1049,87 @@ nsXULScrollFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULScrollFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsXULScrollFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PropagateDebug(aState);
|
||||
#endif
|
||||
|
||||
nsSize pref = mInner.mScrolledFrame->GetPrefSize(aState);
|
||||
|
||||
nsGfxScrollFrameInner::ScrollbarStyles styles = GetScrollbarStyles();
|
||||
|
||||
nsSize vSize(0,0);
|
||||
if (mInner.mVScrollbarBox &&
|
||||
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
|
||||
mInner.mVScrollbarBox->GetPrefSize(aState, vSize);
|
||||
nsBox::AddMargin(mInner.mVScrollbarBox, vSize);
|
||||
}
|
||||
|
||||
nsSize hSize(0,0);
|
||||
if (mInner.mHScrollbarBox &&
|
||||
styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
|
||||
mInner.mHScrollbarBox->GetPrefSize(aState, hSize);
|
||||
nsBox::AddMargin(mInner.mHScrollbarBox, hSize);
|
||||
}
|
||||
|
||||
nsresult rv = mInner.mScrolledFrame->GetPrefSize(aState, aSize);
|
||||
|
||||
// scrolled frames don't have their own margins
|
||||
|
||||
aSize.width += vSize.width;
|
||||
aSize.height += hSize.height;
|
||||
if (mInner.mVScrollbarBox &&
|
||||
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
|
||||
nsSize vSize = mInner.mVScrollbarBox->GetPrefSize(aState);
|
||||
nsBox::AddMargin(mInner.mVScrollbarBox, vSize);
|
||||
pref.width += vSize.width;
|
||||
}
|
||||
|
||||
if (mInner.mHScrollbarBox &&
|
||||
styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
|
||||
nsSize hSize = mInner.mHScrollbarBox->GetPrefSize(aState);
|
||||
nsBox::AddMargin(mInner.mHScrollbarBox, hSize);
|
||||
pref.height += hSize.height;
|
||||
}
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSPrefSize(aState, this, aSize);
|
||||
|
||||
return rv;
|
||||
AddBorderAndPadding(pref);
|
||||
AddInset(pref);
|
||||
nsIBox::AddCSSPrefSize(aState, this, pref);
|
||||
return pref;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULScrollFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsXULScrollFrame::GetMinSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PropagateDebug(aState);
|
||||
#endif
|
||||
|
||||
aSize = mInner.mScrolledFrame->GetMinSizeForScrollArea(aState);
|
||||
nsSize min = mInner.mScrolledFrame->GetMinSizeForScrollArea(aState);
|
||||
|
||||
nsGfxScrollFrameInner::ScrollbarStyles styles = GetScrollbarStyles();
|
||||
|
||||
if (mInner.mVScrollbarBox &&
|
||||
styles.mVertical == NS_STYLE_OVERFLOW_SCROLL) {
|
||||
nsSize vSize(0,0);
|
||||
mInner.mVScrollbarBox->GetMinSize(aState, vSize);
|
||||
nsSize vSize = mInner.mVScrollbarBox->GetMinSize(aState);
|
||||
AddMargin(mInner.mVScrollbarBox, vSize);
|
||||
aSize.width += vSize.width;
|
||||
if (aSize.height < vSize.height)
|
||||
aSize.height = vSize.height;
|
||||
min.width += vSize.width;
|
||||
if (min.height < vSize.height)
|
||||
min.height = vSize.height;
|
||||
}
|
||||
|
||||
if (mInner.mHScrollbarBox &&
|
||||
styles.mHorizontal == NS_STYLE_OVERFLOW_SCROLL) {
|
||||
nsSize hSize(0,0);
|
||||
mInner.mHScrollbarBox->GetMinSize(aState, hSize);
|
||||
nsSize hSize = mInner.mHScrollbarBox->GetMinSize(aState);
|
||||
AddMargin(mInner.mHScrollbarBox, hSize);
|
||||
aSize.height += hSize.height;
|
||||
if (aSize.width < hSize.width)
|
||||
aSize.width = hSize.width;
|
||||
min.height += hSize.height;
|
||||
if (min.width < hSize.width)
|
||||
min.width = hSize.width;
|
||||
}
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMinSize(aState, this, aSize);
|
||||
return NS_OK;
|
||||
AddBorderAndPadding(min);
|
||||
AddInset(min);
|
||||
nsIBox::AddCSSMinSize(aState, this, min);
|
||||
return min;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULScrollFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsXULScrollFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PropagateDebug(aState);
|
||||
#endif
|
||||
|
||||
aSize.width = NS_INTRINSICSIZE;
|
||||
aSize.height = NS_INTRINSICSIZE;
|
||||
nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMaxSize(aState, this, aSize);
|
||||
return NS_OK;
|
||||
AddBorderAndPadding(max);
|
||||
AddInset(max);
|
||||
nsIBox::AddCSSMaxSize(aState, this, max);
|
||||
return max;
|
||||
}
|
||||
|
||||
#if 0 // XXXldb I don't think this is even needed
|
||||
|
@ -1902,8 +1893,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAr
|
|||
if (mInner.mNeverHasHorizontalScrollbar || !mInner.mHScrollbarBox)
|
||||
return PR_FALSE;
|
||||
|
||||
nsSize hSize;
|
||||
mInner.mHScrollbarBox->GetPrefSize(aState, hSize);
|
||||
nsSize hSize = mInner.mHScrollbarBox->GetPrefSize(aState);
|
||||
nsBox::AddMargin(mInner.mHScrollbarBox, hSize);
|
||||
|
||||
mInner.SetScrollbarVisibility(mInner.mHScrollbarBox, aAdd);
|
||||
|
@ -1919,8 +1909,7 @@ nsXULScrollFrame::AddRemoveScrollbar(nsBoxLayoutState& aState, nsRect& aScrollAr
|
|||
if (mInner.mNeverHasVerticalScrollbar || !mInner.mVScrollbarBox)
|
||||
return PR_FALSE;
|
||||
|
||||
nsSize vSize;
|
||||
mInner.mVScrollbarBox->GetPrefSize(aState, vSize);
|
||||
nsSize vSize = mInner.mVScrollbarBox->GetPrefSize(aState);
|
||||
nsBox::AddMargin(mInner.mVScrollbarBox, vSize);
|
||||
|
||||
mInner.SetScrollbarVisibility(mInner.mVScrollbarBox, aAdd);
|
||||
|
@ -1982,8 +1971,7 @@ nsXULScrollFrame::LayoutScrollArea(nsBoxLayoutState& aState, const nsRect& aRect
|
|||
|
||||
PRInt32 flags = NS_FRAME_NO_MOVE_VIEW;
|
||||
|
||||
nsSize minSize(0,0);
|
||||
mInner.mScrolledFrame->GetMinSize(aState, minSize);
|
||||
nsSize minSize = mInner.mScrolledFrame->GetMinSize(aState);
|
||||
|
||||
if (minSize.height > childRect.height)
|
||||
childRect.height = minSize.height;
|
||||
|
|
|
@ -453,9 +453,9 @@ public:
|
|||
// nsIBox methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
|
||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
|
|
|
@ -100,10 +100,10 @@ struct nsMargin;
|
|||
typedef class nsIFrame nsIBox;
|
||||
|
||||
// IID for the nsIFrame interface
|
||||
// 42728a19-b289-48b8-b6f4-1a46b719a63b
|
||||
// c822dca6-310c-433d-a1d0-d5b5b1cdce1f
|
||||
#define NS_IFRAME_IID \
|
||||
{ 0x42728a19, 0xb289, 0x48b8, \
|
||||
{ 0xb6, 0xf4, 0x1a, 0x46, 0xb7, 0x19, 0xa6, 0x3b } }
|
||||
{ 0xc822dca6, 0x310c, 0x433d, \
|
||||
{ 0xa1, 0xd0, 0xd5, 0xb5, 0xb1, 0xcd, 0xce, 0x1f } }
|
||||
|
||||
/**
|
||||
* Indication of how the frame can be split. This is used when doing runaround
|
||||
|
@ -1816,9 +1816,27 @@ NS_PTR_TO_INT32(frame->GetProperty(nsGkAtoms::embeddingLevel))
|
|||
vAlign_Bottom
|
||||
};
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0;
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0;
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)=0;
|
||||
/**
|
||||
* This calculates the minimum size required for a box based on its state
|
||||
* @param[in] aBoxLayoutState The desired state to calculate for
|
||||
* @return The minimum size
|
||||
*/
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||
|
||||
/**
|
||||
* This calculates the preferred size of a box based on its state
|
||||
* @param[in] aBoxLayoutState The desired state to calculate for
|
||||
* @return The preferred size
|
||||
*/
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||
|
||||
/**
|
||||
* This calculates the maximum size for a box based on its state
|
||||
* @param[in] aBoxLayoutState The desired state to calculate for
|
||||
* @return The maximum size
|
||||
*/
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState) = 0;
|
||||
|
||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex)=0;
|
||||
NS_HIDDEN_(nsresult)
|
||||
GetOrdinal(nsBoxLayoutState& aBoxLayoutState, PRUint32& aOrdinal);
|
||||
|
|
|
@ -935,7 +935,7 @@ nsGrid::GetPrefRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHor
|
|||
nsSize size(0,0);
|
||||
if (box)
|
||||
{
|
||||
box->GetPrefSize(aState, size);
|
||||
size = box->GetPrefSize(aState);
|
||||
nsBox::AddMargin(box, size);
|
||||
nsStackLayout::AddOffset(aState, box, size);
|
||||
}
|
||||
|
@ -1009,7 +1009,7 @@ nsGrid::GetMinRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHori
|
|||
{
|
||||
nsSize size(0,0);
|
||||
if (box) {
|
||||
box->GetPrefSize(aState, size);
|
||||
size = box->GetPrefSize(aState);
|
||||
nsBox::AddMargin(box, size);
|
||||
nsStackLayout::AddOffset(aState, box, size);
|
||||
}
|
||||
|
@ -1085,7 +1085,7 @@ nsGrid::GetMaxRowHeight(nsBoxLayoutState& aState, PRInt32 aIndex, PRBool aIsHori
|
|||
{
|
||||
nsSize size(NS_INTRINSICSIZE,NS_INTRINSICSIZE);
|
||||
if (box) {
|
||||
box->GetPrefSize(aState, size);
|
||||
size = box->GetPrefSize(aState);
|
||||
nsBox::AddMargin(box, size);
|
||||
nsStackLayout::AddOffset(aState, box, size);
|
||||
}
|
||||
|
|
|
@ -67,10 +67,9 @@ nsGridCell::GetPrefSize(nsBoxLayoutState& aState)
|
|||
// we are as wide as the widest child plus its left offset
|
||||
// we are tall as the tallest child plus its top offset
|
||||
|
||||
nsSize pref(0,0);
|
||||
|
||||
if (mBoxInColumn) {
|
||||
mBoxInColumn->GetPrefSize(aState, pref);
|
||||
nsSize pref = mBoxInColumn->GetPrefSize(aState);
|
||||
|
||||
nsBox::AddMargin(mBoxInColumn, pref);
|
||||
nsStackLayout::AddOffset(aState, mBoxInColumn, pref);
|
||||
|
||||
|
@ -78,7 +77,7 @@ nsGridCell::GetPrefSize(nsBoxLayoutState& aState)
|
|||
}
|
||||
|
||||
if (mBoxInRow) {
|
||||
mBoxInRow->GetPrefSize(aState, pref);
|
||||
nsSize pref = mBoxInRow->GetPrefSize(aState);
|
||||
|
||||
nsBox::AddMargin(mBoxInRow, pref);
|
||||
nsStackLayout::AddOffset(aState, mBoxInRow, pref);
|
||||
|
@ -98,10 +97,8 @@ nsGridCell::GetMinSize(nsBoxLayoutState& aState)
|
|||
// we are as wide as the widest child plus its left offset
|
||||
// we are tall as the tallest child plus its top offset
|
||||
|
||||
nsSize min(0,0);
|
||||
|
||||
if (mBoxInColumn) {
|
||||
mBoxInColumn->GetMinSize(aState, min);
|
||||
nsSize min = mBoxInColumn->GetMinSize(aState);
|
||||
|
||||
nsBox::AddMargin(mBoxInColumn, min);
|
||||
nsStackLayout::AddOffset(aState, mBoxInColumn, min);
|
||||
|
@ -110,7 +107,7 @@ nsGridCell::GetMinSize(nsBoxLayoutState& aState)
|
|||
}
|
||||
|
||||
if (mBoxInRow) {
|
||||
mBoxInRow->GetMinSize(aState, min);
|
||||
nsSize min = mBoxInRow->GetMinSize(aState);
|
||||
|
||||
nsBox::AddMargin(mBoxInRow, min);
|
||||
nsStackLayout::AddOffset(aState, mBoxInRow, min);
|
||||
|
@ -130,10 +127,8 @@ nsGridCell::GetMaxSize(nsBoxLayoutState& aState)
|
|||
// we are as wide as the smallest child plus its left offset
|
||||
// we are tall as the shortest child plus its top offset
|
||||
|
||||
nsSize max(NS_INTRINSICSIZE,NS_INTRINSICSIZE);
|
||||
|
||||
if (mBoxInColumn) {
|
||||
mBoxInColumn->GetMaxSize(aState, max);
|
||||
nsSize max = mBoxInColumn->GetMaxSize(aState);
|
||||
|
||||
nsBox::AddMargin(mBoxInColumn, max);
|
||||
nsStackLayout::AddOffset(aState, mBoxInColumn, max);
|
||||
|
@ -142,7 +137,7 @@ nsGridCell::GetMaxSize(nsBoxLayoutState& aState)
|
|||
}
|
||||
|
||||
if (mBoxInRow) {
|
||||
mBoxInRow->GetMaxSize(aState, max);
|
||||
nsSize max = mBoxInRow->GetMaxSize(aState);
|
||||
|
||||
nsBox::AddMargin(mBoxInRow, max);
|
||||
nsStackLayout::AddOffset(aState, mBoxInRow, max);
|
||||
|
|
|
@ -517,47 +517,41 @@ nsBox::GetLayoutManager(nsIBoxLayout** aLayout)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBox::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsBox::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
nsSize pref(0,0);
|
||||
DISPLAY_PREF_SIZE(this, pref);
|
||||
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aState, collapsed);
|
||||
if (collapsed)
|
||||
return NS_OK;
|
||||
return pref;
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSPrefSize(aState, this, aSize);
|
||||
AddBorderAndPadding(pref);
|
||||
AddInset(pref);
|
||||
nsIBox::AddCSSPrefSize(aState, this, pref);
|
||||
|
||||
nsSize minSize(0, 0), maxSize(0, 0);
|
||||
GetMinSize(aState, minSize);
|
||||
GetMaxSize(aState, maxSize);
|
||||
BoundsCheck(GetMinSize(aState), pref, GetMaxSize(aState));
|
||||
|
||||
BoundsCheck(minSize, aSize, maxSize);
|
||||
|
||||
return NS_OK;
|
||||
return pref;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBox::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsBox::GetMinSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_MIN_SIZE(this, aSize);
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
nsSize min(0,0);
|
||||
DISPLAY_MIN_SIZE(this, min);
|
||||
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aState, collapsed);
|
||||
if (collapsed)
|
||||
return NS_OK;
|
||||
return min;
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMinSize(aState, this, aSize);
|
||||
return NS_OK;
|
||||
AddBorderAndPadding(min);
|
||||
AddInset(min);
|
||||
nsIBox::AddCSSMinSize(aState, this, min);
|
||||
return min;
|
||||
}
|
||||
|
||||
nsSize
|
||||
|
@ -566,22 +560,21 @@ nsBox::GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
|
|||
return nsSize(0, 0);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBox::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsBox::GetMaxSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_MAX_SIZE(this, aSize);
|
||||
aSize.width = NS_INTRINSICSIZE;
|
||||
aSize.height = NS_INTRINSICSIZE;
|
||||
nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
DISPLAY_MAX_SIZE(this, max);
|
||||
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aState, collapsed);
|
||||
if (collapsed)
|
||||
return NS_OK;
|
||||
return max;
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMaxSize(aState, this, aSize);
|
||||
return NS_OK;
|
||||
AddBorderAndPadding(max);
|
||||
AddInset(max);
|
||||
nsIBox::AddCSSMaxSize(aState, this, max);
|
||||
return max;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -613,10 +606,8 @@ nsBox::GetAscent(nsBoxLayoutState& aState, nscoord& aAscent)
|
|||
if (collapsed)
|
||||
return NS_OK;
|
||||
|
||||
nsSize size(0,0);
|
||||
nsresult rv = GetPrefSize(aState, size);
|
||||
aAscent = size.height;
|
||||
return rv;
|
||||
aAscent = GetPrefSize(aState).height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -57,9 +57,9 @@ public:
|
|||
|
||||
static void Shutdown();
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
|
||||
|
|
|
@ -671,8 +671,7 @@ nsBoxFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
|||
DISPLAY_MIN_WIDTH(this, result);
|
||||
|
||||
nsBoxLayoutState state(GetPresContext(), aRenderingContext);
|
||||
nsSize minSize(0,0);
|
||||
GetMinSize(state, minSize);
|
||||
nsSize minSize = GetMinSize(state);
|
||||
|
||||
// GetMinSize returns border-box width, and we want to return content
|
||||
// width. Since Reflow uses the reflow state's border and padding, we
|
||||
|
@ -693,8 +692,7 @@ nsBoxFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
|||
DISPLAY_PREF_WIDTH(this, result);
|
||||
|
||||
nsBoxLayoutState state(GetPresContext(), aRenderingContext);
|
||||
nsSize prefSize(0,0);
|
||||
GetPrefSize(state, prefSize);
|
||||
nsSize prefSize = GetPrefSize(state);
|
||||
|
||||
// GetPrefSize returns border-box width, and we want to return content
|
||||
// width. Since Reflow uses the reflow state's border and padding, we
|
||||
|
@ -748,16 +746,12 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
nsSize prefSize(0,0);
|
||||
|
||||
// if we are told to layout intrinic then get our preferred size.
|
||||
// if we are told to layout intrinsic then get our preferred size.
|
||||
NS_ASSERTION(computedSize.width != NS_INTRINSICSIZE,
|
||||
"computed width should always be computed");
|
||||
if (computedSize.height == NS_INTRINSICSIZE) {
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
GetPrefSize(state, prefSize);
|
||||
GetMinSize(state, minSize);
|
||||
GetMaxSize(state, maxSize);
|
||||
BoundsCheck(minSize, prefSize, maxSize);
|
||||
prefSize = GetPrefSize(state);
|
||||
BoundsCheck(GetMinSize(state), prefSize, GetMaxSize(state));
|
||||
}
|
||||
|
||||
// get our desiredSize
|
||||
|
@ -830,52 +824,39 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
nsSize size(0,0);
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
if (!DoesNeedRecalc(mPrefSize)) {
|
||||
aSize = mPrefSize;
|
||||
return NS_OK;
|
||||
size = mPrefSize;
|
||||
return size;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PropagateDebug(aBoxLayoutState);
|
||||
#endif
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aBoxLayoutState, collapsed);
|
||||
if (collapsed) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (collapsed)
|
||||
return size;
|
||||
|
||||
// if the size was not completely redefined in CSS then ask our children
|
||||
if (!nsIBox::AddCSSPrefSize(aBoxLayoutState, this, aSize))
|
||||
if (!nsIBox::AddCSSPrefSize(aBoxLayoutState, this, size))
|
||||
{
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
|
||||
if (mLayoutManager) {
|
||||
rv = mLayoutManager->GetPrefSize(this, aBoxLayoutState, aSize);
|
||||
nsIBox::AddCSSPrefSize(aBoxLayoutState, this, aSize);
|
||||
mLayoutManager->GetPrefSize(this, aBoxLayoutState, size);
|
||||
nsIBox::AddCSSPrefSize(aBoxLayoutState, this, size);
|
||||
} else
|
||||
rv = nsBox::GetPrefSize(aBoxLayoutState, aSize);
|
||||
size = nsBox::GetPrefSize(aBoxLayoutState);
|
||||
}
|
||||
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
GetMinSize(aBoxLayoutState, minSize);
|
||||
GetMaxSize(aBoxLayoutState, maxSize);
|
||||
|
||||
BoundsCheck(minSize, aSize, maxSize);
|
||||
|
||||
mPrefSize = aSize;
|
||||
BoundsCheck(GetMinSize(aBoxLayoutState), size, GetMaxSize(aBoxLayoutState));
|
||||
mPrefSize = size;
|
||||
|
||||
return rv;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -908,86 +889,74 @@ nsBoxFrame::GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
DISPLAY_MIN_SIZE(this, aSize);
|
||||
nsSize size(0,0);
|
||||
DISPLAY_MIN_SIZE(this, size);
|
||||
if (!DoesNeedRecalc(mMinSize)) {
|
||||
aSize = mMinSize;
|
||||
return NS_OK;
|
||||
size = mMinSize;
|
||||
return size;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PropagateDebug(aBoxLayoutState);
|
||||
#endif
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
aSize.SizeTo(0, 0);
|
||||
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aBoxLayoutState, collapsed);
|
||||
if (collapsed)
|
||||
return NS_OK;
|
||||
return size;
|
||||
|
||||
// if the size was not completely redefined in CSS then ask our children
|
||||
if (!nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize))
|
||||
if (!nsIBox::AddCSSMinSize(aBoxLayoutState, this, size))
|
||||
{
|
||||
aSize.width = 0;
|
||||
aSize.height = 0;
|
||||
|
||||
if (mLayoutManager) {
|
||||
rv = mLayoutManager->GetMinSize(this, aBoxLayoutState, aSize);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize);
|
||||
mLayoutManager->GetMinSize(this, aBoxLayoutState, size);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, size);
|
||||
} else {
|
||||
rv = nsBox::GetMinSize(aBoxLayoutState, aSize);
|
||||
size = nsBox::GetMinSize(aBoxLayoutState);
|
||||
}
|
||||
}
|
||||
|
||||
mMinSize = aSize;
|
||||
mMinSize = size;
|
||||
|
||||
return rv;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBoxFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsBoxFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
DISPLAY_MAX_SIZE(this, aSize);
|
||||
nsSize size(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
DISPLAY_MAX_SIZE(this, size);
|
||||
if (!DoesNeedRecalc(mMaxSize)) {
|
||||
aSize = mMaxSize;
|
||||
return NS_OK;
|
||||
size = mMaxSize;
|
||||
return size;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_LAYOUT
|
||||
PropagateDebug(aBoxLayoutState);
|
||||
#endif
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
aSize.SizeTo(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
|
||||
PRBool collapsed = PR_FALSE;
|
||||
IsCollapsed(aBoxLayoutState, collapsed);
|
||||
if (collapsed)
|
||||
return NS_OK;
|
||||
return size;
|
||||
|
||||
// if the size was not completely redefined in CSS then ask our children
|
||||
if (!nsIBox::AddCSSMaxSize(aBoxLayoutState, this, aSize))
|
||||
if (!nsIBox::AddCSSMaxSize(aBoxLayoutState, this, size))
|
||||
{
|
||||
aSize.width = NS_INTRINSICSIZE;
|
||||
aSize.height = NS_INTRINSICSIZE;
|
||||
|
||||
if (mLayoutManager) {
|
||||
rv = mLayoutManager->GetMaxSize(this, aBoxLayoutState, aSize);
|
||||
nsIBox::AddCSSMaxSize(aBoxLayoutState, this, aSize);
|
||||
mLayoutManager->GetMaxSize(this, aBoxLayoutState, size);
|
||||
nsIBox::AddCSSMaxSize(aBoxLayoutState, this, size);
|
||||
} else {
|
||||
rv = nsBox::GetMaxSize(aBoxLayoutState, aSize);
|
||||
size = nsBox::GetMaxSize(aBoxLayoutState);
|
||||
}
|
||||
}
|
||||
|
||||
mMaxSize = aSize;
|
||||
mMaxSize = size;
|
||||
|
||||
return rv;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1889,9 +1858,6 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox,
|
|||
nsSize maxSizeCSS (NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
nscoord flexCSS = NS_INTRINSICSIZE;
|
||||
|
||||
nsSize prefSize(0, 0);
|
||||
nsSize minSize (0, 0);
|
||||
nsSize maxSize (NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
nscoord flexSize = 0;
|
||||
nscoord ascentSize = 0;
|
||||
|
||||
|
@ -1901,9 +1867,9 @@ nsBoxFrame::DisplayDebugInfoFor(nsIBox* aBox,
|
|||
nsIBox::AddCSSMaxSize (state, child, maxSizeCSS);
|
||||
nsIBox::AddCSSFlex (state, child, flexCSS);
|
||||
|
||||
child->GetPrefSize(state, prefSize);
|
||||
child->GetMinSize(state, minSize);
|
||||
child->GetMaxSize(state, maxSize);
|
||||
nsSize prefSize = child->GetPrefSize(state);
|
||||
nsSize minSize = child->GetMinSize(state);
|
||||
nsSize maxSize = child->GetMaxSize(state);
|
||||
child->GetFlex(state, flexSize);
|
||||
child->GetAscent(state, ascentSize);
|
||||
|
||||
|
|
|
@ -100,9 +100,9 @@ public:
|
|||
NS_IMETHOD RelayoutChildAtOrdinal(nsBoxLayoutState& aState, nsIBox* aChild);
|
||||
NS_IMETHOD GetIndexOf(nsIBox* aChild, PRInt32* aIndex);
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aBoxLayoutState, nscoord& aFlex);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
#ifdef DEBUG_LAYOUT
|
||||
|
|
|
@ -461,50 +461,43 @@ nsImageBoxFrame::GetImageSize()
|
|||
/**
|
||||
* Ok return our dimensions
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsImageBoxFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsImageBoxFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
if (DoesNeedRecalc(mImageSize)) {
|
||||
nsSize size(0,0);
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
if (DoesNeedRecalc(mImageSize))
|
||||
GetImageSize();
|
||||
}
|
||||
|
||||
if (!mUseSrcAttr && (mSubRect.width > 0 || mSubRect.height > 0))
|
||||
aSize = nsSize(mSubRect.width, mSubRect.height);
|
||||
size = nsSize(mSubRect.width, mSubRect.height);
|
||||
else
|
||||
aSize = mImageSize;
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSPrefSize(aState, this, aSize);
|
||||
size = mImageSize;
|
||||
AddBorderAndPadding(size);
|
||||
AddInset(size);
|
||||
nsIBox::AddCSSPrefSize(aState, this, size);
|
||||
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
GetMinSize(aState, minSize);
|
||||
GetMaxSize(aState, maxSize);
|
||||
BoundsCheck(GetMinSize(aState), size, GetMaxSize(aState));
|
||||
|
||||
BoundsCheck(minSize, aSize, maxSize);
|
||||
|
||||
return NS_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageBoxFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsImageBoxFrame::GetMinSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_MIN_SIZE(this, aSize);
|
||||
// An image can always scale down to (0,0).
|
||||
aSize.width = aSize.height = 0;
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMinSize(aState, this, aSize);
|
||||
return NS_OK;
|
||||
nsSize size(0,0);
|
||||
DISPLAY_MIN_SIZE(this, size);
|
||||
AddBorderAndPadding(size);
|
||||
AddInset(size);
|
||||
nsIBox::AddCSSMinSize(aState, this, size);
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImageBoxFrame::GetAscent(nsBoxLayoutState& aState, nscoord& aCoord)
|
||||
{
|
||||
nsSize size(0,0);
|
||||
GetPrefSize(aState, size);
|
||||
aCoord = size.height;
|
||||
aCoord = GetPrefSize(aState).height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,8 +73,8 @@ class nsImageBoxFrame : public nsLeafBoxFrame
|
|||
public:
|
||||
|
||||
// nsIBox
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
virtual void MarkIntrinsicWidthsDirty();
|
||||
|
||||
|
|
|
@ -197,8 +197,7 @@ nsLeafBoxFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
|
|||
nscoord result;
|
||||
DISPLAY_MIN_WIDTH(this, result);
|
||||
nsBoxLayoutState state(GetPresContext(), aRenderingContext);
|
||||
nsSize minSize(0,0);
|
||||
GetMinSize(state, minSize);
|
||||
nsSize minSize = GetMinSize(state);
|
||||
|
||||
// GetMinSize returns border-box width, and we want to return content
|
||||
// width. Since Reflow uses the reflow state's border and padding, we
|
||||
|
@ -218,8 +217,7 @@ nsLeafBoxFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
|
|||
nscoord result;
|
||||
DISPLAY_PREF_WIDTH(this, result);
|
||||
nsBoxLayoutState state(GetPresContext(), aRenderingContext);
|
||||
nsSize prefSize(0,0);
|
||||
GetPrefSize(state, prefSize);
|
||||
nsSize prefSize = GetPrefSize(state);
|
||||
|
||||
// GetPrefSize returns border-box width, and we want to return content
|
||||
// width. Since Reflow uses the reflow state's border and padding, we
|
||||
|
@ -297,8 +295,7 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
// this happens sometimes. So lets handle it gracefully.
|
||||
if (aReflowState.mComputedHeight == 0) {
|
||||
nsSize minSize(0,0);
|
||||
GetMinSize(state, minSize);
|
||||
nsSize minSize = GetMinSize(state);
|
||||
computedSize.height = minSize.height - m.top - m.bottom;
|
||||
}
|
||||
|
||||
|
@ -306,12 +303,8 @@ nsLeafBoxFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
// if we are told to layout intrinic then get our preferred size.
|
||||
if (computedSize.width == NS_INTRINSICSIZE || computedSize.height == NS_INTRINSICSIZE) {
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
GetPrefSize(state, prefSize);
|
||||
GetMinSize(state, minSize);
|
||||
GetMaxSize(state, maxSize);
|
||||
BoundsCheck(minSize, prefSize, maxSize);
|
||||
prefSize = GetPrefSize(state);
|
||||
BoundsCheck(GetMinSize(state), prefSize, GetMaxSize(state));
|
||||
}
|
||||
|
||||
// get our desiredSize
|
||||
|
@ -418,22 +411,22 @@ nsLeafBoxFrame::CharacterDataChanged(nsPresContext* aPresContext,
|
|||
return nsLeafFrame::CharacterDataChanged(aPresContext, aChild, aAppend);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLeafBoxFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
/* virtual */ nsSize
|
||||
nsLeafBoxFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
return nsBox::GetPrefSize(aState, aSize);
|
||||
return nsBox::GetPrefSize(aState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLeafBoxFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
/* virtual */ nsSize
|
||||
nsLeafBoxFrame::GetMinSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
return nsBox::GetMinSize(aState, aSize);
|
||||
return nsBox::GetMinSize(aState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLeafBoxFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
/* virtual */ nsSize
|
||||
nsLeafBoxFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
return nsBox::GetMaxSize(aState, aSize);
|
||||
return nsBox::GetMaxSize(aState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -52,9 +52,9 @@ public:
|
|||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aState);
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aState);
|
||||
NS_IMETHOD GetFlex(nsBoxLayoutState& aState, nscoord& aFlex);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aState, nscoord& aAscent);
|
||||
|
||||
|
|
|
@ -371,7 +371,7 @@ nsListBoxBodyFrame::GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
|
|||
nsSize result(0, 0);
|
||||
if (nsContentUtils::HasNonEmptyAttr(GetContent(), kNameSpaceID_None,
|
||||
nsGkAtoms::sizemode)) {
|
||||
GetPrefSize(aBoxLayoutState, result);
|
||||
result = GetPrefSize(aBoxLayoutState);
|
||||
result.height = 0;
|
||||
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
|
||||
if (scrollFrame &&
|
||||
|
@ -384,24 +384,24 @@ nsListBoxBodyFrame::GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState)
|
|||
return result;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsListBoxBodyFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
nsresult rv = nsBoxFrame::GetPrefSize(aBoxLayoutState, aSize);
|
||||
nsSize pref = nsBoxFrame::GetPrefSize(aBoxLayoutState);
|
||||
|
||||
PRInt32 size = GetFixedRowSize();
|
||||
nsIBox* box = nsnull;
|
||||
GetChildBox(&box);
|
||||
if (size > -1)
|
||||
aSize.height = size*GetRowHeightTwips();
|
||||
pref.height = size*GetRowHeightTwips();
|
||||
|
||||
nsIScrollableFrame* scrollFrame = nsLayoutUtils::GetScrollableFrameFor(this);
|
||||
if (scrollFrame &&
|
||||
scrollFrame->GetScrollbarStyles().mVertical == NS_STYLE_OVERFLOW_AUTO) {
|
||||
nsMargin scrollbars = scrollFrame->GetDesiredScrollbarSizes(&aBoxLayoutState);
|
||||
aSize.width += scrollbars.left + scrollbars.right;
|
||||
pref.width += scrollbars.left + scrollbars.right;
|
||||
}
|
||||
return rv;
|
||||
return pref;
|
||||
}
|
||||
|
||||
///////////// nsIScrollbarMediator ///////////////
|
||||
|
|
|
@ -93,7 +93,7 @@ public:
|
|||
virtual void MarkIntrinsicWidthsDirty();
|
||||
|
||||
virtual nsSize GetMinSizeForScrollArea(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
|
||||
// size calculation
|
||||
PRInt32 GetRowCount();
|
||||
|
|
|
@ -211,8 +211,7 @@ nsListBoxLayout::LayoutInternal(nsIBox* aBox, nsBoxLayoutState& aState)
|
|||
childRect.y = yOffset;
|
||||
childRect.width = clientRect.width;
|
||||
|
||||
nsSize size;
|
||||
box->GetPrefSize(aState, size);
|
||||
nsSize size = box->GetPrefSize(aState);
|
||||
body->SetRowHeight(size.height);
|
||||
|
||||
childRect.height = rowHeight;
|
||||
|
|
|
@ -71,17 +71,16 @@ nsListItemFrame::~nsListItemFrame()
|
|||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsListItemFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsListItemFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
nsresult rv = nsBoxFrame::GetPrefSize(aState, aSize);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsSize size = nsBoxFrame::GetPrefSize(aState);
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
|
||||
// guarantee that our preferred height doesn't exceed the standard
|
||||
// listbox row height
|
||||
aSize.height = PR_MAX(mRect.height, aSize.height);
|
||||
return NS_OK;
|
||||
size.height = PR_MAX(mRect.height, size.height);
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
const nsDisplayListSet& aLists);
|
||||
|
||||
// nsIBox
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aState);
|
||||
|
||||
protected:
|
||||
nsListItemFrame(nsIPresShell* aPresShell,
|
||||
|
|
|
@ -1016,16 +1016,16 @@ nsMenuFrame::IsSizedToPopup(nsIContent* aContent, PRBool aRequireAlways)
|
|||
return sizeToPopup;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMenuFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsMenuFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
DISPLAY_MIN_SIZE(this, aSize);
|
||||
nsresult rv = nsBoxFrame::GetMinSize(aBoxLayoutState, aSize);
|
||||
nsSize size = nsBoxFrame::GetMinSize(aBoxLayoutState);
|
||||
DISPLAY_MIN_SIZE(this, size);
|
||||
|
||||
if (IsSizedToPopup(mContent, PR_TRUE))
|
||||
SizeToPopup(aBoxLayoutState, aSize);
|
||||
SizeToPopup(aBoxLayoutState, size);
|
||||
|
||||
return rv;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1046,13 +1046,9 @@ nsMenuFrame::DoLayout(nsBoxLayoutState& aState)
|
|||
NS_ASSERTION(popupChild->IsBoxFrame(), "popupChild is not box!!");
|
||||
|
||||
// then get its preferred size
|
||||
nsSize prefSize(0,0);
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
|
||||
popupChild->GetPrefSize(aState, prefSize);
|
||||
popupChild->GetMinSize(aState, minSize);
|
||||
popupChild->GetMaxSize(aState, maxSize);
|
||||
nsSize prefSize = popupChild->GetPrefSize(aState);
|
||||
nsSize minSize = popupChild->GetMinSize(aState);
|
||||
nsSize maxSize = popupChild->GetMaxSize(aState);
|
||||
|
||||
BoundsCheck(minSize, prefSize, maxSize);
|
||||
|
||||
|
@ -2004,7 +2000,7 @@ nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
|
||||
NS_ASSERTION(frame->IsBoxFrame(), "popupChild is not box!!");
|
||||
|
||||
frame->GetPrefSize(aState, tmpSize);
|
||||
tmpSize = frame->GetPrefSize(aState);
|
||||
aSize.width = tmpSize.width;
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -2013,25 +2009,24 @@ nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize)
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMenuFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsMenuFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
nsresult rv = nsBoxFrame::GetPrefSize(aState, aSize);
|
||||
nsSize size = nsBoxFrame::GetPrefSize(aState);
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
|
||||
// If we are using sizetopopup="always" then
|
||||
// nsBoxFrame will already have enforced the minimum size
|
||||
if (!IsSizedToPopup(mContent, PR_TRUE) &&
|
||||
IsSizedToPopup(mContent, PR_FALSE) &&
|
||||
SizeToPopup(aState, aSize)) {
|
||||
// We now need to ensure that aSize is within the min size - max size range.
|
||||
nsSize minSize, maxSize;
|
||||
nsBoxFrame::GetMinSize(aState, minSize);
|
||||
GetMaxSize(aState, maxSize);
|
||||
BoundsCheck(minSize, aSize, maxSize);
|
||||
SizeToPopup(aState, size)) {
|
||||
// We now need to ensure that size is within the min - max range.
|
||||
nsSize minSize = nsBoxFrame::GetMinSize(aState);
|
||||
nsSize maxSize = GetMaxSize(aState);
|
||||
BoundsCheck(minSize, size, maxSize);
|
||||
}
|
||||
|
||||
return rv;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -109,8 +109,8 @@ public:
|
|||
|
||||
// nsIBox
|
||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
|
||||
NS_IMETHOD Init(nsIContent* aContent,
|
||||
nsIFrame* aParent,
|
||||
|
|
|
@ -252,29 +252,30 @@ nsNativeScrollbarFrame::AttributeChanged(PRInt32 aNameSpaceID,
|
|||
// Ask our native widget what dimensions it wants to be, convert them
|
||||
// back to twips, and tell gecko.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsNativeScrollbarFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsNativeScrollbarFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
nsSize size(0,0);
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
float p2t = 0.0;
|
||||
p2t = aState.PresContext()->PixelsToTwips();
|
||||
|
||||
PRInt32 narrowDimension = 0;
|
||||
nsCOMPtr<nsINativeScrollbar> native ( do_QueryInterface(mScrollbar) );
|
||||
if ( !native ) return NS_ERROR_FAILURE;
|
||||
if ( !native ) return size;
|
||||
native->GetNarrowSize(&narrowDimension);
|
||||
|
||||
if ( IsVertical() )
|
||||
aSize.width = nscoord(narrowDimension * p2t);
|
||||
size.width = nscoord(narrowDimension * p2t);
|
||||
else
|
||||
aSize.height = nscoord(narrowDimension * p2t);
|
||||
size.height = nscoord(narrowDimension * p2t);
|
||||
|
||||
// By now, we have both the content node for the scrollbar and the associated
|
||||
// scrollbar mediator (for outliner, if applicable). Hook up the scrollbar to
|
||||
// gecko
|
||||
Hookup();
|
||||
|
||||
return NS_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
const nsHTMLReflowState& aReflowState,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aState);
|
||||
|
||||
virtual void Destroy();
|
||||
|
||||
|
|
|
@ -249,13 +249,9 @@ nsPopupSetFrame::DoLayout(nsBoxLayoutState& aState)
|
|||
NS_ASSERTION(popupChild->IsBoxFrame(), "popupChild is not box!!");
|
||||
|
||||
// then get its preferred size
|
||||
nsSize prefSize(0,0);
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
|
||||
popupChild->GetPrefSize(aState, prefSize);
|
||||
popupChild->GetMinSize(aState, minSize);
|
||||
popupChild->GetMaxSize(aState, maxSize);
|
||||
nsSize prefSize = popupChild->GetPrefSize(aState);
|
||||
nsSize minSize = popupChild->GetMinSize(aState);
|
||||
nsSize maxSize = popupChild->GetMaxSize(aState);
|
||||
|
||||
BoundsCheck(minSize, prefSize, maxSize);
|
||||
|
||||
|
|
|
@ -349,8 +349,7 @@ nsSliderFrame::DoLayout(nsBoxLayoutState& aState)
|
|||
PRBool isHorizontal = IsHorizontal();
|
||||
|
||||
// get the thumb's pref size
|
||||
nsSize thumbSize(0,0);
|
||||
thumbBox->GetPrefSize(aState, thumbSize);
|
||||
nsSize thumbSize = thumbBox->GetPrefSize(aState);
|
||||
|
||||
if (isHorizontal)
|
||||
thumbSize.height = clientRect.height;
|
||||
|
@ -1011,27 +1010,27 @@ nsSliderFrame::Destroy()
|
|||
nsBoxFrame::Destroy();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSliderFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsSliderFrame::GetPrefSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
EnsureOrient();
|
||||
return nsBoxFrame::GetPrefSize(aState, aSize);
|
||||
return nsBoxFrame::GetPrefSize(aState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSliderFrame::GetMinSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsSliderFrame::GetMinSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
EnsureOrient();
|
||||
|
||||
// our min size is just our borders and padding
|
||||
return nsBox::GetMinSize(aState, aSize);
|
||||
return nsBox::GetMinSize(aState);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSliderFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
|
||||
nsSize
|
||||
nsSliderFrame::GetMaxSize(nsBoxLayoutState& aState)
|
||||
{
|
||||
EnsureOrient();
|
||||
return nsBoxFrame::GetMaxSize(aState, aSize);
|
||||
return nsBoxFrame::GetMaxSize(aState);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -134,9 +134,9 @@ public:
|
|||
#endif
|
||||
|
||||
// nsIBox
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMaxSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
|
||||
// nsIFrame overrides
|
||||
|
|
|
@ -775,20 +775,16 @@ nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
// skip over any splitters
|
||||
if (atom != nsGkAtoms::splitter) {
|
||||
nsSize prefSize(0,0);
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
nscoord flex = 0;
|
||||
|
||||
childBox->GetPrefSize(state, prefSize);
|
||||
childBox->GetMinSize(state, minSize);
|
||||
childBox->GetMaxSize(state, maxSize);
|
||||
nsSize prefSize = childBox->GetPrefSize(state);
|
||||
nsSize minSize = childBox->GetMinSize(state);
|
||||
nsSize maxSize = childBox->GetMaxSize(state);
|
||||
nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
||||
|
||||
mOuter->AddMargin(childBox, minSize);
|
||||
mOuter->AddMargin(childBox, prefSize);
|
||||
mOuter->AddMargin(childBox, maxSize);
|
||||
|
||||
nscoord flex = 0;
|
||||
childBox->GetFlex(state, flex);
|
||||
|
||||
nsMargin margin(0,0,0,0);
|
||||
|
|
|
@ -363,19 +363,15 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
|||
nscoord width = clientRect.width;
|
||||
nscoord height = clientRect.height;
|
||||
|
||||
nsSize prefSize(0,0);
|
||||
nsSize minSize(0,0);
|
||||
nsSize maxSize(0,0);
|
||||
|
||||
if (!childBoxSize->bogus) {
|
||||
// We have a valid box size entry. This entry already contains information about our
|
||||
// sizes along the axis of the box (e.g., widths in a horizontal box). If our default
|
||||
// ALIGN is not stretch, however, then we also need to know the child's size along the
|
||||
// opposite axis.
|
||||
if (!(frameState & NS_STATE_AUTO_STRETCH)) {
|
||||
child->GetPrefSize(aState, prefSize);
|
||||
child->GetMinSize(aState, minSize);
|
||||
child->GetMaxSize(aState, maxSize);
|
||||
nsSize prefSize = child->GetPrefSize(aState);
|
||||
nsSize minSize = child->GetMinSize(aState);
|
||||
nsSize maxSize = child->GetMaxSize(aState);
|
||||
nsBox::BoundsCheck(minSize, prefSize, maxSize);
|
||||
|
||||
AddMargin(child, prefSize);
|
||||
|
@ -510,8 +506,8 @@ nsSprocketLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
|||
if (sizeChanged) {
|
||||
// Our size is different. Sanity check against our maximum allowed size to ensure
|
||||
// we didn't exceed it.
|
||||
child->GetMinSize(aState, minSize);
|
||||
child->GetMaxSize(aState, maxSize);
|
||||
nsSize minSize = child->GetMinSize(aState);
|
||||
nsSize maxSize = child->GetMaxSize(aState);
|
||||
nsBox::BoundsCheckMinMax(minSize, maxSize);
|
||||
|
||||
// make sure the size is in our max size.
|
||||
|
@ -818,9 +814,9 @@ nsSprocketLayout::PopulateBoxSizes(nsIBox* aBox, nsBoxLayoutState& aState, nsBox
|
|||
// 0 then and not even have to ask for it.
|
||||
//if (flexes != 1) {
|
||||
|
||||
child->GetPrefSize(aState, pref);
|
||||
child->GetMinSize(aState, min);
|
||||
child->GetMaxSize(aState, max);
|
||||
pref = child->GetPrefSize(aState);
|
||||
min = child->GetMinSize(aState);
|
||||
max = child->GetMaxSize(aState);
|
||||
child->GetAscent(aState, ascent);
|
||||
nsMargin margin;
|
||||
child->GetMargin(margin);
|
||||
|
@ -1074,10 +1070,8 @@ nsSprocketLayout::ChildResized(nsIBox* aBox,
|
|||
// 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.
|
||||
|
||||
nsSize max(0,0);
|
||||
nsSize min(0,0);
|
||||
aChild->GetMaxSize(aState, max);
|
||||
aChild->GetMinSize(aState, min);
|
||||
nsSize max = aChild->GetMaxSize(aState);
|
||||
nsSize min = aChild->GetMinSize(aState);
|
||||
nsBox::BoundsCheckMinMax(min, max);
|
||||
AddMargin(aChild, max);
|
||||
|
||||
|
@ -1112,10 +1106,8 @@ nsSprocketLayout::ChildResized(nsIBox* aBox,
|
|||
}
|
||||
|
||||
if (childActualWidth > childLayoutWidth) {
|
||||
nsSize max(0,0);
|
||||
nsSize min(0,0);
|
||||
aChild->GetMinSize(aState, min);
|
||||
aChild->GetMaxSize(aState, max);
|
||||
nsSize min = aChild->GetMinSize(aState);
|
||||
nsSize max = aChild->GetMaxSize(aState);
|
||||
nsBox::BoundsCheckMinMax(min, max);
|
||||
AddMargin(aChild, max);
|
||||
|
||||
|
@ -1364,8 +1356,7 @@ nsSprocketLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aS
|
|||
|
||||
if (!isCollapsed)
|
||||
{
|
||||
nsSize pref(0,0);
|
||||
child->GetPrefSize(aState, pref);
|
||||
nsSize pref = child->GetPrefSize(aState);
|
||||
AddMargin(child, pref);
|
||||
|
||||
if (isEqual) {
|
||||
|
@ -1428,17 +1419,16 @@ nsSprocketLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi
|
|||
|
||||
if (!isCollapsed)
|
||||
{
|
||||
nsSize min(0,0);
|
||||
nsSize min = child->GetMinSize(aState);
|
||||
nsSize pref(0,0);
|
||||
nscoord flex = 0;
|
||||
|
||||
child->GetMinSize(aState, min);
|
||||
child->GetFlex(aState, flex);
|
||||
|
||||
// if the child is not flexible then
|
||||
// its min size is its pref size.
|
||||
if (flex == 0) {
|
||||
child->GetPrefSize(aState, pref);
|
||||
pref = child->GetPrefSize(aState);
|
||||
if (isHorizontal)
|
||||
min.width = pref.width;
|
||||
else
|
||||
|
@ -1510,10 +1500,8 @@ nsSprocketLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSi
|
|||
if (!isCollapsed)
|
||||
{
|
||||
// if completely redefined don't even ask our child for its size.
|
||||
nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
nsSize min(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
child->GetMaxSize(aState, max);
|
||||
child->GetMinSize(aState, min);
|
||||
nsSize max = child->GetMaxSize(aState);
|
||||
nsSize min = child->GetMinSize(aState);
|
||||
nsBox::BoundsCheckMinMax(min, max);
|
||||
|
||||
AddMargin(child, max);
|
||||
|
|
|
@ -88,8 +88,7 @@ nsStackLayout::GetPrefSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize
|
|||
aBox->GetChildBox(&child);
|
||||
|
||||
while (child) {
|
||||
nsSize pref(0,0);
|
||||
child->GetPrefSize(aState, pref);
|
||||
nsSize pref = child->GetPrefSize(aState);
|
||||
|
||||
AddMargin(child, pref);
|
||||
AddOffset(aState, child, pref);
|
||||
|
@ -117,8 +116,7 @@ nsStackLayout::GetMinSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
|||
aBox->GetChildBox(&child);
|
||||
|
||||
while (child) {
|
||||
nsSize min(0,0);
|
||||
child->GetMinSize(aState, min);
|
||||
nsSize min = child->GetMinSize(aState);
|
||||
AddMargin(child, min);
|
||||
AddOffset(aState, child, min);
|
||||
AddLargestSize(aSize, min);
|
||||
|
@ -145,10 +143,8 @@ nsStackLayout::GetMaxSize(nsIBox* aBox, nsBoxLayoutState& aState, nsSize& aSize)
|
|||
aBox->GetChildBox(&child);
|
||||
|
||||
while (child) {
|
||||
nsSize max(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
child->GetMaxSize(aState, max);
|
||||
nsSize min(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
|
||||
child->GetMinSize(aState, min);
|
||||
nsSize max = child->GetMaxSize(aState);
|
||||
nsSize min = child->GetMinSize(aState);
|
||||
nsBox::BoundsCheckMinMax(min, max);
|
||||
|
||||
AddMargin(child, max);
|
||||
|
@ -298,8 +294,7 @@ nsStackLayout::Layout(nsIBox* aBox, nsBoxLayoutState& aState)
|
|||
// If we have an offset, we don't stretch the child. Just use
|
||||
// its preferred size.
|
||||
if (offsetSpecified) {
|
||||
nsSize pref(0,0);
|
||||
child->GetPrefSize(aState, pref);
|
||||
nsSize pref = child->GetPrefSize(aState);
|
||||
childRect.width = pref.width;
|
||||
childRect.height = pref.height;
|
||||
}
|
||||
|
|
|
@ -854,42 +854,41 @@ nsTextBoxFrame::CalcTextSize(nsBoxLayoutState& aBoxLayoutState)
|
|||
/**
|
||||
* Ok return our dimensions
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsTextBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsTextBoxFrame::GetPrefSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
DISPLAY_PREF_SIZE(this, aSize);
|
||||
CalcTextSize(aBoxLayoutState);
|
||||
|
||||
aSize = mTextSize;
|
||||
nsSize size = mTextSize;
|
||||
DISPLAY_PREF_SIZE(this, size);
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSPrefSize(aBoxLayoutState, this, aSize);
|
||||
AddBorderAndPadding(size);
|
||||
AddInset(size);
|
||||
nsIBox::AddCSSPrefSize(aBoxLayoutState, this, size);
|
||||
|
||||
return NS_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ok return our dimensions
|
||||
*/
|
||||
NS_IMETHODIMP
|
||||
nsTextBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsTextBoxFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
DISPLAY_MIN_SIZE(this, aSize);
|
||||
CalcTextSize(aBoxLayoutState);
|
||||
|
||||
aSize = mTextSize;
|
||||
nsSize size = mTextSize;
|
||||
DISPLAY_MIN_SIZE(this, size);
|
||||
|
||||
// if there is cropping our min width becomes our border and padding
|
||||
if (mCropType != CropNone) {
|
||||
aSize.width = 0;
|
||||
}
|
||||
// if there is cropping our min width becomes our border and padding
|
||||
if (mCropType != CropNone)
|
||||
size.width = 0;
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize);
|
||||
AddBorderAndPadding(size);
|
||||
AddInset(size);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, size);
|
||||
|
||||
return NS_OK;
|
||||
return size;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -48,8 +48,8 @@ class nsTextBoxFrame : public nsTextBoxFrameSuper
|
|||
public:
|
||||
|
||||
// nsIBox
|
||||
NS_IMETHOD GetPrefSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent);
|
||||
NS_IMETHOD DoLayout(nsBoxLayoutState& aBoxLayoutState);
|
||||
virtual void MarkIntrinsicWidthsDirty();
|
||||
|
|
|
@ -217,20 +217,21 @@ nsTreeBodyFrame::Init(nsIContent* aContent,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
||||
nsSize
|
||||
nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
|
||||
{
|
||||
EnsureView();
|
||||
|
||||
nsIContent* baseElement = GetBaseElement();
|
||||
|
||||
nsSize min(0,0);
|
||||
PRInt32 desiredRows;
|
||||
if (NS_UNLIKELY(!baseElement)) {
|
||||
desiredRows = 0;
|
||||
}
|
||||
else if (baseElement->Tag() == nsGkAtoms::select &&
|
||||
baseElement->IsNodeOfType(nsINode::eHTML)) {
|
||||
aSize.width = CalcMaxRowWidth();
|
||||
min.width = CalcMaxRowWidth();
|
||||
nsAutoString size;
|
||||
baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::size, size);
|
||||
if (!size.IsEmpty()) {
|
||||
|
@ -245,7 +246,6 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
|||
}
|
||||
else {
|
||||
// tree
|
||||
aSize.width = 0;
|
||||
nsAutoString rows;
|
||||
baseElement->GetAttr(kNameSpaceID_None, nsGkAtoms::rows, rows);
|
||||
if (!rows.IsEmpty()) {
|
||||
|
@ -258,13 +258,13 @@ nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize)
|
|||
}
|
||||
}
|
||||
|
||||
aSize.height = mRowHeight * desiredRows;
|
||||
min.height = mRowHeight * desiredRows;
|
||||
|
||||
AddBorderAndPadding(aSize);
|
||||
AddInset(aSize);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, aSize);
|
||||
AddBorderAndPadding(min);
|
||||
AddInset(min);
|
||||
nsIBox::AddCSSMinSize(aBoxLayoutState, this, min);
|
||||
|
||||
return NS_OK;
|
||||
return min;
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
|
|
@ -86,7 +86,7 @@ public:
|
|||
NS_DECL_NSITREEBOXOBJECT
|
||||
|
||||
// nsIBox
|
||||
NS_IMETHOD GetMinSize(nsBoxLayoutState& aBoxLayoutState, nsSize& aSize);
|
||||
virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
|
||||
NS_IMETHOD SetBounds(nsBoxLayoutState& aBoxLayoutState, const nsRect& aRect,
|
||||
PRBool aRemoveOverflowArea = PR_FALSE);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче