зеркало из https://github.com/mozilla/pjs.git
adopt caption vertical margins to latest CSS2.1 revision, bug 478614, r/sr=dbaron
This commit is contained in:
Родитель
76cebb6723
Коммит
1820789586
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 150px}
|
||||
table {width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 50px;}
|
||||
table {margin-top: 100px; width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 50px; caption-side:top}
|
||||
table {margin-top: 100px; width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption { caption-side:bottom;}
|
||||
table {100px; width:100px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-bottom: 100px; caption-side:bottom;}
|
||||
table {margin-bottom: 100px; width:100px;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 160px;margin-bottom:50px}
|
||||
table {width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 60px;margin-bottom:50px}
|
||||
table {margin-top: 100px; width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top:50px; caption-side:bottom}
|
||||
table {width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-bottom: 100px;margin-top:50px; caption-side:bottom}
|
||||
table {margin-bottom: 100px; width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 100px;margin-bottom:50px;caption-side:top-outside}
|
||||
table { width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 100px;caption-side:top-outside}
|
||||
table {margin-top: 50px; width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 50px;caption-side:bottom-outside}
|
||||
table {width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Testcase for table + caption vertical margins (bug 478614)</title>
|
||||
<style type="text/css">
|
||||
caption {margin-top: 50px;caption-side:bottom-outside}
|
||||
table {margin-bottom: 50px; width:100px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table><caption>caption</caption>
|
||||
<tr><td>td</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
|
@ -1190,6 +1190,13 @@ fails == 472020-2.xul 472020-2-ref.xul
|
|||
== 476598-1b.html 476598-1-ref.html
|
||||
== 476598-1b.html 476598-1-ref2.html
|
||||
!= 476598-1-ref.html about:blank
|
||||
== 478614-1.html 478614-1-ref.html
|
||||
== 478614-2.html 478614-1-ref.html
|
||||
== 478614-3.html 478614-3-ref.html
|
||||
== 478614-4.html 478614-4-ref.html
|
||||
== 478614-5.html 478614-5-ref.html
|
||||
== 478614-6.html 478614-6-ref.html
|
||||
== 478614-7.html 478614-7-ref.html
|
||||
== 478377-1.xul 478377-1-ref.xul
|
||||
== 478811-1.html 478811-1-ref.html
|
||||
== 478811-2.html 478811-2-ref.html
|
||||
|
|
|
@ -57,14 +57,14 @@ fails == table-sibling-2a.html table-sibling-2-ref.html # Bug 87277
|
|||
fails == table-sibling-2b.html table-sibling-2-ref.html # Bug 87277
|
||||
fails == table-sibling-2c.html table-sibling-2-ref.html # Bug 87277
|
||||
== table-caption-1a.html table-caption-1-ref.html
|
||||
fails == table-caption-1b.html table-caption-1-ref.html # Bug 297676 and 478614
|
||||
fails == table-caption-2a.html table-caption-2-ref.html # Bug 297676 and 478614
|
||||
fails == table-caption-2b.html table-caption-2-ref.html # Bug 297676 and 478614
|
||||
fails == table-caption-2c.html table-caption-2-ref.html # Bug 297676 and 478614
|
||||
== table-caption-1b.html table-caption-1-ref.html
|
||||
== table-caption-2a.html table-caption-2-ref.html
|
||||
== table-caption-2b.html table-caption-2-ref.html
|
||||
== table-caption-2c.html table-caption-2-ref.html
|
||||
== table-caption-top-1.html table-caption-top-1-ref.html
|
||||
fails == table-caption-top-2.html table-caption-top-2-ref.html # Bug 478614
|
||||
== table-caption-top-2.html table-caption-top-2-ref.html
|
||||
== table-caption-bottom-1.html table-caption-bottom-1-ref.html
|
||||
fails == table-caption-bottom-2.html table-caption-bottom-2-ref.html # Bug 478614
|
||||
== table-caption-bottom-2.html table-caption-bottom-2-ref.html
|
||||
fails == caption-sibling-1a.html caption-sibling-1-ref.html # Bug 144517
|
||||
fails == caption-sibling-1b.html caption-sibling-1-ref.html # Bug 144517
|
||||
fails == caption-sibling-1c.html caption-sibling-1-ref.html # Bug 144517
|
||||
|
|
|
@ -706,7 +706,13 @@ nsTableOuterFrame::SetDesiredSize(PRUint8 aCaptionSide,
|
|||
aWidth = PR_MAX(aWidth, captionRect.XMost() + aCaptionMargin.right);
|
||||
}
|
||||
aHeight = innerRect.YMost() + aInnerMargin.bottom;
|
||||
aHeight = PR_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom);
|
||||
if (NS_STYLE_CAPTION_SIDE_BOTTOM != aCaptionSide) {
|
||||
aHeight = PR_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom);
|
||||
}
|
||||
else {
|
||||
aHeight = PR_MAX(aHeight, captionRect.YMost() + aCaptionMargin.bottom +
|
||||
aInnerMargin.bottom);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -784,125 +790,87 @@ nsTableOuterFrame::GetCaptionOrigin(PRUint32 aCaptionSide,
|
|||
nsMargin& aCaptionMargin,
|
||||
nsPoint& aOrigin)
|
||||
{
|
||||
// FIXME: This function expects computed margin values to be
|
||||
// NS_AUTOMARGIN, but this is no longer the case.
|
||||
aOrigin.x = aOrigin.y = 0;
|
||||
if ((NS_UNCONSTRAINEDSIZE == aInnerSize.width) || (NS_UNCONSTRAINEDSIZE == aInnerSize.height) ||
|
||||
(NS_UNCONSTRAINEDSIZE == aCaptionSize.width) || (NS_UNCONSTRAINEDSIZE == aCaptionSize.height)) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (!mCaptionFrame) return NS_OK;
|
||||
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.left, "The computed caption margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.top, "The computed caption margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.bottom, "The computed caption margin is auto?");
|
||||
|
||||
// FIXME: Have two separate switch statements so we can coalesce the
|
||||
// horizontal computation for top and bottom.
|
||||
// horizontal computation
|
||||
switch(aCaptionSide) {
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM:
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
||||
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
||||
aContainBlockSize.width, aCaptionSize.width);
|
||||
}
|
||||
// FIXME: Position relative to right edge for RTL. (Based on table
|
||||
// direction or table parent direction?)
|
||||
aOrigin.x = aCaptionMargin.left;
|
||||
if (aCaptionSide == NS_STYLE_CAPTION_SIDE_BOTTOM) {
|
||||
// We placed the caption using only the table's width as available
|
||||
// width, and we should position it this way as well.
|
||||
aOrigin.x += aInnerMargin.left;
|
||||
}
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.top) {
|
||||
aCaptionMargin.top = 0;
|
||||
}
|
||||
// FIXME: Position relative to right edge for RTL. (Based on table
|
||||
// direction or table parent direction?)
|
||||
nsCollapsingMargin marg;
|
||||
marg.Include(aCaptionMargin.top);
|
||||
marg.Include(aInnerMargin.bottom);
|
||||
nscoord collapseMargin = marg.get();
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.bottom) {
|
||||
nscoord height = aInnerSize.height + collapseMargin + aCaptionSize.height;
|
||||
aCaptionMargin.bottom = CalcAutoMargin(aCaptionMargin.bottom, aInnerMargin.top,
|
||||
aContainBlockSize.height, height);
|
||||
}
|
||||
aOrigin.y = aInnerMargin.top + aInnerSize.height + collapseMargin;
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_LEFT: {
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
||||
if (NS_AUTOMARGIN != aInnerMargin.left) {
|
||||
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
||||
aInnerMargin.left, aCaptionSize.width);
|
||||
}
|
||||
else {
|
||||
// zero for now
|
||||
aCaptionMargin.left = 0;
|
||||
}
|
||||
}
|
||||
aOrigin.x = aCaptionMargin.left;
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
switch(GetCaptionVerticalAlign()) {
|
||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||
aOrigin.y = PR_MAX(0, aInnerMargin.top + ((aInnerSize.height - aCaptionSize.height) / 2));
|
||||
break;
|
||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||
aOrigin.y = PR_MAX(0, aInnerMargin.top + aInnerSize.height - aCaptionSize.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_RIGHT: {
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
||||
if (NS_AUTOMARGIN != aInnerMargin.right) {
|
||||
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
||||
aInnerMargin.right, aCaptionSize.width);
|
||||
}
|
||||
else {
|
||||
// zero for now
|
||||
aCaptionMargin.left = 0;
|
||||
}
|
||||
}
|
||||
aOrigin.x = aInnerMargin.left + aInnerSize.width + aCaptionMargin.left;
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
switch(GetCaptionVerticalAlign()) {
|
||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||
aOrigin.y += PR_MAX(0, (aInnerSize.height - aCaptionSize.height) / 2);
|
||||
break;
|
||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||
aOrigin.y += PR_MAX(0, aInnerSize.height - aCaptionSize.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
default: { // top
|
||||
NS_ASSERTION(aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE,
|
||||
"unexpected caption side");
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.left) {
|
||||
aCaptionMargin.left = CalcAutoMargin(aCaptionMargin.left, aCaptionMargin.right,
|
||||
aContainBlockSize.width, aCaptionSize.width);
|
||||
}
|
||||
// FIXME: Position relative to right edge for RTL. (Based on table
|
||||
// direction or table parent direction?)
|
||||
aOrigin.x = aCaptionMargin.left;
|
||||
if (aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP) {
|
||||
// We placed the caption using only the table's width as available
|
||||
// width, and we should position it this way as well.
|
||||
aOrigin.x += aInnerMargin.left;
|
||||
}
|
||||
// FIXME: Position relative to right edge for RTL. (Based on table
|
||||
// direction or table parent direction?)
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.bottom) {
|
||||
aCaptionMargin.bottom = 0;
|
||||
}
|
||||
if (NS_AUTOMARGIN == aCaptionMargin.top) {
|
||||
nsCollapsingMargin marg;
|
||||
marg.Include(aCaptionMargin.bottom);
|
||||
marg.Include(aInnerMargin.top);
|
||||
nscoord collapseMargin = marg.get();
|
||||
nscoord height = aCaptionSize.height + collapseMargin + aInnerSize.height;
|
||||
aCaptionMargin.top = CalcAutoMargin(aCaptionMargin.top, aInnerMargin.bottom,
|
||||
aContainBlockSize.height, height);
|
||||
}
|
||||
aOrigin.y = aCaptionMargin.top;
|
||||
|
||||
} break;
|
||||
}
|
||||
// vertical computation
|
||||
switch (aCaptionSide) {
|
||||
case NS_STYLE_CAPTION_SIDE_RIGHT:
|
||||
case NS_STYLE_CAPTION_SIDE_LEFT:
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
switch (GetCaptionVerticalAlign()) {
|
||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||
aOrigin.y = PR_MAX(0, aInnerMargin.top + ((aInnerSize.height - aCaptionSize.height) / 2));
|
||||
break;
|
||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||
aOrigin.y = PR_MAX(0, aInnerMargin.top + aInnerSize.height - aCaptionSize.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM: {
|
||||
aOrigin.y = aInnerMargin.top + aInnerSize.height + aCaptionMargin.top;
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
|
||||
nsCollapsingMargin marg;
|
||||
marg.Include(aCaptionMargin.top);
|
||||
marg.Include(aInnerMargin.bottom);
|
||||
nscoord collapseMargin = marg.get();
|
||||
aOrigin.y = aInnerMargin.top + aInnerSize.height + collapseMargin;
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_TOP: {
|
||||
aOrigin.y = aInnerMargin.top + aCaptionMargin.top;
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE: {
|
||||
aOrigin.y = aCaptionMargin.top;
|
||||
} break;
|
||||
default:
|
||||
NS_NOTREACHED("Unknown caption alignment type");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -915,8 +883,14 @@ nsTableOuterFrame::GetInnerOrigin(PRUint32 aCaptionSide,
|
|||
nsMargin& aInnerMargin,
|
||||
nsPoint& aOrigin)
|
||||
{
|
||||
// FIXME: This function expects computed margin values to be
|
||||
// NS_AUTOMARGIN, but this is no longer the case.
|
||||
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.left, "The computed caption margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aCaptionMargin.right, "The computed caption margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aInnerMargin.left, "The computed inner margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aInnerMargin.right, "The computed inner margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aInnerMargin.top, "The computed inner margin is auto?");
|
||||
NS_ASSERTION(NS_AUTOMARGIN != aInnerMargin.bottom, "The computed inner margin is auto?");
|
||||
|
||||
aOrigin.x = aOrigin.y = 0;
|
||||
if ((NS_UNCONSTRAINEDSIZE == aInnerSize.width) || (NS_UNCONSTRAINEDSIZE == aInnerSize.height) ||
|
||||
(NS_UNCONSTRAINEDSIZE == aCaptionSize.width) || (NS_UNCONSTRAINEDSIZE == aCaptionSize.height)) {
|
||||
|
@ -924,40 +898,13 @@ nsTableOuterFrame::GetInnerOrigin(PRUint32 aCaptionSide,
|
|||
}
|
||||
|
||||
nscoord minCapWidth = aCaptionSize.width;
|
||||
if (NS_AUTOMARGIN != aCaptionMargin.left)
|
||||
minCapWidth += aCaptionMargin.left;
|
||||
if (NS_AUTOMARGIN != aCaptionMargin.right)
|
||||
minCapWidth += aCaptionMargin.right;
|
||||
|
||||
minCapWidth += aCaptionMargin.left;
|
||||
minCapWidth += aCaptionMargin.right;
|
||||
|
||||
switch(aCaptionSide) {
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM:
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
|
||||
if (NS_AUTOMARGIN == aInnerMargin.left) {
|
||||
aInnerMargin.left = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
||||
aContainBlockSize.width, aInnerSize.width);
|
||||
}
|
||||
aOrigin.x = aInnerMargin.left;
|
||||
if (NS_AUTOMARGIN == aInnerMargin.bottom) {
|
||||
aInnerMargin.bottom = 0;
|
||||
}
|
||||
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
||||
nsCollapsingMargin marg;
|
||||
marg.Include(aInnerMargin.bottom);
|
||||
marg.Include(aCaptionMargin.top);
|
||||
nscoord collapseMargin = marg.get();
|
||||
nscoord height = aInnerSize.height + collapseMargin + aCaptionSize.height;
|
||||
aInnerMargin.top = CalcAutoMargin(aInnerMargin.top, aCaptionMargin.bottom,
|
||||
aContainBlockSize.height, height);
|
||||
}
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
} break;
|
||||
// horizontal computation
|
||||
switch (aCaptionSide) {
|
||||
case NS_STYLE_CAPTION_SIDE_LEFT: {
|
||||
|
||||
if (NS_AUTOMARGIN == aInnerMargin.left) {
|
||||
aInnerMargin.left = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
||||
aContainBlockSize.width, aInnerSize.width);
|
||||
|
||||
}
|
||||
if (aInnerMargin.left < minCapWidth) {
|
||||
// shift the inner table to get some place for the caption
|
||||
aInnerMargin.right += aInnerMargin.left - minCapWidth;
|
||||
|
@ -965,73 +912,55 @@ nsTableOuterFrame::GetInnerOrigin(PRUint32 aCaptionSide,
|
|||
aInnerMargin.left = minCapWidth;
|
||||
}
|
||||
aOrigin.x = aInnerMargin.left;
|
||||
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
||||
aInnerMargin.top = 0;
|
||||
}
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
switch(GetCaptionVerticalAlign()) {
|
||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||
aOrigin.y = PR_MAX(aInnerMargin.top, (aCaptionSize.height - aInnerSize.height) / 2);
|
||||
break;
|
||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||
aOrigin.y = PR_MAX(aInnerMargin.top, aCaptionSize.height - aInnerSize.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_RIGHT: {
|
||||
if (NS_AUTOMARGIN == aInnerMargin.right) {
|
||||
aInnerMargin.right = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
||||
aContainBlockSize.width, aInnerSize.width);
|
||||
if (aInnerMargin.right < minCapWidth) {
|
||||
// shift the inner table to get some place for the caption
|
||||
aInnerMargin.left -= aInnerMargin.right - minCapWidth;
|
||||
aInnerMargin.left = PR_MAX(0, aInnerMargin.left);
|
||||
aInnerMargin.right = minCapWidth;
|
||||
}
|
||||
}
|
||||
aOrigin.x = aInnerMargin.left;
|
||||
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
||||
aInnerMargin.top = 0;
|
||||
}
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
switch(GetCaptionVerticalAlign()) {
|
||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||
aOrigin.y = PR_MAX(aInnerMargin.top, (aCaptionSize.height - aInnerSize.height) / 2);
|
||||
break;
|
||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||
aOrigin.y = PR_MAX(aInnerMargin.top, aCaptionSize.height - aInnerSize.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
default: { // top
|
||||
default: {
|
||||
NS_ASSERTION(aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP ||
|
||||
aCaptionSide == NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE ||
|
||||
aCaptionSide == NS_STYLE_CAPTION_SIDE_BOTTOM ||
|
||||
aCaptionSide == NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE ||
|
||||
aCaptionSide == NS_STYLE_CAPTION_SIDE_RIGHT ||
|
||||
aCaptionSide == NO_SIDE,
|
||||
"unexpected caption side");
|
||||
if (NS_AUTOMARGIN == aInnerMargin.left) {
|
||||
aInnerMargin.left = CalcAutoMargin(aInnerMargin.left, aInnerMargin.right,
|
||||
aContainBlockSize.width, aInnerSize.width);
|
||||
}
|
||||
aOrigin.x = aInnerMargin.left;
|
||||
if (NS_AUTOMARGIN == aInnerMargin.top) {
|
||||
aInnerMargin.top = 0;
|
||||
}
|
||||
nsCollapsingMargin marg;
|
||||
marg.Include(aCaptionMargin.bottom);
|
||||
marg.Include(aInnerMargin.top);
|
||||
nscoord collapseMargin = marg.get();
|
||||
if (NS_AUTOMARGIN == aInnerMargin.bottom) {
|
||||
nscoord height = aCaptionSize.height + collapseMargin + aInnerSize.height;
|
||||
aInnerMargin.bottom = CalcAutoMargin(aCaptionMargin.bottom, aInnerMargin.top,
|
||||
aContainBlockSize.height, height);
|
||||
}
|
||||
aOrigin.y = aCaptionMargin.top + aCaptionSize.height + collapseMargin;
|
||||
} break;
|
||||
}
|
||||
|
||||
// vertical computation
|
||||
switch (aCaptionSide) {
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM:
|
||||
case NS_STYLE_CAPTION_SIDE_BOTTOM_OUTSIDE: {
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_LEFT:
|
||||
case NS_STYLE_CAPTION_SIDE_RIGHT: {
|
||||
aOrigin.y = aInnerMargin.top;
|
||||
switch (GetCaptionVerticalAlign()) {
|
||||
case NS_STYLE_VERTICAL_ALIGN_MIDDLE:
|
||||
aOrigin.y = PR_MAX(aInnerMargin.top, (aCaptionSize.height - aInnerSize.height) / 2);
|
||||
break;
|
||||
case NS_STYLE_VERTICAL_ALIGN_BOTTOM:
|
||||
aOrigin.y = PR_MAX(aInnerMargin.top, aCaptionSize.height - aInnerSize.height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
case NO_SIDE:
|
||||
case NS_STYLE_CAPTION_SIDE_TOP: {
|
||||
aOrigin.y = aInnerMargin.top + aCaptionMargin.top + aCaptionSize.height +
|
||||
aCaptionMargin.bottom;
|
||||
} break;
|
||||
case NS_STYLE_CAPTION_SIDE_TOP_OUTSIDE: {
|
||||
nsCollapsingMargin marg;
|
||||
marg.Include(aCaptionMargin.bottom);
|
||||
marg.Include(aInnerMargin.top);
|
||||
nscoord collapseMargin = marg.get();
|
||||
aOrigin.y = aCaptionMargin.top + aCaptionSize.height + collapseMargin;
|
||||
} break;
|
||||
default:
|
||||
NS_NOTREACHED("Unknown caption alignment type");
|
||||
break;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче