зеркало из https://github.com/mozilla/pjs.git
Changed width/height constraints in nsHTMLReflowState struct
This commit is contained in:
Родитель
d46a4026ee
Коммит
781a43ae69
|
@ -276,7 +276,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
|||
legendMargin.left + legendMargin.right;
|
||||
nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
availSize.width = aReflowState.minWidth;
|
||||
availSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
if (NS_UNCONSTRAINEDSIZE != availSize.width)
|
||||
|
@ -356,8 +356,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
|||
nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right;
|
||||
|
||||
aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.computedWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
|
||||
// Place the legend
|
||||
|
@ -419,8 +419,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom;
|
||||
if (mInline) // XXX parents don't yet ......
|
||||
aDesiredSize.height += margin.bottom;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.computedHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
|
|
@ -680,13 +680,13 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext,
|
|||
nsSize& aSize)
|
||||
{
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
aSize.width = aReflowState.minWidth;
|
||||
aSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
aSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
aSize.height = aReflowState.minHeight;
|
||||
aSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
aSize.height = CSS_NOTSET;
|
||||
|
|
|
@ -627,11 +627,11 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
// if we are constrained and the child is smaller, use the constrained values
|
||||
if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.minWidth)) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.computedWidth)) {
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.computedHeight)) {
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
|
|
|
@ -142,13 +142,13 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext,
|
|||
|
||||
// add in our border and padding to the size of the child
|
||||
aDesiredSize.width += borderPadding.left + borderPadding.right;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.computedWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
|
||||
aDesiredSize.height += borderPadding.top + borderPadding.bottom;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.computedHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
|
||||
// adjust our max element size, if necessary
|
||||
|
|
|
@ -329,12 +329,13 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
|
||||
nscoord lr = mBorderPadding.left + mBorderPadding.right;
|
||||
mY = mBorderPadding.top;
|
||||
if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
|
||||
|
||||
if (HaveFixedContentWidth()) {
|
||||
// The CSS2 spec says that the width attribute defines the width
|
||||
// of the "content area" which does not include the border
|
||||
// padding. So we add those back in.
|
||||
mBorderArea.width = minWidth + lr;
|
||||
mContentArea.width = minWidth;
|
||||
mBorderArea.width = computedWidth + lr;
|
||||
mContentArea.width = computedWidth;
|
||||
}
|
||||
else {
|
||||
if (mUnconstrainedWidth) {
|
||||
|
@ -346,6 +347,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
mContentArea.width = maxSize.width - lr;
|
||||
}
|
||||
}
|
||||
|
||||
mBorderArea.height = maxSize.height;
|
||||
mContentArea.height = maxSize.height;
|
||||
mBottomEdge = maxSize.height;
|
||||
|
@ -692,10 +694,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
nsHTMLReflowMetrics& aMetrics)
|
||||
{
|
||||
// XXX handle floater problems this way...
|
||||
PRBool isFixedWidth =
|
||||
eHTMLFrameConstraint_FixedContent == aState.widthConstraint;
|
||||
PRBool isFixedHeight =
|
||||
eHTMLFrameConstraint_FixedContent == aState.heightConstraint;
|
||||
PRBool isFixedWidth = aState.HaveFixedContentWidth();
|
||||
PRBool isFixedHeight = NS_AUTOHEIGHT != aState.computedHeight;
|
||||
|
||||
#if 0
|
||||
if (NS_BODY_SHRINK_WRAP & mFlags) {
|
||||
|
@ -707,8 +707,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final width
|
||||
if (isFixedWidth) {
|
||||
// Use style defined width
|
||||
aMetrics.width = aState.mBorderPadding.left +
|
||||
aState.minWidth + aState.mBorderPadding.right;
|
||||
aMetrics.width = aState.mBorderPadding.left + aState.computedWidth +
|
||||
aState.mBorderPadding.right;
|
||||
}
|
||||
else {
|
||||
nscoord computedWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
|
@ -745,8 +745,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final height
|
||||
if (isFixedHeight) {
|
||||
// Use style defined height
|
||||
aMetrics.height = aState.mBorderPadding.top +
|
||||
aState.minHeight + aState.mBorderPadding.bottom;
|
||||
aMetrics.height = aState.mBorderPadding.top + aState.computedHeight +
|
||||
aState.mBorderPadding.bottom;
|
||||
}
|
||||
else {
|
||||
// Shrink wrap our height around our contents.
|
||||
|
@ -773,8 +773,12 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Special check for zero sized content: If our content is zero
|
||||
// sized then we collapse into nothingness.
|
||||
PRBool emptyFrame = PR_FALSE;
|
||||
if ((eHTMLFrameConstraint_Unconstrained == aState.widthConstraint) &&
|
||||
(eHTMLFrameConstraint_Unconstrained == aState.heightConstraint) &&
|
||||
// We need to check the specified width and see if it's 'auto'
|
||||
const nsStylePosition* position;
|
||||
aState.frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) position);
|
||||
PRIntn specifiedWidthUnit = position->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Auto == specifiedWidthUnit) &&
|
||||
(NS_AUTOHEIGHT == aState.computedHeight) &&
|
||||
((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
|
||||
(0 == aState.mY - aState.mBorderPadding.top))) {
|
||||
aMetrics.width = 0;
|
||||
|
@ -3473,7 +3477,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
if (aFloaterReflowState.HaveFixedContentWidth()) {
|
||||
// When the floater has a contrained width, give it just enough
|
||||
// space for its styled width plus its borders and paddings.
|
||||
kidAvailSize.width = aFloaterReflowState.minWidth + bp.left + bp.right;
|
||||
kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right;
|
||||
}
|
||||
else {
|
||||
// CSS2 section 10.3.5: Floating non-replaced elements with an
|
||||
|
@ -3493,7 +3497,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
|
||||
// Compute the available height for the floater
|
||||
if (aFloaterReflowState.HaveFixedContentHeight()) {
|
||||
kidAvailSize.height = aFloaterReflowState.minHeight + bp.top + bp.bottom;
|
||||
kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom;
|
||||
}
|
||||
else {
|
||||
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
|
|
|
@ -329,12 +329,13 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
|
||||
nscoord lr = mBorderPadding.left + mBorderPadding.right;
|
||||
mY = mBorderPadding.top;
|
||||
if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
|
||||
|
||||
if (HaveFixedContentWidth()) {
|
||||
// The CSS2 spec says that the width attribute defines the width
|
||||
// of the "content area" which does not include the border
|
||||
// padding. So we add those back in.
|
||||
mBorderArea.width = minWidth + lr;
|
||||
mContentArea.width = minWidth;
|
||||
mBorderArea.width = computedWidth + lr;
|
||||
mContentArea.width = computedWidth;
|
||||
}
|
||||
else {
|
||||
if (mUnconstrainedWidth) {
|
||||
|
@ -346,6 +347,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
mContentArea.width = maxSize.width - lr;
|
||||
}
|
||||
}
|
||||
|
||||
mBorderArea.height = maxSize.height;
|
||||
mContentArea.height = maxSize.height;
|
||||
mBottomEdge = maxSize.height;
|
||||
|
@ -692,10 +694,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
nsHTMLReflowMetrics& aMetrics)
|
||||
{
|
||||
// XXX handle floater problems this way...
|
||||
PRBool isFixedWidth =
|
||||
eHTMLFrameConstraint_FixedContent == aState.widthConstraint;
|
||||
PRBool isFixedHeight =
|
||||
eHTMLFrameConstraint_FixedContent == aState.heightConstraint;
|
||||
PRBool isFixedWidth = aState.HaveFixedContentWidth();
|
||||
PRBool isFixedHeight = NS_AUTOHEIGHT != aState.computedHeight;
|
||||
|
||||
#if 0
|
||||
if (NS_BODY_SHRINK_WRAP & mFlags) {
|
||||
|
@ -707,8 +707,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final width
|
||||
if (isFixedWidth) {
|
||||
// Use style defined width
|
||||
aMetrics.width = aState.mBorderPadding.left +
|
||||
aState.minWidth + aState.mBorderPadding.right;
|
||||
aMetrics.width = aState.mBorderPadding.left + aState.computedWidth +
|
||||
aState.mBorderPadding.right;
|
||||
}
|
||||
else {
|
||||
nscoord computedWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
|
@ -745,8 +745,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final height
|
||||
if (isFixedHeight) {
|
||||
// Use style defined height
|
||||
aMetrics.height = aState.mBorderPadding.top +
|
||||
aState.minHeight + aState.mBorderPadding.bottom;
|
||||
aMetrics.height = aState.mBorderPadding.top + aState.computedHeight +
|
||||
aState.mBorderPadding.bottom;
|
||||
}
|
||||
else {
|
||||
// Shrink wrap our height around our contents.
|
||||
|
@ -773,8 +773,12 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Special check for zero sized content: If our content is zero
|
||||
// sized then we collapse into nothingness.
|
||||
PRBool emptyFrame = PR_FALSE;
|
||||
if ((eHTMLFrameConstraint_Unconstrained == aState.widthConstraint) &&
|
||||
(eHTMLFrameConstraint_Unconstrained == aState.heightConstraint) &&
|
||||
// We need to check the specified width and see if it's 'auto'
|
||||
const nsStylePosition* position;
|
||||
aState.frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) position);
|
||||
PRIntn specifiedWidthUnit = position->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Auto == specifiedWidthUnit) &&
|
||||
(NS_AUTOHEIGHT == aState.computedHeight) &&
|
||||
((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
|
||||
(0 == aState.mY - aState.mBorderPadding.top))) {
|
||||
aMetrics.width = 0;
|
||||
|
@ -3473,7 +3477,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
if (aFloaterReflowState.HaveFixedContentWidth()) {
|
||||
// When the floater has a contrained width, give it just enough
|
||||
// space for its styled width plus its borders and paddings.
|
||||
kidAvailSize.width = aFloaterReflowState.minWidth + bp.left + bp.right;
|
||||
kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right;
|
||||
}
|
||||
else {
|
||||
// CSS2 section 10.3.5: Floating non-replaced elements with an
|
||||
|
@ -3493,7 +3497,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
|
||||
// Compute the available height for the floater
|
||||
if (aFloaterReflowState.HaveFixedContentHeight()) {
|
||||
kidAvailSize.height = aFloaterReflowState.minHeight + bp.top + bp.bottom;
|
||||
kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom;
|
||||
}
|
||||
else {
|
||||
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
|
|
|
@ -329,12 +329,13 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
|
||||
nscoord lr = mBorderPadding.left + mBorderPadding.right;
|
||||
mY = mBorderPadding.top;
|
||||
if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
|
||||
|
||||
if (HaveFixedContentWidth()) {
|
||||
// The CSS2 spec says that the width attribute defines the width
|
||||
// of the "content area" which does not include the border
|
||||
// padding. So we add those back in.
|
||||
mBorderArea.width = minWidth + lr;
|
||||
mContentArea.width = minWidth;
|
||||
mBorderArea.width = computedWidth + lr;
|
||||
mContentArea.width = computedWidth;
|
||||
}
|
||||
else {
|
||||
if (mUnconstrainedWidth) {
|
||||
|
@ -346,6 +347,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
mContentArea.width = maxSize.width - lr;
|
||||
}
|
||||
}
|
||||
|
||||
mBorderArea.height = maxSize.height;
|
||||
mContentArea.height = maxSize.height;
|
||||
mBottomEdge = maxSize.height;
|
||||
|
@ -692,10 +694,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
nsHTMLReflowMetrics& aMetrics)
|
||||
{
|
||||
// XXX handle floater problems this way...
|
||||
PRBool isFixedWidth =
|
||||
eHTMLFrameConstraint_FixedContent == aState.widthConstraint;
|
||||
PRBool isFixedHeight =
|
||||
eHTMLFrameConstraint_FixedContent == aState.heightConstraint;
|
||||
PRBool isFixedWidth = aState.HaveFixedContentWidth();
|
||||
PRBool isFixedHeight = NS_AUTOHEIGHT != aState.computedHeight;
|
||||
|
||||
#if 0
|
||||
if (NS_BODY_SHRINK_WRAP & mFlags) {
|
||||
|
@ -707,8 +707,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final width
|
||||
if (isFixedWidth) {
|
||||
// Use style defined width
|
||||
aMetrics.width = aState.mBorderPadding.left +
|
||||
aState.minWidth + aState.mBorderPadding.right;
|
||||
aMetrics.width = aState.mBorderPadding.left + aState.computedWidth +
|
||||
aState.mBorderPadding.right;
|
||||
}
|
||||
else {
|
||||
nscoord computedWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
|
@ -745,8 +745,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final height
|
||||
if (isFixedHeight) {
|
||||
// Use style defined height
|
||||
aMetrics.height = aState.mBorderPadding.top +
|
||||
aState.minHeight + aState.mBorderPadding.bottom;
|
||||
aMetrics.height = aState.mBorderPadding.top + aState.computedHeight +
|
||||
aState.mBorderPadding.bottom;
|
||||
}
|
||||
else {
|
||||
// Shrink wrap our height around our contents.
|
||||
|
@ -773,8 +773,12 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Special check for zero sized content: If our content is zero
|
||||
// sized then we collapse into nothingness.
|
||||
PRBool emptyFrame = PR_FALSE;
|
||||
if ((eHTMLFrameConstraint_Unconstrained == aState.widthConstraint) &&
|
||||
(eHTMLFrameConstraint_Unconstrained == aState.heightConstraint) &&
|
||||
// We need to check the specified width and see if it's 'auto'
|
||||
const nsStylePosition* position;
|
||||
aState.frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) position);
|
||||
PRIntn specifiedWidthUnit = position->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Auto == specifiedWidthUnit) &&
|
||||
(NS_AUTOHEIGHT == aState.computedHeight) &&
|
||||
((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
|
||||
(0 == aState.mY - aState.mBorderPadding.top))) {
|
||||
aMetrics.width = 0;
|
||||
|
@ -3473,7 +3477,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
if (aFloaterReflowState.HaveFixedContentWidth()) {
|
||||
// When the floater has a contrained width, give it just enough
|
||||
// space for its styled width plus its borders and paddings.
|
||||
kidAvailSize.width = aFloaterReflowState.minWidth + bp.left + bp.right;
|
||||
kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right;
|
||||
}
|
||||
else {
|
||||
// CSS2 section 10.3.5: Floating non-replaced elements with an
|
||||
|
@ -3493,7 +3497,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
|
||||
// Compute the available height for the floater
|
||||
if (aFloaterReflowState.HaveFixedContentHeight()) {
|
||||
kidAvailSize.height = aFloaterReflowState.minHeight + bp.top + bp.bottom;
|
||||
kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom;
|
||||
}
|
||||
else {
|
||||
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
|
|
|
@ -244,13 +244,13 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
|
||||
// XXX this needs to be changed from (200,200) to a better default for inline frames
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.width = NSIntPixelsToTwips(200, p2t);
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.height = NSIntPixelsToTwips(200, p2t);
|
||||
|
|
|
@ -185,15 +185,15 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||
kidReflowState.reflowCommand = nsnull;
|
||||
}
|
||||
|
||||
// For a width or height that's 'auto', make the frame as big as the
|
||||
// available space
|
||||
if (eHTMLFrameConstraint_FixedContent != kidReflowState.widthConstraint) {
|
||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Fixed;
|
||||
kidReflowState.minWidth = kidMaxSize.width;
|
||||
}
|
||||
if (eHTMLFrameConstraint_FixedContent != kidReflowState.heightConstraint) {
|
||||
kidReflowState.heightConstraint = eHTMLFrameConstraint_Fixed;
|
||||
kidReflowState.minHeight = kidMaxSize.height;
|
||||
// For a height that's 'auto', make the frame as big as the available space
|
||||
if (!kidReflowState.HaveFixedContentHeight()) {
|
||||
kidReflowState.computedHeight = kidMaxSize.height;
|
||||
|
||||
// Computed height is for the content area so reduce it by the amount of
|
||||
// space taken up by border and padding
|
||||
nsMargin borderPadding;
|
||||
kidReflowState.ComputeBorderPaddingFor(mFirstChild, &aReflowState, borderPadding);
|
||||
kidReflowState.computedHeight -= borderPadding.top + borderPadding.bottom;
|
||||
}
|
||||
|
||||
// Reflow the frame
|
||||
|
@ -201,16 +201,6 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
||||
ReflowChild(mFirstChild, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||
|
||||
// Place and size the child. Because we told the child it was
|
||||
// fixed make sure it's at least as big as we told it. This
|
||||
// handles the case where the child ignores the reflow state
|
||||
// constraints
|
||||
if (desiredSize.width < kidReflowState.minWidth) {
|
||||
desiredSize.width = kidReflowState.minWidth;
|
||||
}
|
||||
if (desiredSize.height < kidReflowState.minHeight) {
|
||||
desiredSize.height = kidReflowState.minHeight;
|
||||
}
|
||||
nsRect rect(childMargin.left, childMargin.top, desiredSize.width, desiredSize.height);
|
||||
mFirstChild->SetRect(rect);
|
||||
|
||||
|
|
|
@ -232,8 +232,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
if (aReflowState.HaveFixedContentWidth() &&
|
||||
aReflowState.HaveFixedContentHeight()) {
|
||||
// The image is fully constrained. Use the constraints directly.
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
// The image is partially constrained. Preserve aspect ratio of
|
||||
|
@ -256,16 +256,16 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
// We have a width, and an auto height. Compute height
|
||||
// from width.
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
aDesiredSize.height = (nscoord)
|
||||
NSToIntRound(aReflowState.minWidth * imageHeight / imageWidth);
|
||||
NSToIntRound(aReflowState.computedWidth * imageHeight / imageWidth);
|
||||
}
|
||||
else {
|
||||
// We have a height and an auto width. Compute width from
|
||||
// height.
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
aDesiredSize.width = (nscoord)
|
||||
NSToIntRound(aReflowState.minHeight * imageWidth / imageHeight);
|
||||
NSToIntRound(aReflowState.computedHeight * imageWidth / imageHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -306,11 +306,11 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
aMetrics.width = aReflowState.minWidth;
|
||||
aMetrics.width = aReflowState.computedWidth;
|
||||
haveWidth = PR_TRUE;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
aMetrics.height = aReflowState.minHeight;
|
||||
aMetrics.height = aReflowState.computedHeight;
|
||||
haveHeight = PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -329,12 +329,13 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
|
||||
nscoord lr = mBorderPadding.left + mBorderPadding.right;
|
||||
mY = mBorderPadding.top;
|
||||
if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
|
||||
|
||||
if (HaveFixedContentWidth()) {
|
||||
// The CSS2 spec says that the width attribute defines the width
|
||||
// of the "content area" which does not include the border
|
||||
// padding. So we add those back in.
|
||||
mBorderArea.width = minWidth + lr;
|
||||
mContentArea.width = minWidth;
|
||||
mBorderArea.width = computedWidth + lr;
|
||||
mContentArea.width = computedWidth;
|
||||
}
|
||||
else {
|
||||
if (mUnconstrainedWidth) {
|
||||
|
@ -346,6 +347,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
mContentArea.width = maxSize.width - lr;
|
||||
}
|
||||
}
|
||||
|
||||
mBorderArea.height = maxSize.height;
|
||||
mContentArea.height = maxSize.height;
|
||||
mBottomEdge = maxSize.height;
|
||||
|
@ -692,10 +694,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
nsHTMLReflowMetrics& aMetrics)
|
||||
{
|
||||
// XXX handle floater problems this way...
|
||||
PRBool isFixedWidth =
|
||||
eHTMLFrameConstraint_FixedContent == aState.widthConstraint;
|
||||
PRBool isFixedHeight =
|
||||
eHTMLFrameConstraint_FixedContent == aState.heightConstraint;
|
||||
PRBool isFixedWidth = aState.HaveFixedContentWidth();
|
||||
PRBool isFixedHeight = NS_AUTOHEIGHT != aState.computedHeight;
|
||||
|
||||
#if 0
|
||||
if (NS_BODY_SHRINK_WRAP & mFlags) {
|
||||
|
@ -707,8 +707,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final width
|
||||
if (isFixedWidth) {
|
||||
// Use style defined width
|
||||
aMetrics.width = aState.mBorderPadding.left +
|
||||
aState.minWidth + aState.mBorderPadding.right;
|
||||
aMetrics.width = aState.mBorderPadding.left + aState.computedWidth +
|
||||
aState.mBorderPadding.right;
|
||||
}
|
||||
else {
|
||||
nscoord computedWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
|
@ -745,8 +745,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final height
|
||||
if (isFixedHeight) {
|
||||
// Use style defined height
|
||||
aMetrics.height = aState.mBorderPadding.top +
|
||||
aState.minHeight + aState.mBorderPadding.bottom;
|
||||
aMetrics.height = aState.mBorderPadding.top + aState.computedHeight +
|
||||
aState.mBorderPadding.bottom;
|
||||
}
|
||||
else {
|
||||
// Shrink wrap our height around our contents.
|
||||
|
@ -773,8 +773,12 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Special check for zero sized content: If our content is zero
|
||||
// sized then we collapse into nothingness.
|
||||
PRBool emptyFrame = PR_FALSE;
|
||||
if ((eHTMLFrameConstraint_Unconstrained == aState.widthConstraint) &&
|
||||
(eHTMLFrameConstraint_Unconstrained == aState.heightConstraint) &&
|
||||
// We need to check the specified width and see if it's 'auto'
|
||||
const nsStylePosition* position;
|
||||
aState.frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) position);
|
||||
PRIntn specifiedWidthUnit = position->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Auto == specifiedWidthUnit) &&
|
||||
(NS_AUTOHEIGHT == aState.computedHeight) &&
|
||||
((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
|
||||
(0 == aState.mY - aState.mBorderPadding.top))) {
|
||||
aMetrics.width = 0;
|
||||
|
@ -3473,7 +3477,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
if (aFloaterReflowState.HaveFixedContentWidth()) {
|
||||
// When the floater has a contrained width, give it just enough
|
||||
// space for its styled width plus its borders and paddings.
|
||||
kidAvailSize.width = aFloaterReflowState.minWidth + bp.left + bp.right;
|
||||
kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right;
|
||||
}
|
||||
else {
|
||||
// CSS2 section 10.3.5: Floating non-replaced elements with an
|
||||
|
@ -3493,7 +3497,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
|
||||
// Compute the available height for the floater
|
||||
if (aFloaterReflowState.HaveFixedContentHeight()) {
|
||||
kidAvailSize.height = aFloaterReflowState.minHeight + bp.top + bp.bottom;
|
||||
kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom;
|
||||
}
|
||||
else {
|
||||
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
|
|
|
@ -329,12 +329,13 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
|
||||
nscoord lr = mBorderPadding.left + mBorderPadding.right;
|
||||
mY = mBorderPadding.top;
|
||||
if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
|
||||
|
||||
if (HaveFixedContentWidth()) {
|
||||
// The CSS2 spec says that the width attribute defines the width
|
||||
// of the "content area" which does not include the border
|
||||
// padding. So we add those back in.
|
||||
mBorderArea.width = minWidth + lr;
|
||||
mContentArea.width = minWidth;
|
||||
mBorderArea.width = computedWidth + lr;
|
||||
mContentArea.width = computedWidth;
|
||||
}
|
||||
else {
|
||||
if (mUnconstrainedWidth) {
|
||||
|
@ -346,6 +347,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
mContentArea.width = maxSize.width - lr;
|
||||
}
|
||||
}
|
||||
|
||||
mBorderArea.height = maxSize.height;
|
||||
mContentArea.height = maxSize.height;
|
||||
mBottomEdge = maxSize.height;
|
||||
|
@ -692,10 +694,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
nsHTMLReflowMetrics& aMetrics)
|
||||
{
|
||||
// XXX handle floater problems this way...
|
||||
PRBool isFixedWidth =
|
||||
eHTMLFrameConstraint_FixedContent == aState.widthConstraint;
|
||||
PRBool isFixedHeight =
|
||||
eHTMLFrameConstraint_FixedContent == aState.heightConstraint;
|
||||
PRBool isFixedWidth = aState.HaveFixedContentWidth();
|
||||
PRBool isFixedHeight = NS_AUTOHEIGHT != aState.computedHeight;
|
||||
|
||||
#if 0
|
||||
if (NS_BODY_SHRINK_WRAP & mFlags) {
|
||||
|
@ -707,8 +707,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final width
|
||||
if (isFixedWidth) {
|
||||
// Use style defined width
|
||||
aMetrics.width = aState.mBorderPadding.left +
|
||||
aState.minWidth + aState.mBorderPadding.right;
|
||||
aMetrics.width = aState.mBorderPadding.left + aState.computedWidth +
|
||||
aState.mBorderPadding.right;
|
||||
}
|
||||
else {
|
||||
nscoord computedWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
|
@ -745,8 +745,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final height
|
||||
if (isFixedHeight) {
|
||||
// Use style defined height
|
||||
aMetrics.height = aState.mBorderPadding.top +
|
||||
aState.minHeight + aState.mBorderPadding.bottom;
|
||||
aMetrics.height = aState.mBorderPadding.top + aState.computedHeight +
|
||||
aState.mBorderPadding.bottom;
|
||||
}
|
||||
else {
|
||||
// Shrink wrap our height around our contents.
|
||||
|
@ -773,8 +773,12 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Special check for zero sized content: If our content is zero
|
||||
// sized then we collapse into nothingness.
|
||||
PRBool emptyFrame = PR_FALSE;
|
||||
if ((eHTMLFrameConstraint_Unconstrained == aState.widthConstraint) &&
|
||||
(eHTMLFrameConstraint_Unconstrained == aState.heightConstraint) &&
|
||||
// We need to check the specified width and see if it's 'auto'
|
||||
const nsStylePosition* position;
|
||||
aState.frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) position);
|
||||
PRIntn specifiedWidthUnit = position->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Auto == specifiedWidthUnit) &&
|
||||
(NS_AUTOHEIGHT == aState.computedHeight) &&
|
||||
((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
|
||||
(0 == aState.mY - aState.mBorderPadding.top))) {
|
||||
aMetrics.width = 0;
|
||||
|
@ -3473,7 +3477,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
if (aFloaterReflowState.HaveFixedContentWidth()) {
|
||||
// When the floater has a contrained width, give it just enough
|
||||
// space for its styled width plus its borders and paddings.
|
||||
kidAvailSize.width = aFloaterReflowState.minWidth + bp.left + bp.right;
|
||||
kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right;
|
||||
}
|
||||
else {
|
||||
// CSS2 section 10.3.5: Floating non-replaced elements with an
|
||||
|
@ -3493,7 +3497,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
|
||||
// Compute the available height for the floater
|
||||
if (aFloaterReflowState.HaveFixedContentHeight()) {
|
||||
kidAvailSize.height = aFloaterReflowState.minHeight + bp.top + bp.bottom;
|
||||
kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom;
|
||||
}
|
||||
else {
|
||||
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
|
|
|
@ -329,12 +329,13 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
|
||||
nscoord lr = mBorderPadding.left + mBorderPadding.right;
|
||||
mY = mBorderPadding.top;
|
||||
if (eHTMLFrameConstraint_FixedContent == widthConstraint) {
|
||||
|
||||
if (HaveFixedContentWidth()) {
|
||||
// The CSS2 spec says that the width attribute defines the width
|
||||
// of the "content area" which does not include the border
|
||||
// padding. So we add those back in.
|
||||
mBorderArea.width = minWidth + lr;
|
||||
mContentArea.width = minWidth;
|
||||
mBorderArea.width = computedWidth + lr;
|
||||
mContentArea.width = computedWidth;
|
||||
}
|
||||
else {
|
||||
if (mUnconstrainedWidth) {
|
||||
|
@ -346,6 +347,7 @@ nsBlockReflowState::nsBlockReflowState(nsIPresContext& aPresContext,
|
|||
mContentArea.width = maxSize.width - lr;
|
||||
}
|
||||
}
|
||||
|
||||
mBorderArea.height = maxSize.height;
|
||||
mContentArea.height = maxSize.height;
|
||||
mBottomEdge = maxSize.height;
|
||||
|
@ -692,10 +694,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
nsHTMLReflowMetrics& aMetrics)
|
||||
{
|
||||
// XXX handle floater problems this way...
|
||||
PRBool isFixedWidth =
|
||||
eHTMLFrameConstraint_FixedContent == aState.widthConstraint;
|
||||
PRBool isFixedHeight =
|
||||
eHTMLFrameConstraint_FixedContent == aState.heightConstraint;
|
||||
PRBool isFixedWidth = aState.HaveFixedContentWidth();
|
||||
PRBool isFixedHeight = NS_AUTOHEIGHT != aState.computedHeight;
|
||||
|
||||
#if 0
|
||||
if (NS_BODY_SHRINK_WRAP & mFlags) {
|
||||
|
@ -707,8 +707,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final width
|
||||
if (isFixedWidth) {
|
||||
// Use style defined width
|
||||
aMetrics.width = aState.mBorderPadding.left +
|
||||
aState.minWidth + aState.mBorderPadding.right;
|
||||
aMetrics.width = aState.mBorderPadding.left + aState.computedWidth +
|
||||
aState.mBorderPadding.right;
|
||||
}
|
||||
else {
|
||||
nscoord computedWidth = aState.mKidXMost + aState.mBorderPadding.right;
|
||||
|
@ -745,8 +745,8 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Compute final height
|
||||
if (isFixedHeight) {
|
||||
// Use style defined height
|
||||
aMetrics.height = aState.mBorderPadding.top +
|
||||
aState.minHeight + aState.mBorderPadding.bottom;
|
||||
aMetrics.height = aState.mBorderPadding.top + aState.computedHeight +
|
||||
aState.mBorderPadding.bottom;
|
||||
}
|
||||
else {
|
||||
// Shrink wrap our height around our contents.
|
||||
|
@ -773,8 +773,12 @@ nsBaseIBFrame::ComputeFinalSize(nsBlockReflowState& aState,
|
|||
// Special check for zero sized content: If our content is zero
|
||||
// sized then we collapse into nothingness.
|
||||
PRBool emptyFrame = PR_FALSE;
|
||||
if ((eHTMLFrameConstraint_Unconstrained == aState.widthConstraint) &&
|
||||
(eHTMLFrameConstraint_Unconstrained == aState.heightConstraint) &&
|
||||
// We need to check the specified width and see if it's 'auto'
|
||||
const nsStylePosition* position;
|
||||
aState.frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&) position);
|
||||
PRIntn specifiedWidthUnit = position->mWidth.GetUnit();
|
||||
if ((eStyleUnit_Auto == specifiedWidthUnit) &&
|
||||
(NS_AUTOHEIGHT == aState.computedHeight) &&
|
||||
((0 == aState.mKidXMost - aState.mBorderPadding.left) &&
|
||||
(0 == aState.mY - aState.mBorderPadding.top))) {
|
||||
aMetrics.width = 0;
|
||||
|
@ -3473,7 +3477,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
if (aFloaterReflowState.HaveFixedContentWidth()) {
|
||||
// When the floater has a contrained width, give it just enough
|
||||
// space for its styled width plus its borders and paddings.
|
||||
kidAvailSize.width = aFloaterReflowState.minWidth + bp.left + bp.right;
|
||||
kidAvailSize.width = aFloaterReflowState.computedWidth + bp.left + bp.right;
|
||||
}
|
||||
else {
|
||||
// CSS2 section 10.3.5: Floating non-replaced elements with an
|
||||
|
@ -3493,7 +3497,7 @@ nsBaseIBFrame::ReflowFloater(nsIPresContext& aPresContext,
|
|||
|
||||
// Compute the available height for the floater
|
||||
if (aFloaterReflowState.HaveFixedContentHeight()) {
|
||||
kidAvailSize.height = aFloaterReflowState.minHeight + bp.top + bp.bottom;
|
||||
kidAvailSize.height = aFloaterReflowState.computedHeight + bp.top + bp.bottom;
|
||||
}
|
||||
else {
|
||||
kidAvailSize.height = NS_UNCONSTRAINEDSIZE;
|
||||
|
|
|
@ -24,6 +24,24 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
|
||||
PRBool
|
||||
nsHTMLReflowState::HaveFixedContentWidth() const
|
||||
{
|
||||
const nsStylePosition* pos;
|
||||
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)pos);
|
||||
// What about 'inherit'?
|
||||
return eStyleUnit_Auto != pos->mWidth.GetUnit();
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsHTMLReflowState::HaveFixedContentHeight() const
|
||||
{
|
||||
const nsStylePosition* pos;
|
||||
frame->GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)pos);
|
||||
// What about 'inherit'?
|
||||
return eStyleUnit_Auto != pos->mHeight.GetUnit();
|
||||
}
|
||||
|
||||
const nsHTMLReflowState*
|
||||
nsHTMLReflowState::GetContainingBlockReflowState(const nsReflowState* aParentRS)
|
||||
{
|
||||
|
@ -54,36 +72,7 @@ nsHTMLReflowState::GetContainingBlockContentWidth(const nsReflowState* aParentRS
|
|||
const nsHTMLReflowState* rs =
|
||||
GetContainingBlockReflowState(aParentRS);
|
||||
if (nsnull != rs) {
|
||||
return ((nsHTMLReflowState*)aParentRS)->GetContentWidth();/* XXX cast */
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsHTMLReflowState::GetContentWidth() const
|
||||
{
|
||||
nscoord width = 0;
|
||||
if (HaveFixedContentWidth()) {
|
||||
width = minWidth;
|
||||
}
|
||||
else if (NS_UNCONSTRAINEDSIZE != maxSize.width) {
|
||||
width = maxSize.width;
|
||||
if (nsnull != frame) {
|
||||
// Subtract out the border and padding values because the
|
||||
// percentage is to be computed relative to the content
|
||||
// width, not the outer width.
|
||||
const nsStyleSpacing* spacing;
|
||||
nsresult rv;
|
||||
rv = frame->GetStyleData(eStyleStruct_Spacing,
|
||||
(const nsStyleStruct*&) spacing);
|
||||
if (NS_SUCCEEDED(rv) && (nsnull != spacing)) {
|
||||
nsMargin borderPadding;
|
||||
ComputeBorderPaddingFor(frame,
|
||||
parentReflowState,
|
||||
borderPadding);
|
||||
width -= borderPadding.left + borderPadding.right;
|
||||
}
|
||||
}
|
||||
return ((nsHTMLReflowState*)aParentRS)->computedWidth;/* XXX cast */
|
||||
}
|
||||
return width;
|
||||
}
|
||||
|
@ -182,16 +171,16 @@ nsHTMLReflowState::DetermineFrameType(nsIPresContext& aPresContext)
|
|||
void
|
||||
nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext)
|
||||
{
|
||||
// Determine whether the values are constrained or unconstrained
|
||||
// by looking at the maxSize
|
||||
widthConstraint = NS_UNCONSTRAINEDSIZE == maxSize.width ?
|
||||
eHTMLFrameConstraint_Unconstrained :
|
||||
eHTMLFrameConstraint_Constrained;
|
||||
heightConstraint = NS_UNCONSTRAINEDSIZE == maxSize.height ?
|
||||
eHTMLFrameConstraint_Unconstrained :
|
||||
eHTMLFrameConstraint_Constrained;
|
||||
minWidth = 0;
|
||||
minHeight = 0;
|
||||
const nsStylePosition* pos;
|
||||
nsresult result = frame->GetStyleData(eStyleStruct_Position,
|
||||
(const nsStyleStruct*&)pos);
|
||||
|
||||
// Initialize the computed values to default values
|
||||
// XXX Use specified values as defaults
|
||||
computedWidth = 0;
|
||||
computedLeftMargin = computedRightMargin = 0;
|
||||
computedHeight = 0;
|
||||
computedTopMargin = computedBottomMargin = 0;
|
||||
|
||||
mLineHeight = CalcLineHeight(aPresContext, frame);
|
||||
|
||||
|
@ -203,12 +192,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext)
|
|||
|
||||
case eCSSFrameType_Inline:
|
||||
if (mLineHeight >= 0) {
|
||||
#if 0
|
||||
minHeight = maxSize.height = mLineHeight;
|
||||
#else
|
||||
minHeight = mLineHeight;
|
||||
#endif
|
||||
heightConstraint = eHTMLFrameConstraint_FixedContent;
|
||||
computedHeight = mLineHeight;
|
||||
}
|
||||
return;
|
||||
|
||||
|
@ -217,9 +201,6 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext)
|
|||
}
|
||||
|
||||
// Look for stylistic constraints on the width/height
|
||||
const nsStylePosition* pos;
|
||||
nsresult result = frame->GetStyleData(eStyleStruct_Position,
|
||||
(const nsStyleStruct*&)pos);
|
||||
if (NS_OK == result) {
|
||||
nscoord containingBlockWidth, containingBlockHeight;
|
||||
nscoord width = -1, height = -1;
|
||||
|
@ -245,7 +226,7 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext)
|
|||
}
|
||||
else {
|
||||
if (eStyleUnit_Percent == widthUnit) {
|
||||
containingBlockWidth = cbrs->GetContentWidth();
|
||||
containingBlockWidth = cbrs->computedWidth;
|
||||
}
|
||||
if (eStyleUnit_Percent == heightUnit) {
|
||||
if (NS_UNCONSTRAINEDSIZE == cbrs->maxSize.height) {
|
||||
|
@ -269,8 +250,16 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext)
|
|||
width = nscoord(pos->mWidth.GetPercentValue() * containingBlockWidth);
|
||||
break;
|
||||
case eStyleUnit_Auto:
|
||||
// XXX See section 10.3 of the css2 spec and then write this code!
|
||||
break;
|
||||
{
|
||||
// XXX See section 10.3 of the css2 spec and then write this code!
|
||||
nsMargin margin;
|
||||
nsMargin borderPadding;
|
||||
ComputeMarginFor(frame, parentReflowState, margin);
|
||||
ComputeBorderPaddingFor(frame, parentReflowState, borderPadding);
|
||||
width = maxSize.width - margin.left - margin.right - borderPadding.left -
|
||||
borderPadding.right;
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (heightUnit) {
|
||||
case eStyleUnit_Coord:
|
||||
|
@ -285,16 +274,10 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext)
|
|||
}
|
||||
|
||||
if (width > 0) {
|
||||
// XXX If the size constraint is a fixed content width then we also
|
||||
// need to set the max width as well, but then we bust tables...
|
||||
minWidth = width;
|
||||
widthConstraint = eHTMLFrameConstraint_FixedContent;
|
||||
computedWidth = width;
|
||||
}
|
||||
if (height > 0) {
|
||||
// XXX If the size constraint is a fixed content width then we also
|
||||
// need to set the max height as well...
|
||||
minHeight = height;
|
||||
heightConstraint = eHTMLFrameConstraint_FixedContent;
|
||||
computedHeight = height;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -378,7 +361,7 @@ nsHTMLReflowState::ComputeHorizontalValue(const nsHTMLReflowState& aRS,
|
|||
{
|
||||
aResult = 0;
|
||||
if (eStyleUnit_Percent == aUnit) {
|
||||
nscoord width = aRS.GetContentWidth();
|
||||
nscoord width = aRS.computedWidth;
|
||||
float pct = aCoord.GetPercentValue();
|
||||
aResult = NSToCoordFloor(width * pct);
|
||||
}
|
||||
|
@ -393,7 +376,7 @@ nsHTMLReflowState::ComputeVerticalValue(const nsHTMLReflowState& aRS,
|
|||
aResult = 0;
|
||||
if (eStyleUnit_Percent == aUnit) {
|
||||
// XXX temporary!
|
||||
nscoord width = aRS.GetContentWidth();
|
||||
nscoord width = aRS.computedWidth;
|
||||
float pct = aCoord.GetPercentValue();
|
||||
aResult = NSToCoordFloor(width * pct);
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ HRuleFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aDesiredSize.maxElementSize->width = onePixel;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.maxElementSize->width = aReflowState.minWidth;
|
||||
aDesiredSize.maxElementSize->width = aReflowState.computedWidth;
|
||||
}
|
||||
aDesiredSize.maxElementSize->height = onePixel;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ HRuleFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
aPresContext->GetScaledPixelsToTwips(p2t);
|
||||
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
if (NS_UNCONSTRAINEDSIZE == aReflowState.maxSize.width) {
|
||||
|
|
|
@ -185,15 +185,15 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||
kidReflowState.reflowCommand = nsnull;
|
||||
}
|
||||
|
||||
// For a width or height that's 'auto', make the frame as big as the
|
||||
// available space
|
||||
if (eHTMLFrameConstraint_FixedContent != kidReflowState.widthConstraint) {
|
||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Fixed;
|
||||
kidReflowState.minWidth = kidMaxSize.width;
|
||||
}
|
||||
if (eHTMLFrameConstraint_FixedContent != kidReflowState.heightConstraint) {
|
||||
kidReflowState.heightConstraint = eHTMLFrameConstraint_Fixed;
|
||||
kidReflowState.minHeight = kidMaxSize.height;
|
||||
// For a height that's 'auto', make the frame as big as the available space
|
||||
if (!kidReflowState.HaveFixedContentHeight()) {
|
||||
kidReflowState.computedHeight = kidMaxSize.height;
|
||||
|
||||
// Computed height is for the content area so reduce it by the amount of
|
||||
// space taken up by border and padding
|
||||
nsMargin borderPadding;
|
||||
kidReflowState.ComputeBorderPaddingFor(mFirstChild, &aReflowState, borderPadding);
|
||||
kidReflowState.computedHeight -= borderPadding.top + borderPadding.bottom;
|
||||
}
|
||||
|
||||
// Reflow the frame
|
||||
|
@ -201,16 +201,6 @@ RootFrame::Reflow(nsIPresContext& aPresContext,
|
|||
if (NS_OK == mFirstChild->QueryInterface(kIHTMLReflowIID, (void**)&htmlReflow)) {
|
||||
ReflowChild(mFirstChild, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||
|
||||
// Place and size the child. Because we told the child it was
|
||||
// fixed make sure it's at least as big as we told it. This
|
||||
// handles the case where the child ignores the reflow state
|
||||
// constraints
|
||||
if (desiredSize.width < kidReflowState.minWidth) {
|
||||
desiredSize.width = kidReflowState.minWidth;
|
||||
}
|
||||
if (desiredSize.height < kidReflowState.minHeight) {
|
||||
desiredSize.height = kidReflowState.minHeight;
|
||||
}
|
||||
nsRect rect(childMargin.left, childMargin.top, desiredSize.width, desiredSize.height);
|
||||
mFirstChild->SetRect(rect);
|
||||
|
||||
|
|
|
@ -72,33 +72,6 @@ struct nsHTMLReflowMetrics : nsReflowMetrics {
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* The type of size constraint that applies to a particular
|
||||
* dimension. For the fixed and fixed content cases the min/max
|
||||
* width/height in the reflow state structure is ignored and you
|
||||
* should use the max size value when reflowing the frame.
|
||||
*
|
||||
* @see nsHTMLReflowState
|
||||
*/
|
||||
enum nsHTMLFrameConstraint {
|
||||
// Choose whatever frame size you want (there is no stylistic limitation
|
||||
// on the size of the frame)
|
||||
eHTMLFrameConstraint_Unconstrained,
|
||||
|
||||
// Choose a frame size between the min and max sizes
|
||||
eHTMLFrameConstraint_Constrained,
|
||||
|
||||
// Frame size is fixed. The nsReflowState::maxSize.width value
|
||||
// determines the fixed width.
|
||||
eHTMLFrameConstraint_Fixed,
|
||||
|
||||
// Content size is fixed. The nsReflowState::maxSize.width value
|
||||
// determines the fixed width.
|
||||
eHTMLFrameConstraint_FixedContent
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* CSS Frame type. Included as part of the reflow state.
|
||||
*
|
||||
|
@ -149,6 +122,9 @@ enum nsCSSFrameType {
|
|||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#define NS_INTRINSICSIZE 0
|
||||
#define NS_AUTOHEIGHT 0
|
||||
|
||||
/**
|
||||
* HTML version of the reflow state.
|
||||
*
|
||||
|
@ -157,30 +133,50 @@ enum nsCSSFrameType {
|
|||
struct nsHTMLReflowState : nsReflowState {
|
||||
// The type of frame, from css's perspective. This value is
|
||||
// initialized by the Init method below.
|
||||
nsCSSFrameType frameType;
|
||||
nsCSSFrameType frameType;
|
||||
|
||||
nsISpaceManager* spaceManager;
|
||||
nsISpaceManager* spaceManager;
|
||||
|
||||
// LineLayout object (only for inline reflow; set to NULL otherwise)
|
||||
nsLineLayout* lineLayout;
|
||||
nsLineLayout* lineLayout;
|
||||
|
||||
// Constraint that applies to width dimension
|
||||
nsHTMLFrameConstraint widthConstraint;
|
||||
nscoord minWidth;
|
||||
// Computed width and margins. The computed width specifies the frame's
|
||||
// content width, and it does not apply to inline non-replaced elements
|
||||
//
|
||||
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
||||
// use your intrinsic width as the computed width
|
||||
//
|
||||
// For block-level frames, the computed width is based on the width of the
|
||||
// containing block and the margin/border/padding areas and the min/max
|
||||
// width
|
||||
nscoord computedWidth;
|
||||
nscoord computedLeftMargin, computedRightMargin;
|
||||
|
||||
// Constraint that applies to height dimension
|
||||
nsHTMLFrameConstraint heightConstraint;
|
||||
nscoord minHeight;
|
||||
// Computed height and margins. The computed height specifies the frame's
|
||||
// content height, and it does not apply to inline non-replaced elements
|
||||
//
|
||||
// For replaced inline frames, a value of NS_INTRINSICSIZE means you should
|
||||
// use your intrinsic height as the computed height
|
||||
//
|
||||
// For non-replaced block-level frames in the flow and floated, a value of
|
||||
// NS_AUTOHEIGHT means you choose a height to shrink wrap around the normal
|
||||
// flow child frames. The height must be within the limit of the min/max
|
||||
// height if there is such a limit
|
||||
//
|
||||
// For replaced block-level frames, a value of NS_INTRINSICSIZE
|
||||
// means you use your intrinsic height as the computed height
|
||||
nscoord computedHeight;
|
||||
nscoord computedTopMargin, computedBottomMargin;
|
||||
|
||||
// Run-in frame made available for reflow
|
||||
nsBlockFrame* mRunInFrame;
|
||||
nsBlockFrame* mRunInFrame;
|
||||
|
||||
// Compact margin available space
|
||||
nscoord mCompactMarginWidth;
|
||||
nscoord mCompactMarginWidth;
|
||||
|
||||
// The line-height for the frame. If the frame has no specific
|
||||
// line-height value then this field will be "-1".
|
||||
nscoord mLineHeight;
|
||||
nscoord mLineHeight;
|
||||
|
||||
// Constructs an initial reflow state (no parent reflow state) for a
|
||||
// non-incremental reflow command. Sets reflowType to eReflowType_Block
|
||||
|
@ -229,19 +225,12 @@ struct nsHTMLReflowState : nsReflowState {
|
|||
const nsSize& aMaxSize,
|
||||
nsReflowReason aReflowReason);
|
||||
|
||||
PRBool HaveFixedContentWidth() const {
|
||||
return eHTMLFrameConstraint_FixedContent == widthConstraint;
|
||||
}
|
||||
|
||||
PRBool HaveFixedContentHeight() const {
|
||||
return eHTMLFrameConstraint_FixedContent == heightConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the width of the content area based on this reflow state's
|
||||
* state.
|
||||
* Returns PR_TRUE if the specified width or height has an value other
|
||||
* than 'auto'
|
||||
*/
|
||||
nscoord GetContentWidth() const;
|
||||
PRBool HaveFixedContentWidth() const;
|
||||
PRBool HaveFixedContentHeight() const;
|
||||
|
||||
/**
|
||||
* Get the containing block reflow state, starting from a frames
|
||||
|
|
|
@ -232,8 +232,8 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
if (aReflowState.HaveFixedContentWidth() &&
|
||||
aReflowState.HaveFixedContentHeight()) {
|
||||
// The image is fully constrained. Use the constraints directly.
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
// The image is partially constrained. Preserve aspect ratio of
|
||||
|
@ -256,16 +256,16 @@ nsHTMLImageLoader::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
// We have a width, and an auto height. Compute height
|
||||
// from width.
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
aDesiredSize.height = (nscoord)
|
||||
NSToIntRound(aReflowState.minWidth * imageHeight / imageWidth);
|
||||
NSToIntRound(aReflowState.computedWidth * imageHeight / imageWidth);
|
||||
}
|
||||
else {
|
||||
// We have a height and an auto width. Compute width from
|
||||
// height.
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
aDesiredSize.width = (nscoord)
|
||||
NSToIntRound(aReflowState.minHeight * imageWidth / imageHeight);
|
||||
NSToIntRound(aReflowState.computedHeight * imageWidth / imageHeight);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -306,11 +306,11 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
aMetrics.width = aReflowState.minWidth;
|
||||
aMetrics.width = aReflowState.computedWidth;
|
||||
haveWidth = PR_TRUE;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
aMetrics.height = aReflowState.minHeight;
|
||||
aMetrics.height = aReflowState.computedHeight;
|
||||
haveHeight = PR_TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -292,66 +292,30 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
|
|||
dc->GetScrollBarDimensions(sbWidth, sbHeight);
|
||||
NS_RELEASE(dc);
|
||||
|
||||
//@ Make me a subroutine...
|
||||
|
||||
// Compute the scroll area size. This is the area inside of our border edge
|
||||
// and inside of any vertical and horizontal scrollbars
|
||||
nsSize scrollAreaSize;
|
||||
if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) ||
|
||||
(eHTMLFrameConstraint_FixedContent == aReflowState.widthConstraint)) {
|
||||
// The reflow state width reflects space for the content area only, so don't
|
||||
// subtract for borders...
|
||||
scrollAreaSize.width = aReflowState.minWidth;
|
||||
|
||||
if (eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) {
|
||||
scrollAreaSize.width -= border.left + border.right;
|
||||
scrollAreaSize.width -= NSToCoordRound(sbWidth);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Use the max width in the reflow state
|
||||
scrollAreaSize.width = aReflowState.maxSize.width;
|
||||
if (NS_UNCONSTRAINEDSIZE != scrollAreaSize.width) {
|
||||
// The width is constrained so subtract for borders
|
||||
scrollAreaSize.width -= border.left + border.right;
|
||||
|
||||
// Subtract for the width of the vertical scrollbar. We always do this
|
||||
// regardless of whether scrollbars are auto or always visible
|
||||
scrollAreaSize.width -= NSToCoordRound(sbWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) ||
|
||||
(eHTMLFrameConstraint_FixedContent == aReflowState.heightConstraint)) {
|
||||
// The reflow state height reflects space for the content area only, so don't
|
||||
// subtract for borders...
|
||||
scrollAreaSize.height = aReflowState.minHeight;
|
||||
|
||||
if (eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) {
|
||||
scrollAreaSize.height -= border.top + border.bottom;
|
||||
|
||||
// If scrollbars are always visible then subtract for the
|
||||
// height of the horizontal scrollbar
|
||||
if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) {
|
||||
scrollAreaSize.height -= NSToCoordRound(sbHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Use the max height in the reflow state
|
||||
scrollAreaSize.width = aReflowState.computedWidth;
|
||||
// Subtract for the width of the vertical scrollbar. We always do this
|
||||
// regardless of whether scrollbars are auto or always visible
|
||||
scrollAreaSize.width -= NSToCoordRound(sbWidth);
|
||||
if (NS_AUTOHEIGHT == aReflowState.computedHeight) {
|
||||
// We have an 'auto' height and so we should shrink wrap around the
|
||||
// scrolled frame. Let the scrolled frame be as high as the available
|
||||
// height
|
||||
scrollAreaSize.height = aReflowState.maxSize.height;
|
||||
if (NS_UNCONSTRAINEDSIZE != scrollAreaSize.height) {
|
||||
// The height is constrained so subtract for borders
|
||||
scrollAreaSize.height -= border.top + border.bottom;
|
||||
scrollAreaSize.height -= border.top + border.bottom;
|
||||
|
||||
// If scrollbars are always visible then subtract for the
|
||||
// height of the horizontal scrollbar
|
||||
if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) {
|
||||
scrollAreaSize.height -= NSToCoordRound(sbHeight);
|
||||
}
|
||||
}
|
||||
// XXX Check for min/max limits...
|
||||
} else {
|
||||
// We have a fixed height so use the computed height
|
||||
scrollAreaSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
// If scrollbars are always visible then subtract for the height of the
|
||||
// horizontal scrollbar
|
||||
if (NS_STYLE_OVERFLOW_SCROLL == display->mOverflow) {
|
||||
scrollAreaSize.height -= NSToCoordRound(sbHeight);
|
||||
}
|
||||
//@ Make me a subroutine...
|
||||
|
||||
// Reflow the child and get its desired size. Let it be as high as it
|
||||
// wants
|
||||
|
@ -363,10 +327,9 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
|
|||
ReflowChild(mFirstChild, aPresContext, kidDesiredSize, kidReflowState, aStatus);
|
||||
NS_ASSERTION(NS_FRAME_IS_COMPLETE(aStatus), "bad status");
|
||||
|
||||
// Make sure the scrolled frame fills the entire scroll area along a
|
||||
// fixed dimension
|
||||
if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) ||
|
||||
(eHTMLFrameConstraint_FixedContent == aReflowState.heightConstraint)) {
|
||||
// Make sure the height of the scrolled frame fills the entire scroll area,
|
||||
// unless we're shrink wrapping
|
||||
if (NS_AUTOHEIGHT != aReflowState.computedHeight) {
|
||||
if (kidDesiredSize.height < scrollAreaSize.height) {
|
||||
kidDesiredSize.height = scrollAreaSize.height;
|
||||
|
||||
|
@ -389,11 +352,9 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) ||
|
||||
(eHTMLFrameConstraint_FixedContent == aReflowState.widthConstraint)) {
|
||||
if (kidDesiredSize.width < scrollAreaSize.width) {
|
||||
kidDesiredSize.width = scrollAreaSize.width;
|
||||
}
|
||||
// Make sure the width of the scrolled frame fills the entire scroll area
|
||||
if (kidDesiredSize.width < scrollAreaSize.width) {
|
||||
kidDesiredSize.width = scrollAreaSize.width;
|
||||
}
|
||||
|
||||
// Place and size the child.
|
||||
|
@ -415,21 +376,16 @@ nsScrollFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
#endif
|
||||
|
||||
// Compute our desired size. If our size was fixed then use the fixed size;
|
||||
// otherwise, shrink wrap around the scrolled frame
|
||||
if ((eHTMLFrameConstraint_Fixed == aReflowState.widthConstraint) ||
|
||||
(eHTMLFrameConstraint_FixedContent == aReflowState.widthConstraint)) {
|
||||
aDesiredSize.width = scrollAreaSize.width;
|
||||
} else {
|
||||
aDesiredSize.width = kidDesiredSize.width;
|
||||
}
|
||||
// Compute our desired size
|
||||
aDesiredSize.width = scrollAreaSize.width;
|
||||
aDesiredSize.width += border.left + border.right + NSToCoordRound(sbWidth);
|
||||
|
||||
if ((eHTMLFrameConstraint_Fixed == aReflowState.heightConstraint) ||
|
||||
(eHTMLFrameConstraint_FixedContent == aReflowState.heightConstraint)) {
|
||||
aDesiredSize.height = scrollAreaSize.height;
|
||||
} else {
|
||||
|
||||
// For the height if we're shrink wrapping then use the child's desired size;
|
||||
// otherwise, use the scroll area size
|
||||
if (NS_AUTOHEIGHT == aReflowState.computedHeight) {
|
||||
aDesiredSize.height = kidDesiredSize.height;
|
||||
} else {
|
||||
aDesiredSize.height = scrollAreaSize.height;
|
||||
}
|
||||
aDesiredSize.height += border.top + border.bottom;
|
||||
// XXX This should really be "if we have a visible horizontal scrollbar"...
|
||||
|
|
|
@ -244,13 +244,13 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
|||
|
||||
// XXX this needs to be changed from (200,200) to a better default for inline frames
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.width = NSIntPixelsToTwips(200, p2t);
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.height = NSIntPixelsToTwips(200, p2t);
|
||||
|
|
|
@ -276,7 +276,7 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
|||
legendMargin.left + legendMargin.right;
|
||||
nscoord verTaken = padding.top + borderPadding.bottom + legendMargin.top + legendMargin.bottom;
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
availSize.width = aReflowState.minWidth;
|
||||
availSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
if (NS_UNCONSTRAINEDSIZE != availSize.width)
|
||||
|
@ -356,8 +356,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
|||
nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right;
|
||||
|
||||
aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.computedWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
|
||||
// Place the legend
|
||||
|
@ -419,8 +419,8 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext,
|
|||
aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom;
|
||||
if (mInline) // XXX parents don't yet ......
|
||||
aDesiredSize.height += margin.bottom;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.computedHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
|
|
@ -680,13 +680,13 @@ nsFormControlFrame::GetStyleSize(nsIPresContext& aPresContext,
|
|||
nsSize& aSize)
|
||||
{
|
||||
if (aReflowState.HaveFixedContentWidth()) {
|
||||
aSize.width = aReflowState.minWidth;
|
||||
aSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
else {
|
||||
aSize.width = CSS_NOTSET;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight()) {
|
||||
aSize.height = aReflowState.minHeight;
|
||||
aSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
else {
|
||||
aSize.height = CSS_NOTSET;
|
||||
|
|
|
@ -627,11 +627,11 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
// if we are constrained and the child is smaller, use the constrained values
|
||||
if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.minWidth)) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.computedWidth)) {
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.computedHeight)) {
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
|
|
|
@ -449,11 +449,11 @@ nsLabelFrame::Reflow(nsIPresContext& aPresContext,
|
|||
}
|
||||
|
||||
// if we are constrained and the child is smaller, use the constrained values
|
||||
if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.minWidth)) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aDesiredSize.width < aReflowState.computedWidth)) {
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.minHeight)) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aDesiredSize.height < aReflowState.computedHeight)) {
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
|
|
|
@ -142,13 +142,13 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext,
|
|||
|
||||
// add in our border and padding to the size of the child
|
||||
aDesiredSize.width += borderPadding.left + borderPadding.right;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.minWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.minWidth;
|
||||
if (aReflowState.HaveFixedContentWidth() && (aReflowState.computedWidth > aDesiredSize.width)) {
|
||||
aDesiredSize.width = aReflowState.computedWidth;
|
||||
}
|
||||
|
||||
aDesiredSize.height += borderPadding.top + borderPadding.bottom;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.minHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.minHeight;
|
||||
if (aReflowState.HaveFixedContentHeight() && (aReflowState.computedHeight > aDesiredSize.height)) {
|
||||
aDesiredSize.height = aReflowState.computedHeight;
|
||||
}
|
||||
|
||||
// adjust our max element size, if necessary
|
||||
|
|
|
@ -3698,10 +3698,9 @@ nscoord nsTableFrame::GetEffectiveContainerHeight(const nsHTMLReflowState& aRefl
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (eHTMLFrameConstraint_Fixed==rs->heightConstraint ||
|
||||
eHTMLFrameConstraint_FixedContent==rs->heightConstraint)
|
||||
if (NS_AUTOHEIGHT != rs->computedHeight)
|
||||
{
|
||||
result = rs->maxSize.height;
|
||||
result = rs->computedHeight;
|
||||
break;
|
||||
}
|
||||
// XXX: evil cast!
|
||||
|
|
|
@ -1280,7 +1280,6 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
|||
kidReflowState.reason = eReflowReason_Resize;
|
||||
kidReflowState.reflowCommand = nsnull;
|
||||
kidReflowState.maxSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Unconstrained;
|
||||
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||
if (gsDebug)
|
||||
printf ("TR %p for cell %p Incremental Reflow: desired=%d, MES=%d\n",
|
||||
|
@ -1298,7 +1297,6 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
|||
// Now reflow the cell again this time constraining the width
|
||||
// XXX Ignore for now the possibility that the column width has changed...
|
||||
kidReflowState.maxSize.width = availWidth;
|
||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Constrained;
|
||||
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||
|
||||
// Place the child after taking into account it's margin and attributes
|
||||
|
|
|
@ -3698,10 +3698,9 @@ nscoord nsTableFrame::GetEffectiveContainerHeight(const nsHTMLReflowState& aRefl
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (eHTMLFrameConstraint_Fixed==rs->heightConstraint ||
|
||||
eHTMLFrameConstraint_FixedContent==rs->heightConstraint)
|
||||
if (NS_AUTOHEIGHT != rs->computedHeight)
|
||||
{
|
||||
result = rs->maxSize.height;
|
||||
result = rs->computedHeight;
|
||||
break;
|
||||
}
|
||||
// XXX: evil cast!
|
||||
|
|
|
@ -1280,7 +1280,6 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
|||
kidReflowState.reason = eReflowReason_Resize;
|
||||
kidReflowState.reflowCommand = nsnull;
|
||||
kidReflowState.maxSize.width = NS_UNCONSTRAINEDSIZE;
|
||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Unconstrained;
|
||||
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||
if (gsDebug)
|
||||
printf ("TR %p for cell %p Incremental Reflow: desired=%d, MES=%d\n",
|
||||
|
@ -1298,7 +1297,6 @@ NS_METHOD nsTableRowFrame::IR_TargetIsChild(nsIPresContext& aPresContext,
|
|||
// Now reflow the cell again this time constraining the width
|
||||
// XXX Ignore for now the possibility that the column width has changed...
|
||||
kidReflowState.maxSize.width = availWidth;
|
||||
kidReflowState.widthConstraint = eHTMLFrameConstraint_Constrained;
|
||||
rv = ReflowChild(aNextFrame, aPresContext, desiredSize, kidReflowState, aStatus);
|
||||
|
||||
// Place the child after taking into account it's margin and attributes
|
||||
|
|
Загрузка…
Ссылка в новой задаче