Checked in wrong patch. Backing out.
This commit is contained in:
@@ -255,7 +255,6 @@ struct ScrollReflowState {
|
|||||||
nsBoxLayoutState mBoxState;
|
nsBoxLayoutState mBoxState;
|
||||||
nsGfxScrollFrameInner::ScrollbarStyles mStyles;
|
nsGfxScrollFrameInner::ScrollbarStyles mStyles;
|
||||||
nsReflowReason mNewReason;
|
nsReflowReason mNewReason;
|
||||||
nsMargin mComputedBorder;
|
|
||||||
|
|
||||||
// === Filled in when TryLayout succeeds ===
|
// === Filled in when TryLayout succeeds ===
|
||||||
// The area of the scrollport, in coordinates relative to the scrollframe
|
// The area of the scrollport, in coordinates relative to the scrollframe
|
||||||
@@ -284,25 +283,20 @@ struct ScrollReflowState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static nsSize ComputeInsideBorderSize(ScrollReflowState* aState,
|
static nsSize ComputeInsideBorderSize(ScrollReflowState* aState,
|
||||||
const nsSize& aDesiredInsideBorderSize)
|
const nsSize& aDesiredInsideBorderSize,
|
||||||
|
const nsMargin& aKidPadding)
|
||||||
{
|
{
|
||||||
// aDesiredInsideBorderSize is the frame size; i.e., it includes
|
nscoord width = aState->mReflowState.mComputedWidth;
|
||||||
// borders and padding (but the scrolled child doesn't have
|
if (width == NS_UNCONSTRAINEDSIZE) {
|
||||||
// borders). The scrolled child has the same padding as us.
|
width = aDesiredInsideBorderSize.width - aKidPadding.left - aKidPadding.right;
|
||||||
nscoord contentWidth = aState->mReflowState.mComputedWidth;
|
|
||||||
if (contentWidth == NS_UNCONSTRAINEDSIZE) {
|
|
||||||
contentWidth = aDesiredInsideBorderSize.width -
|
|
||||||
aState->mReflowState.mComputedPadding.LeftRight();
|
|
||||||
}
|
}
|
||||||
nscoord contentHeight = aState->mReflowState.mComputedHeight;
|
nscoord height = aState->mReflowState.mComputedHeight;
|
||||||
if (contentHeight == NS_UNCONSTRAINEDSIZE) {
|
if (height == NS_UNCONSTRAINEDSIZE) {
|
||||||
contentHeight = aDesiredInsideBorderSize.height -
|
height = aDesiredInsideBorderSize.height - aKidPadding.top - aKidPadding.bottom;
|
||||||
aState->mReflowState.mComputedPadding.TopBottom();
|
|
||||||
}
|
}
|
||||||
|
aState->mReflowState.ApplyMinMaxConstraints(&width, &height);
|
||||||
aState->mReflowState.ApplyMinMaxConstraints(&contentWidth, &contentHeight);
|
return nsSize(width + aKidPadding.left + aKidPadding.right,
|
||||||
return nsSize(contentWidth + aState->mReflowState.mComputedPadding.LeftRight(),
|
height + aKidPadding.top + aKidPadding.bottom);
|
||||||
contentHeight + aState->mReflowState.mComputedPadding.TopBottom());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -354,6 +348,7 @@ GetScrollbarMetrics(nsBoxLayoutState& aState, nsIBox* aBox, nsSize* aMin, PRBool
|
|||||||
PRBool
|
PRBool
|
||||||
nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
|
nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
|
||||||
const nsHTMLReflowMetrics& aKidMetrics,
|
const nsHTMLReflowMetrics& aKidMetrics,
|
||||||
|
const nsMargin& aKidPadding,
|
||||||
PRBool aAssumeVScroll, PRBool aAssumeHScroll,
|
PRBool aAssumeVScroll, PRBool aAssumeHScroll,
|
||||||
PRBool aForce)
|
PRBool aForce)
|
||||||
{
|
{
|
||||||
@@ -386,7 +381,7 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
|
|||||||
desiredInsideBorderSize.height = hScrollbarActualHeight +
|
desiredInsideBorderSize.height = hScrollbarActualHeight +
|
||||||
PR_MAX(aKidMetrics.height, vScrollbarRequiredHeight);
|
PR_MAX(aKidMetrics.height, vScrollbarRequiredHeight);
|
||||||
aState->mInsideBorderSize =
|
aState->mInsideBorderSize =
|
||||||
ComputeInsideBorderSize(aState, desiredInsideBorderSize);
|
ComputeInsideBorderSize(aState, desiredInsideBorderSize, aKidPadding);
|
||||||
nsSize scrollPortSize = nsSize(aState->mInsideBorderSize.width - vScrollbarActualWidth,
|
nsSize scrollPortSize = nsSize(aState->mInsideBorderSize.width - vScrollbarActualWidth,
|
||||||
aState->mInsideBorderSize.height - hScrollbarActualHeight);
|
aState->mInsideBorderSize.height - hScrollbarActualHeight);
|
||||||
|
|
||||||
@@ -416,34 +411,21 @@ nsHTMLScrollFrame::TryLayout(ScrollReflowState* aState,
|
|||||||
|
|
||||||
aState->mShowHScrollbar = aAssumeHScroll;
|
aState->mShowHScrollbar = aAssumeHScroll;
|
||||||
aState->mShowVScrollbar = aAssumeVScroll;
|
aState->mShowVScrollbar = aAssumeVScroll;
|
||||||
nsPoint scrollPortOrigin(aState->mComputedBorder.left,
|
nsPoint scrollPortOrigin(aState->mReflowState.mComputedBorderPadding.left,
|
||||||
aState->mComputedBorder.top);
|
aState->mReflowState.mComputedBorderPadding.top);
|
||||||
if (!mInner.IsScrollbarOnRight()) {
|
if (!mInner.IsScrollbarOnRight()) {
|
||||||
scrollPortOrigin.x += vScrollbarActualWidth;
|
scrollPortOrigin.x += vScrollbarActualWidth;
|
||||||
}
|
}
|
||||||
aState->mScrollPortRect = nsRect(scrollPortOrigin, scrollPortSize);
|
aState->mScrollPortRect = nsRect(scrollPortOrigin, scrollPortSize);
|
||||||
aState->mAscent = aKidMetrics.ascent;
|
aState->mAscent = aKidMetrics.ascent;
|
||||||
if (aKidMetrics.mComputeMEW) {
|
if (aKidMetrics.mComputeMEW) {
|
||||||
nscoord kidContentMEW = aKidMetrics.mMaxElementWidth -
|
aState->mMaxElementWidth = aKidMetrics.mMaxElementWidth + vScrollbarActualWidth;
|
||||||
aState->mReflowState.mComputedPadding.LeftRight();
|
|
||||||
NS_ASSERTION(kidContentMEW >= 0, "MEW didn't include padding?");
|
|
||||||
aState->mMaxElementWidth = vScrollbarActualWidth +
|
|
||||||
aState->mReflowState.mComputedPadding.LeftRight() +
|
|
||||||
aState->mReflowState.AdjustIntrinsicMinContentWidthForStyle(kidContentMEW);
|
|
||||||
// borders get added on the way out of Reflow()
|
|
||||||
}
|
}
|
||||||
if (aKidMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
if (aKidMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
||||||
nscoord kidMaxWidth = aKidMetrics.mMaximumWidth;
|
aState->mMaximumWidth = aKidMetrics.mMaximumWidth;
|
||||||
if (kidMaxWidth != NS_UNCONSTRAINEDSIZE) {
|
if (aState->mMaximumWidth != NS_UNCONSTRAINEDSIZE) {
|
||||||
nscoord kidContentMaxWidth = kidMaxWidth -
|
aState->mMaximumWidth += vScrollbarActualWidth;
|
||||||
aState->mReflowState.mComputedPadding.LeftRight();
|
|
||||||
NS_ASSERTION(kidContentMaxWidth >= 0, "max-width didn't include padding?");
|
|
||||||
kidMaxWidth = vScrollbarActualWidth +
|
|
||||||
aState->mReflowState.mComputedPadding.LeftRight() +
|
|
||||||
aState->mReflowState.AdjustIntrinsicContentWidthForStyle(kidContentMaxWidth);
|
|
||||||
}
|
}
|
||||||
aState->mMaximumWidth = kidMaxWidth;
|
|
||||||
// borders get added on the way out of Reflow()
|
|
||||||
}
|
}
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
}
|
}
|
||||||
@@ -452,38 +434,24 @@ nsresult
|
|||||||
nsHTMLScrollFrame::ReflowScrolledFrame(const ScrollReflowState& aState,
|
nsHTMLScrollFrame::ReflowScrolledFrame(const ScrollReflowState& aState,
|
||||||
PRBool aAssumeVScroll,
|
PRBool aAssumeVScroll,
|
||||||
nsHTMLReflowMetrics* aMetrics,
|
nsHTMLReflowMetrics* aMetrics,
|
||||||
|
nsMargin* aKidPadding,
|
||||||
PRBool aFirstPass)
|
PRBool aFirstPass)
|
||||||
{
|
{
|
||||||
// these could be NS_UNCONSTRAINEDSIZE ... PR_MIN arithmetic should
|
// these could be NS_UNCONSTRAINEDSIZE ... PR_MIN arithmetic should
|
||||||
// be OK
|
// be OK
|
||||||
nscoord paddingLR = aState.mReflowState.mComputedPadding.LeftRight();
|
nscoord availWidth = PR_MIN(aState.mReflowState.mComputedMaxWidth,
|
||||||
|
PR_MIN(aState.mReflowState.mComputedWidth,
|
||||||
nscoord availWidth = aState.mReflowState.availableWidth;
|
aState.mReflowState.availableWidth));
|
||||||
if (aState.mReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) {
|
|
||||||
availWidth = aState.mReflowState.mComputedWidth + paddingLR;
|
|
||||||
} else {
|
|
||||||
if (aState.mReflowState.mComputedMaxWidth != NS_UNCONSTRAINEDSIZE) {
|
|
||||||
availWidth = PR_MIN(availWidth,
|
|
||||||
aState.mReflowState.mComputedMaxWidth + paddingLR);
|
|
||||||
}
|
|
||||||
if (aState.mReflowState.mComputedWidth != NS_UNCONSTRAINEDSIZE) {
|
|
||||||
availWidth = PR_MIN(availWidth,
|
|
||||||
aState.mReflowState.mComputedWidth + paddingLR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (availWidth != NS_UNCONSTRAINEDSIZE && aAssumeVScroll) {
|
if (availWidth != NS_UNCONSTRAINEDSIZE && aAssumeVScroll) {
|
||||||
nsSize vScrollbarMinSize;
|
nsSize vScrollbarMinSize;
|
||||||
mInner.mVScrollbarBox->GetMinSize(NS_CONST_CAST(nsBoxLayoutState&, aState.mBoxState),
|
mInner.mVScrollbarBox->GetMinSize(NS_CONST_CAST(nsBoxLayoutState&, aState.mBoxState),
|
||||||
vScrollbarMinSize);
|
vScrollbarMinSize);
|
||||||
availWidth = PR_MAX(0, availWidth - vScrollbarMinSize.width);
|
availWidth = PR_MAX(0, availWidth - vScrollbarMinSize.width);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHTMLReflowState kidReflowState(GetPresContext(), aState.mReflowState,
|
nsHTMLReflowState kidReflowState(GetPresContext(), aState.mReflowState,
|
||||||
mInner.mScrolledFrame,
|
mInner.mScrolledFrame,
|
||||||
nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
|
nsSize(availWidth, NS_UNCONSTRAINEDSIZE),
|
||||||
aFirstPass ? aState.mNewReason : eReflowReason_Resize);
|
aFirstPass ? aState.mNewReason : eReflowReason_Resize);
|
||||||
|
|
||||||
if (IsRTLTextControl()) {
|
if (IsRTLTextControl()) {
|
||||||
kidReflowState.mRightEdge = mInner.GetScrolledSize().width;
|
kidReflowState.mRightEdge = mInner.GetScrolledSize().width;
|
||||||
}
|
}
|
||||||
@@ -494,6 +462,7 @@ nsHTMLScrollFrame::ReflowScrolledFrame(const ScrollReflowState& aState,
|
|||||||
FinishReflowChild(mInner.mScrolledFrame, GetPresContext(),
|
FinishReflowChild(mInner.mScrolledFrame, GetPresContext(),
|
||||||
&kidReflowState, *aMetrics, 0, 0,
|
&kidReflowState, *aMetrics, 0, 0,
|
||||||
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_MOVE_VIEW);
|
NS_FRAME_NO_MOVE_FRAME | NS_FRAME_NO_MOVE_VIEW);
|
||||||
|
*aKidPadding = kidReflowState.mComputedPadding;
|
||||||
|
|
||||||
// XXX Some frames (e.g., nsObjectFrame, nsFrameFrame, nsTextFrame) don't bother
|
// XXX Some frames (e.g., nsObjectFrame, nsFrameFrame, nsTextFrame) don't bother
|
||||||
// setting their mOverflowArea. This is wrong because every frame should
|
// setting their mOverflowArea. This is wrong because every frame should
|
||||||
@@ -538,8 +507,9 @@ nsHTMLScrollFrame::ReflowContents(ScrollReflowState* aState,
|
|||||||
currentlyUsingVScrollbar = PR_FALSE;
|
currentlyUsingVScrollbar = PR_FALSE;
|
||||||
|
|
||||||
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags);
|
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags);
|
||||||
|
nsMargin kidPadding;
|
||||||
nsresult rv = ReflowScrolledFrame(*aState, currentlyUsingVScrollbar,
|
nsresult rv = ReflowScrolledFrame(*aState, currentlyUsingVScrollbar,
|
||||||
&kidDesiredSize, PR_TRUE);
|
&kidDesiredSize, &kidPadding, PR_TRUE);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
PRBool didUseScrollbar = currentlyUsingVScrollbar;
|
PRBool didUseScrollbar = currentlyUsingVScrollbar;
|
||||||
@@ -564,14 +534,14 @@ nsHTMLScrollFrame::ReflowContents(ScrollReflowState* aState,
|
|||||||
aState->mStyles.mVertical != NS_STYLE_OVERFLOW_SCROLL &&
|
aState->mStyles.mVertical != NS_STYLE_OVERFLOW_SCROLL &&
|
||||||
aState->mStyles.mHorizontal != NS_STYLE_OVERFLOW_SCROLL) {
|
aState->mStyles.mHorizontal != NS_STYLE_OVERFLOW_SCROLL) {
|
||||||
nsSize insideBorderSize =
|
nsSize insideBorderSize =
|
||||||
ComputeInsideBorderSize(aState,
|
ComputeInsideBorderSize(aState, nsSize(kidDesiredSize.width, kidDesiredSize.height),
|
||||||
nsSize(kidDesiredSize.width, kidDesiredSize.height));
|
kidPadding);
|
||||||
if (kidDesiredSize.mOverflowArea.XMost() <= insideBorderSize.width &&
|
if (kidDesiredSize.mOverflowArea.XMost() <= insideBorderSize.width &&
|
||||||
kidDesiredSize.mOverflowArea.YMost() <= insideBorderSize.height) {
|
kidDesiredSize.mOverflowArea.YMost() <= insideBorderSize.height) {
|
||||||
// Let's pretend we had no vertical scrollbar coming in here
|
// Let's pretend we had no vertical scrollbar coming in here
|
||||||
currentlyUsingVScrollbar = PR_FALSE;
|
currentlyUsingVScrollbar = PR_FALSE;
|
||||||
rv = ReflowScrolledFrame(*aState, currentlyUsingVScrollbar,
|
rv = ReflowScrolledFrame(*aState, currentlyUsingVScrollbar,
|
||||||
&kidDesiredSize, PR_FALSE);
|
&kidDesiredSize, &kidPadding, PR_FALSE);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
didUseScrollbar = PR_FALSE;
|
didUseScrollbar = PR_FALSE;
|
||||||
@@ -579,9 +549,9 @@ nsHTMLScrollFrame::ReflowContents(ScrollReflowState* aState,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// First try a layout without a horizontal scrollbar, then with.
|
// First try a layout without a horizontal scrollbar, then with.
|
||||||
if (TryLayout(aState, kidDesiredSize, didUseScrollbar, PR_FALSE, PR_FALSE))
|
if (TryLayout(aState, kidDesiredSize, kidPadding, didUseScrollbar, PR_FALSE, PR_FALSE))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
if (TryLayout(aState, kidDesiredSize, didUseScrollbar, PR_TRUE, PR_FALSE))
|
if (TryLayout(aState, kidDesiredSize, kidPadding, didUseScrollbar, PR_TRUE, PR_FALSE))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// That didn't work. Try the other setting for the vertical scrollbar.
|
// That didn't work. Try the other setting for the vertical scrollbar.
|
||||||
@@ -589,13 +559,13 @@ nsHTMLScrollFrame::ReflowContents(ScrollReflowState* aState,
|
|||||||
if (currentlyUsingVScrollbar || canHaveVerticalScrollbar) {
|
if (currentlyUsingVScrollbar || canHaveVerticalScrollbar) {
|
||||||
nsHTMLReflowMetrics kidRetrySize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags);
|
nsHTMLReflowMetrics kidRetrySize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags);
|
||||||
rv = ReflowScrolledFrame(*aState, !currentlyUsingVScrollbar,
|
rv = ReflowScrolledFrame(*aState, !currentlyUsingVScrollbar,
|
||||||
&kidRetrySize, PR_FALSE);
|
&kidRetrySize, &kidPadding, PR_FALSE);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
didUseScrollbar = !currentlyUsingVScrollbar;
|
didUseScrollbar = !currentlyUsingVScrollbar;
|
||||||
if (TryLayout(aState, kidRetrySize, didUseScrollbar, PR_FALSE, PR_FALSE))
|
if (TryLayout(aState, kidRetrySize, kidPadding, didUseScrollbar, PR_FALSE, PR_FALSE))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
if (TryLayout(aState, kidRetrySize, didUseScrollbar, PR_TRUE, PR_FALSE))
|
if (TryLayout(aState, kidRetrySize, kidPadding, didUseScrollbar, PR_TRUE, PR_FALSE))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
NS_WARNING("Strange content ... we can't find logically consistent scrollbar settings");
|
NS_WARNING("Strange content ... we can't find logically consistent scrollbar settings");
|
||||||
@@ -606,11 +576,11 @@ nsHTMLScrollFrame::ReflowContents(ScrollReflowState* aState,
|
|||||||
// Fall back to no scrollbars --- even if NS_STYLE_OVERFLOW_SCROLL is
|
// Fall back to no scrollbars --- even if NS_STYLE_OVERFLOW_SCROLL is
|
||||||
// in effect. They might not fit anyway.
|
// in effect. They might not fit anyway.
|
||||||
if (didUseScrollbar) {
|
if (didUseScrollbar) {
|
||||||
rv = ReflowScrolledFrame(*aState, PR_FALSE, &kidDesiredSize, PR_FALSE);
|
rv = ReflowScrolledFrame(*aState, PR_FALSE, &kidDesiredSize, &kidPadding, PR_FALSE);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
TryLayout(aState, kidDesiredSize, PR_FALSE, PR_FALSE, PR_TRUE);
|
TryLayout(aState, kidDesiredSize, kidPadding, PR_FALSE, PR_FALSE, PR_TRUE);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,8 +693,7 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
|
|
||||||
nsRect oldScrollAreaBounds = mInner.mScrollableView->View()->GetBounds();
|
nsRect oldScrollAreaBounds = mInner.mScrollableView->View()->GetBounds();
|
||||||
nsRect oldScrolledAreaBounds = mInner.mScrolledFrame->GetView()->GetBounds();
|
nsRect oldScrolledAreaBounds = mInner.mScrolledFrame->GetView()->GetBounds();
|
||||||
state.mComputedBorder = aReflowState.mComputedBorderPadding -
|
const nsMargin& borderPadding = aReflowState.mComputedBorderPadding;
|
||||||
aReflowState.mComputedPadding;
|
|
||||||
|
|
||||||
nsresult rv = ReflowContents(&state, aDesiredSize);
|
nsresult rv = ReflowContents(&state, aDesiredSize);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
@@ -743,8 +712,9 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
// is deleted, because the XMost of the frame's overflow area is always
|
// is deleted, because the XMost of the frame's overflow area is always
|
||||||
// at least the right edge. But it looks like it has always worked this way.
|
// at least the right edge. But it looks like it has always worked this way.
|
||||||
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags);
|
nsHTMLReflowMetrics kidDesiredSize(aDesiredSize.mComputeMEW, aDesiredSize.mFlags);
|
||||||
|
nsMargin kidPadding;
|
||||||
rv = ReflowScrolledFrame(state, state.mShowVScrollbar,
|
rv = ReflowScrolledFrame(state, state.mShowVScrollbar,
|
||||||
&kidDesiredSize, PR_FALSE);
|
&kidDesiredSize, &kidPadding, PR_FALSE);
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@@ -772,26 +742,25 @@ nsHTMLScrollFrame::Reflow(nsPresContext* aPresContext,
|
|||||||
mInner.SetScrollbarVisibility(mInner.mVScrollbarBox, state.mShowVScrollbar);
|
mInner.SetScrollbarVisibility(mInner.mVScrollbarBox, state.mShowVScrollbar);
|
||||||
// place and reflow scrollbars
|
// place and reflow scrollbars
|
||||||
nsRect insideBorderArea =
|
nsRect insideBorderArea =
|
||||||
nsRect(nsPoint(state.mComputedBorder.left, state.mComputedBorder.top),
|
nsRect(nsPoint(borderPadding.left, borderPadding.top), state.mInsideBorderSize);
|
||||||
state.mInsideBorderSize);
|
|
||||||
mInner.LayoutScrollbars(state.mBoxState, insideBorderArea,
|
mInner.LayoutScrollbars(state.mBoxState, insideBorderArea,
|
||||||
oldScrollAreaBounds, state.mScrollPortRect);
|
oldScrollAreaBounds, state.mScrollPortRect);
|
||||||
}
|
}
|
||||||
ScrollToRestoredPosition();
|
ScrollToRestoredPosition();
|
||||||
|
|
||||||
aDesiredSize.width = state.mInsideBorderSize.width +
|
aDesiredSize.width = state.mInsideBorderSize.width +
|
||||||
state.mComputedBorder.LeftRight();
|
borderPadding.left + borderPadding.right;
|
||||||
aDesiredSize.height = state.mInsideBorderSize.height +
|
aDesiredSize.height = state.mInsideBorderSize.height +
|
||||||
state.mComputedBorder.TopBottom();
|
borderPadding.top + borderPadding.bottom;
|
||||||
aDesiredSize.ascent = state.mAscent + state.mComputedBorder.top;
|
aDesiredSize.ascent = state.mAscent + borderPadding.top;
|
||||||
if (aDesiredSize.mComputeMEW) {
|
if (aDesiredSize.mComputeMEW) {
|
||||||
aDesiredSize.mMaxElementWidth = state.mMaxElementWidth +
|
aDesiredSize.mMaxElementWidth = state.mMaxElementWidth +
|
||||||
state.mComputedBorder.LeftRight();
|
borderPadding.left + borderPadding.right;
|
||||||
}
|
}
|
||||||
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
if (aDesiredSize.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
|
||||||
aDesiredSize.mMaximumWidth = state.mMaximumWidth;
|
aDesiredSize.mMaximumWidth = state.mMaximumWidth;
|
||||||
if (aDesiredSize.mMaximumWidth != NS_UNCONSTRAINEDSIZE) {
|
if (aDesiredSize.mMaximumWidth != NS_UNCONSTRAINEDSIZE) {
|
||||||
aDesiredSize.mMaximumWidth += state.mComputedBorder.LeftRight();
|
aDesiredSize.mMaximumWidth += borderPadding.left + borderPadding.right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -183,11 +183,13 @@ public:
|
|||||||
|
|
||||||
PRBool TryLayout(ScrollReflowState* aState,
|
PRBool TryLayout(ScrollReflowState* aState,
|
||||||
const nsHTMLReflowMetrics& aKidMetrics,
|
const nsHTMLReflowMetrics& aKidMetrics,
|
||||||
|
const nsMargin& aKidPadding,
|
||||||
PRBool aAssumeVScroll, PRBool aAssumeHScroll,
|
PRBool aAssumeVScroll, PRBool aAssumeHScroll,
|
||||||
PRBool aForce);
|
PRBool aForce);
|
||||||
nsresult ReflowScrolledFrame(const ScrollReflowState& aState,
|
nsresult ReflowScrolledFrame(const ScrollReflowState& aState,
|
||||||
PRBool aAssumeVScroll,
|
PRBool aAssumeVScroll,
|
||||||
nsHTMLReflowMetrics* aMetrics,
|
nsHTMLReflowMetrics* aMetrics,
|
||||||
|
nsMargin* aKidPadding,
|
||||||
PRBool aFirstPass);
|
PRBool aFirstPass);
|
||||||
nsresult ReflowContents(ScrollReflowState* aState,
|
nsresult ReflowContents(ScrollReflowState* aState,
|
||||||
const nsHTMLReflowMetrics& aDesiredSize);
|
const nsHTMLReflowMetrics& aDesiredSize);
|
||||||
|
|||||||
@@ -379,64 +379,6 @@ nsHTMLReflowState::GetContainingBlockContentWidth(const nsHTMLReflowState* aRefl
|
|||||||
return rs->mComputedWidth;
|
return rs->mComputedWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
nscoord
|
|
||||||
nsHTMLReflowState::AdjustIntrinsicMinContentWidthForStyle(nscoord aWidth) const
|
|
||||||
{
|
|
||||||
nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit();
|
|
||||||
if (eStyleUnit_Percent == widthUnit) {
|
|
||||||
aWidth = 0;
|
|
||||||
} else if (eStyleUnit_Coord == widthUnit) {
|
|
||||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != mComputedWidth,
|
|
||||||
"Should be a computed width here");
|
|
||||||
aWidth = mComputedWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsStyleUnit maxWidthUnit = mStylePosition->mMaxWidth.GetUnit();
|
|
||||||
if (eStyleUnit_Percent == maxWidthUnit) {
|
|
||||||
aWidth = 0;
|
|
||||||
} else if (eStyleUnit_Coord == maxWidthUnit) {
|
|
||||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != mComputedMaxWidth,
|
|
||||||
"Should be a computed max-width here");
|
|
||||||
aWidth = PR_MIN(aWidth, mComputedMaxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsStyleUnit minWidthUnit = mStylePosition->mMinWidth.GetUnit();
|
|
||||||
if (eStyleUnit_Coord == minWidthUnit) {
|
|
||||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != mComputedMinWidth,
|
|
||||||
"Should be a computed max-width here");
|
|
||||||
aWidth = PR_MAX(aWidth, mComputedMinWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
return aWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
nscoord
|
|
||||||
nsHTMLReflowState::AdjustIntrinsicContentWidthForStyle(nscoord aWidth) const
|
|
||||||
{
|
|
||||||
nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit();
|
|
||||||
if (eStyleUnit_Coord == widthUnit) {
|
|
||||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != mComputedWidth,
|
|
||||||
"Should be a computed width here");
|
|
||||||
aWidth = mComputedWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsStyleUnit maxWidthUnit = mStylePosition->mMaxWidth.GetUnit();
|
|
||||||
if (eStyleUnit_Coord == maxWidthUnit) {
|
|
||||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != mComputedMaxWidth,
|
|
||||||
"Should be a computed max-width here");
|
|
||||||
aWidth = PR_MIN(aWidth, mComputedMaxWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsStyleUnit minWidthUnit = mStylePosition->mMinWidth.GetUnit();
|
|
||||||
if (eStyleUnit_Coord == minWidthUnit) {
|
|
||||||
NS_ASSERTION(NS_UNCONSTRAINEDSIZE != mComputedMinWidth,
|
|
||||||
"Should be a computed max-width here");
|
|
||||||
aWidth = PR_MAX(aWidth, mComputedMinWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
return aWidth;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
nsIFrame*
|
nsIFrame*
|
||||||
nsHTMLReflowState::GetContainingBlockFor(const nsIFrame* aFrame)
|
nsHTMLReflowState::GetContainingBlockFor(const nsIFrame* aFrame)
|
||||||
@@ -1766,8 +1708,12 @@ nsHTMLReflowState::InitConstraints(nsPresContext* aPresContext,
|
|||||||
mComputedPadding.left = aPadding->left;
|
mComputedPadding.left = aPadding->left;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (frame->GetType() == nsLayoutAtoms::scrollFrame) {
|
||||||
|
mComputedPadding.SizeTo(0, 0, 0, 0);
|
||||||
|
} else {
|
||||||
ComputePadding(aContainingBlockWidth, cbrs);
|
ComputePadding(aContainingBlockWidth, cbrs);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (aBorder) { // border is an input arg
|
if (aBorder) { // border is an input arg
|
||||||
mComputedBorderPadding = *aBorder;
|
mComputedBorderPadding = *aBorder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user