fix border/padding and availableHeight calculations at page/column breaks, b=368079 r+sr=roc a=roc

This commit is contained in:
fantasai.cvs@inkedblade.net 2008-01-15 19:54:46 -08:00
parent a1d78c6ee0
commit 4b81524f7e
12 changed files with 352 additions and 2 deletions

View File

@ -1348,7 +1348,7 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
// Don't carry out a bottom margin when our height is fixed.
aMetrics.mCarriedOutBottomMargin.Zero();
}
else {
else if (NS_FRAME_IS_COMPLETE(aState.mReflowStatus)) {
nscoord autoHeight = aState.mY + nonCarriedOutVerticalMargin;
// Shrink wrap our height around our contents.
@ -1383,6 +1383,9 @@ nsBlockFrame::ComputeFinalSize(const nsHTMLReflowState& aReflowState,
autoHeight += borderPadding.top + borderPadding.bottom;
aMetrics.height = autoHeight;
}
else {
aMetrics.height = aReflowState.availableHeight;
}
if (IS_TRUE_OVERFLOW_CONTAINER(this) &&
NS_FRAME_IS_NOT_COMPLETE(aState.mReflowStatus)) {

View File

@ -203,7 +203,7 @@ nsBlockReflowState::ComputeBlockAvailSpace(nsIFrame* aFrame,
aResult.y = mY;
aResult.height = GetFlag(BRS_UNCONSTRAINEDHEIGHT)
? NS_UNCONSTRAINEDSIZE
: PR_MAX(0, mBottomEdge - mY);
: PR_MAX(0, mReflowState.availableHeight - mY);
// mY might be greater than mBottomEdge if the block's top margin pushes
// it off the page/column. Negative available height can confuse other code
// and is nonsense in principle.

View File

@ -0,0 +1,17 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
body {
height: 200px;
width: 300px;
border: solid silver;
border-style: none solid;
background: green;
}
</style>
</head>
<body>
</body>
</html>

View File

@ -0,0 +1,43 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container {
padding-bottom: 10px;
border-bottom: 10px solid transparent;
}
.box {
background: green;
}
p {
color: green;
font-size: 150px;
line-height: 1;
margin: 0;
}
p + p {
height: 200px;
}
body {
height: 200px;
width: 300px;
-moz-column-width: 150px;
-moz-column-gap: 0;
border: solid silver;
border-style: none solid;
background: red;
}
</style>
</head>
<body>
<div class="container">
<div class="box">
<p>.</p>
<p>.</p>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container {
height: 500px;
background: lime;
border: 10px green;
border-style: none solid;
}
.long {
background: aqua;
width: 40px;
height: 500px;
}
body {
height: 200px;
width: 300px;
-moz-column-width: 100px;
-moz-column-gap: 0;
border: solid silver;
border-style: none solid;
background: yellow;
}
</style>
</head>
<body>
<div class="container">
<div class="long">
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,74 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container {
height: 0;
padding-bottom: 10px;
border-bottom: 10px solid transparent;
margin-bottom: -20px;
}
.overflow {
position: relative;
background: aqua;
height: 500px;
width: 40px;
border: 10px solid red;
border-style: none solid;
}
body > .container .overflow {
border-right: none;
}
.abs {
position: relative;
}
.abs .container {
position: absolute;
width: 100%;
margin-left: 50px;
}
.abs .overflow {
background: lime;
border-left: none;
}
.long {
position: relative;
height: 500px;
border: solid 10px green;
border-style: none solid;
}
.block {
background: yellow;
height: 100px;
}
body {
height: 200px;
width: 300px;
-moz-column-width: 100px;
-moz-column-gap: 0;
border: solid silver;
border-style: none solid;
background: red;
}
</style>
</head>
<body>
<div class="abs">
<div class="container">
<div class="overflow">
</div>
</div>
</div>
<div class="container">
<div class="overflow">
</div>
</div>
<div class="long">
</div>
<div class="block">
</div>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container1 {
height: 190px;
border-top: 10px solid blue;
}
.container2 {
border-top: solid 10px aqua;
}
.multicol {
height: 200px;
width: 300px;
-moz-column-width: 150px;
-moz-column-gap: 0;
border: solid silver;
}
</style>
</head>
<body>
There must be a continuous 10px line at the top
of the gray box, the left half blue and the right
half aqua.
<div class="multicol">
<div class="container1">
</div>
<div class="container2">
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,35 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container {
height: 0;
border-bottom: 10px solid blue;
}
.overflow {
height: 195px;
border-bottom: solid 10px aqua;
}
.multicol {
height: 200px;
width: 300px;
-moz-column-width: 150px;
-moz-column-gap: 0;
border: solid silver;
}
</style>
</head>
<body>
There must be a continuous 10px line at the top
of the gray box, the left half blue and the right
half aqua.
<div class="multicol">
<div class="container">
<div class="overflow">
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,31 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container1 {
border-top: 10px solid blue;
}
.container2 {
border-top: solid 10px aqua;
}
.multicol {
height: 200px;
width: 300px;
border: solid silver;
}
</style>
</head>
<body>
There must be two continuous 10px lines at the top
of the gray box, the top one blue and the bottom one
aqua.
<div class="multicol">
<div class="container1">
</div>
<div class="container2">
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container {
border-bottom: 10px solid aqua;
}
.overflow {
height: 175px;
border-bottom: solid 10px blue;
}
.rainbow {
border-top: 10px solid blue;
border-bottom: 10px solid aqua;
}
.multicol {
height: 200px;
width: 300px;
-moz-column-width: 150px;
-moz-column-gap: 0;
border: solid silver;
}
</style>
</head>
<body>
There must be two continuous 10px lines at the top
of the gray box, the top one blue and the bottom one
aqua.
<div class="multicol">
<div class="rainbow"></div>
<div class="container">
<div class="overflow">
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pagination with Borders</title>
<style type="text/css">
.container {
border-bottom: 10px solid aqua;
}
.overflow {
height: 185px;
border-top: solid 10px blue;
}
.multicol {
height: 200px;
width: 300px;
-moz-column-width: 150px;
-moz-column-gap: 0;
border: solid silver;
}
</style>
</head>
<body>
There must be a continuous 10px line at the top
of the gray box, the left half blue and the right
half aqua.
<div class="multicol">
<div class="container">
<div class="overflow">
</div>
</div>
</div>
</body>
</html>

View File

@ -5,3 +5,8 @@
== abspos-overflow-01.xhtml abspos-overflow-01.ref.xhtml
== abspos-overflow-01-cols.xhtml abspos-overflow-01-cols.ref.xhtml
== dynamic-abspos-overflow-01-cols.xhtml dynamic-abspos-overflow-01-cols.ref.xhtml
== border-breaking-000-cols.xhtml border-breaking-000-cols.ref.xhtml
== border-breaking-001-cols.xhtml border-breaking-001-cols.ref.xhtml
== border-breaking-002-cols.xhtml border-breaking-002-cols.ref.xhtml
== border-breaking-003-cols.xhtml border-breaking-003-cols.ref.xhtml
== border-breaking-004-cols.xhtml border-breaking-002-cols.ref.xhtml