Skip to content

Commit

Permalink
Bug 724352 - Don't add vertical margin to scrollable overflow here, i…
Browse files Browse the repository at this point in the history
…t's already done during reflow and we don't need it for UpdateOverflow yet (and we need to account for margin-collapsing when we do). r=roc, a=akeybl
  • Loading branch information
MatsPalmgren committed Apr 5, 2012
1 parent 988f85c commit d1256e5
Show file tree
Hide file tree
Showing 6 changed files with 191 additions and 0 deletions.
9 changes: 9 additions & 0 deletions layout/generic/nsFrame.cpp
Expand Up @@ -6672,6 +6672,15 @@ nsIFrame::FinishAndStoreOverflow(nsOverflowAreas& aOverflowAreas,
// XXX In theory this should consider margin collapsing
nsRect marginBounds(bounds);
nsMargin margin = GetUsedMargin();

// Bug 724352 - vertical scrollable overflow only matters for
// scroll frames which are block margin roots and has already
// accumulated child vertical margins during reflow. We need
// to revisit this when using UpdateOverflow for non-transform
// style changes (bug 719177).
margin.top = 0;
margin.bottom = 0;

ApplySkipSides(margin);
marginBounds.SaturatingInflate(margin);
nsRect& so = aOverflowAreas.ScrollableOverflow();
Expand Down
2 changes: 2 additions & 0 deletions layout/reftests/margin-collapsing/reftest.list
Expand Up @@ -324,3 +324,5 @@ fails == block-clear-7g-left.html block-clear-7efgh-left-ref2.html # Bug 493380
== block-zero-min-height-3d.html block-zero-min-height-3-ref.html
== block-percent-1.html block-percent-1-ref.html
== dynamic-add-text-1.html dynamic-add-text-1-ref.html # Bug 467321
== scrollable-vertical-margin.html scrollable-vertical-margin-ref.html
== scrollable-horizontal-margin.html scrollable-horizontal-margin-ref.html
@@ -0,0 +1,25 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 724352</title>
<style type="text/css">

html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}

x1,x2,x3,x4,x5,x6 { display:block; }
x2 { overflow:auto; width:100px; background:grey; }
x4 { width: 70px; }
x3 { width: 70px; padding: 0 20px; }
</style>
</head>
<body>

<x1><x2 style="height:50px;">
<x3><x4 style="height:20px; background:lime; "></x4></x3>
</x2>


</body>
</html>
@@ -0,0 +1,24 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 724352</title>
<style type="text/css">

html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}

x1,x2,x3,x4,x5,x6 { display:block; }
x2 { overflow:auto; width:100px; background:grey; }
x4 { width: 70px; margin: 0 20px; }
</style>
</head>
<body>

<x1><x2 style="height:50px;">
<x4 style="height:20px; background:lime; "></x4>
</x2>


</body>
</html>
@@ -0,0 +1,66 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 724352</title>
<style type="text/css">

html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}

x1,x2,x3,x4,x5,x6 { display:block; }
x7 {display:block; height:20px;background:lime;}
</style>
</head>
<body>

<x1><x2 style="overflow:auto; background:grey; height:50px;">
<x3><x4 style="padding:20px 0 10px 0; height:20px;"><x7></x7></x4></x3>
</x2>
<x6 style="padding-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:70px;">
<x3 style="padding-bottom:30px"><x4 style="padding-top:20px; height:20px;"><x7></x7></x4></x3>
</x2>
<x6 style="padding-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:60px;">
<x3 style="padding-bottom:10px"><x4 style="padding-top:20px; height:20px;"><x7></x7></x4></x3>
</x2>
<x6 style="padding-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:50px;">
<x3 style="padding-bottom:10px"><x4 style="padding-top:20px; height:20px;"><x7></x7></x4></x3>
</x2>
<x6 style="padding-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:60px;">
<x3><x4 style="padding:20px 0; height:20px;"><x7></x7></x4></x3>
</x2>
<x6 style="padding-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:60px;">
<x3><x4 style="padding:20px 0; height:20px;"><x7></x7></x4></x3>
</x2>
<x6 style="padding-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:50px;">
<x3><x4 style="padding:10px 0 20px 0; height:20px;"><x7></x7></x4></x3>
</x2>
<x6 style="padding-top:10px">x</x6></x1>


</body>
</html>
65 changes: 65 additions & 0 deletions layout/reftests/margin-collapsing/scrollable-vertical-margin.html
@@ -0,0 +1,65 @@
<!DOCTYPE HTML>
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testcase for bug 724352</title>
<style type="text/css">

html,body {
color:black; background-color:white; font-size:16px; padding:0; margin:0;
}

x1,x2,x3,x4,x5,x6 { display:block; }
</style>
</head>
<body>

<x1><x2 style="overflow:auto; background:grey; height:50px;">
<x3 style="margin-bottom:-10px"><x4 style="margin:20px 0; height:20px; background:lime; "></x4></x3>
</x2>
<x6 style="margin-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:70px;">
<x3 style="margin-bottom:30px"><x4 style="margin:20px 0; height:20px; background:lime; "></x4></x3>
</x2>
<x6 style="margin-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:60px;">
<x3 style="margin-bottom:10px"><x4 style="margin:20px 0; height:20px; background:lime; "></x4></x3>
</x2>
<x6 style="margin-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:50px;">
<x3 style="margin-bottom:20px"><x4 style="margin:20px 0 -10px 0; height:20px; background:lime; "></x4></x3>
</x2>
<x6 style="margin-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:60px;">
<x3 style="margin-bottom:20px"><x4 style="margin:20px 0; height:20px; background:lime; "></x4></x3>
</x2>
<x6 style="margin-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:60px;">
<x3 style="margin-top:20px"><x4 style="margin:20px 0; height:20px; background:lime; "></x4></x3>
</x2>
<x6 style="margin-top:10px">x</x6></x1>



<x1><x2 style="overflow:auto; background:grey; height:50px;">
<x3 style="margin-top:-10px"><x4 style="margin:20px 0; height:20px; background:lime; "></x4></x3>
</x2>
<x6 style="margin-top:10px">x</x6></x1>


</body>
</html>

0 comments on commit d1256e5

Please sign in to comment.