Fix regression handling auto margins on absolutely positioned elements. b=419060 r+sr=roc a=blocking1.9+

This commit is contained in:
dbaron@dbaron.org 2008-02-24 10:28:57 -08:00
parent 3dc70c8522
commit 23d90b0567
5 changed files with 77 additions and 4 deletions

View File

@ -1276,11 +1276,11 @@ nsHTMLReflowState::InitAbsoluteConstraints(nsPresContext* aPresContext,
mComputedMargin.right = availMarginSpace - mComputedMargin.left;
} else {
// Just 'margin-left' is 'auto'
mComputedMargin.left = availMarginSpace - mComputedMargin.right;
mComputedMargin.left = availMarginSpace;
}
} else {
// Just 'margin-right' is 'auto'
mComputedMargin.right = availMarginSpace - mComputedMargin.left;
mComputedMargin.right = availMarginSpace;
}
}

View File

@ -16,5 +16,5 @@
== box-sizing-2.html box-sizing-2-ref.html
== box-sizing-3.html box-sizing-1-ref.html
== box-sizing-4.html box-sizing-4-ref.html
fails == abspos-non-replaced-width-offset-margin.html abspos-non-replaced-width-offset-margin-ref.html # bug 419060, bug 419072
fails fails-if(MOZ_WIDGET_TOOLKIT=="cocoa") == abspos-replaced-width-offset-margin.html abspos-replaced-width-offset-margin-ref.html # bug 419060, bug 419072, bug 371316 or other image scaling issue
fails == abspos-non-replaced-width-offset-margin.html abspos-non-replaced-width-offset-margin-ref.html # bug 419072
fails == abspos-replaced-width-offset-margin.html abspos-replaced-width-offset-margin-ref.html # bug 419072

View File

@ -0,0 +1,34 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title>Absolute positioning margin:auto regression</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
body > div {
position: relative;
border: medium solid;
width: 600px;
padding-bottom: 0.5em;
}
body > div > div {
background: blue;
width: 400px;
height: 1em;
margin-left: 100px;
}
</style>
</head>
<body>
<div>
This div should be centered within its container:
<div></div>
</div>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en-US">
<head>
<title>Absolute positioning margin:auto regression</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css">
body > div {
position: relative;
border: medium solid;
width: 600px;
padding-bottom: 1.5em;
}
body > div > div {
background: blue;
width: 400px;
height: 1em;
position: absolute;
left: 0;
right: 0;
margin-left: auto;
margin-right: 100px;
}
</style>
</head>
<body>
<div>
This div should be centered within its container:
<div></div>
</div>
</body>
</html>

View File

@ -733,3 +733,4 @@ random == 403134-1.html 403134-1-ref.html # bug 405377
== 414851-1.html 414851-1-ref.html
== 416106-1.xhtml 416106-1-ref.xhtml
== 417676.html 417676-ref.html
== 419060.html 419060-ref.html