Bug 724352 - Don't add vertical margin to scrollable overflow here, it'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
authorMats Palmgren <matspal@gmail.com>
Thu, 05 Apr 2012 16:30:21 +0200
changeset 94392 b18609e4bc570b9839333fc18a05b1a2eb431714
parent 94391 179d4fadc70a056a8eed8b34d5127b586c148bff
child 94393 cc7afdbc31ff4d3d1f27bf718050d48e049a3e91
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs724352
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 724352 - Don't add vertical margin to scrollable overflow here, it'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
layout/generic/nsFrame.cpp
layout/reftests/margin-collapsing/reftest.list
layout/reftests/margin-collapsing/scrollable-horizontal-margin-ref.html
layout/reftests/margin-collapsing/scrollable-horizontal-margin.html
layout/reftests/margin-collapsing/scrollable-vertical-margin-ref.html
layout/reftests/margin-collapsing/scrollable-vertical-margin.html
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -6715,16 +6715,25 @@ nsIFrame::FinishAndStoreOverflow(nsOverf
       o.UnionRectEdges(o, bounds);
     }
 
     if (!nsLayoutUtils::IsPopup(this)) {
       // Include margin in scrollable overflow.
       // 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();
       so.SaturatingUnionRectEdges(so, marginBounds);
     }
   }
 
   // Note that NS_STYLE_OVERFLOW_CLIP doesn't clip the frame background,
--- a/layout/reftests/margin-collapsing/reftest.list
+++ b/layout/reftests/margin-collapsing/reftest.list
@@ -319,8 +319,10 @@ fails == block-clear-7g-left.html block-
 != block-zero-min-height-2e.html block-zero-min-height-2-noref.html
 != block-zero-min-height-2f.html block-zero-min-height-2-noref.html
 == block-zero-min-height-3a.html block-zero-min-height-3-ref.html
 == block-zero-min-height-3b.html block-zero-min-height-3-ref.html
 == block-zero-min-height-3c.html block-zero-min-height-3-ref.html
 == 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
new file mode 100644
--- /dev/null
+++ b/layout/reftests/margin-collapsing/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>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/margin-collapsing/scrollable-horizontal-margin.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>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/margin-collapsing/scrollable-vertical-margin-ref.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>
new file mode 100644
--- /dev/null
+++ b/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>