Fix percentage padding on nodes with overflow other than visible. Bug 332557,

r+sr=dbaron.
This commit is contained in:
bzbarsky%mit.edu 2006-12-12 15:18:40 +00:00
Родитель 5e603f9a1c
Коммит 7f0b22e884
3 изменённых файлов: 22 добавлений и 15 удалений

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

@ -437,20 +437,25 @@ nsHTMLScrollFrame::ReflowScrolledFrame(const ScrollReflowState& aState,
availWidth = PR_MAX(0, availWidth - vScrollbarPrefSize.width);
}
// pixel align the content
nscoord twp = GetPresContext()->IntScaledPixelsToTwips(1);
nsPresContext* presContext = GetPresContext();
nscoord twp = presContext->IntScaledPixelsToTwips(1);
availWidth -= availWidth % twp;
if (!aFirstPass)
mInner.mScrolledFrame->AddStateBits(NS_FRAME_IS_DIRTY);
nsHTMLReflowState kidReflowState(GetPresContext(), aState.mReflowState,
// Pass PR_FALSE for aInit so we can pass in the correct padding
nsHTMLReflowState kidReflowState(presContext, aState.mReflowState,
mInner.mScrolledFrame,
nsSize(availWidth, NS_UNCONSTRAINEDSIZE));
nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
-1, -1, PR_FALSE);
kidReflowState.Init(presContext, -1, -1, nsnull,
&aState.mReflowState.mComputedPadding);
kidReflowState.mFlags.mAssumingHScrollbar = aAssumeHScroll;
kidReflowState.mFlags.mAssumingVScrollbar = aAssumeVScroll;
nsReflowStatus status;
nsresult rv = ReflowChild(mInner.mScrolledFrame, GetPresContext(), *aMetrics,
nsresult rv = ReflowChild(mInner.mScrolledFrame, presContext, *aMetrics,
kidReflowState, 0, 0,
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_MOVE_VIEW, status);
// Don't resize or position the view because we're going to resize
@ -458,7 +463,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(const ScrollReflowState& aState,
// resize here would size it to the natural height of the frame,
// which will usually be different from the scrollport height;
// invalidating the difference will cause unnecessary repainting.
FinishReflowChild(mInner.mScrolledFrame, GetPresContext(),
FinishReflowChild(mInner.mScrolledFrame, presContext,
&kidReflowState, *aMetrics, 0, 0,
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_MOVE_VIEW | NS_FRAME_NO_SIZE_VIEW);

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

@ -211,8 +211,8 @@ void
nsHTMLReflowState::Init(nsPresContext* aPresContext,
nscoord aContainingBlockWidth,
nscoord aContainingBlockHeight,
nsMargin* aBorder,
nsMargin* aPadding)
const nsMargin* aBorder,
const nsMargin* aPadding)
{
NS_ASSERTION(availableWidth != NS_UNCONSTRAINEDSIZE,
"shouldn't use unconstrained widths anymore");
@ -1454,8 +1454,8 @@ void
nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
nscoord aContainingBlockWidth,
nscoord aContainingBlockHeight,
nsMargin* aBorder,
nsMargin* aPadding)
const nsMargin* aBorder,
const nsMargin* aPadding)
{
// If this is the root frame, then set the computed width and
// height equal to the available space
@ -1664,7 +1664,8 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
void
nsCSSOffsetState::InitOffsets(nscoord aContainingBlockWidth,
nsMargin *aBorder, nsMargin *aPadding)
const nsMargin *aBorder,
const nsMargin *aPadding)
{
// Compute margins from the specified margin style information. These
// become the default computed values, and may be adjusted below

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

@ -169,7 +169,8 @@ public:
}
void InitOffsets(nscoord aContainingBlockWidth,
nsMargin *aBorder = nsnull, nsMargin *aPadding = nsnull);
const nsMargin *aBorder = nsnull,
const nsMargin *aPadding = nsnull);
private:
// Computes margin values from the specified margin style information, and
@ -354,8 +355,8 @@ struct nsHTMLReflowState : public nsCSSOffsetState {
void Init(nsPresContext* aPresContext,
nscoord aContainingBlockWidth = -1,
nscoord aContainingBlockHeight = -1,
nsMargin* aBorder = nsnull,
nsMargin* aPadding = nsnull);
const nsMargin* aBorder = nsnull,
const nsMargin* aPadding = nsnull);
/**
* Find the content width of the containing block of aReflowState
*/
@ -416,8 +417,8 @@ protected:
void InitConstraints(nsPresContext* aPresContext,
nscoord aContainingBlockWidth,
nscoord aContainingBlockHeight,
nsMargin* aBorder,
nsMargin* aPadding);
const nsMargin* aBorder,
const nsMargin* aPadding);
void CalculateHypotheticalBox(nsPresContext* aPresContext,
nsIFrame* aPlaceholderFrame,